Kconfig: rename machine to architecture, ident to board.
Make timezone and maxusers parameters optional. Enable kernel options UCB_METER, EXEC_AOUT, EXEC_ELF and EXEC_SCRIPT by default.
This commit is contained in:
@@ -8,19 +8,11 @@
|
|||||||
#define _SYS_EXEC_H_
|
#define _SYS_EXEC_H_
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
|
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
#define SHSIZE 64
|
#define SHSIZE 64
|
||||||
#define SHPATHLEN 64
|
#define SHPATHLEN 64
|
||||||
#endif
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
#define STRLEN 32
|
#define STRLEN 32
|
||||||
#endif
|
|
||||||
#ifdef EXEC_AOUT
|
|
||||||
#include "exec_aout.h"
|
#include "exec_aout.h"
|
||||||
#endif
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
#include "exec_elf.h"
|
#include "exec_elf.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NO_ADDR ((caddr_t)(~0U)) /* Indicates addr. not yet filled in */
|
#define NO_ADDR ((caddr_t)(~0U)) /* Indicates addr. not yet filled in */
|
||||||
|
|
||||||
@@ -34,29 +26,20 @@ struct exec_params {
|
|||||||
char **userargp;
|
char **userargp;
|
||||||
char **userenvp;
|
char **userenvp;
|
||||||
union {
|
union {
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
char sh[SHSIZE];
|
char sh[SHSIZE];
|
||||||
#endif
|
|
||||||
#ifdef EXEC_AOUT
|
|
||||||
struct exec aout;
|
struct exec aout;
|
||||||
#endif
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
struct elf_ehdr elf;
|
struct elf_ehdr elf;
|
||||||
#endif
|
|
||||||
} hdr; /* head of file to exec */
|
} hdr; /* head of file to exec */
|
||||||
int hdr_len; /* number of bytes valid in image_header */
|
int hdr_len; /* number of bytes valid in image_header */
|
||||||
char **argp, **envp;
|
char **argp, **envp;
|
||||||
u_short argc, envc; /* count of argument and environment strings */
|
u_short argc, envc; /* count of argument and environment strings */
|
||||||
u_short argbc, envbc; /* total number of chars in argc and envc string pool */
|
u_short argbc, envbc; /* total number of chars in argc and envc string pool */
|
||||||
union {
|
union {
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
struct {
|
struct {
|
||||||
char interpname[20]; /* real name of the script interpreter */
|
char interpname[20]; /* real name of the script interpreter */
|
||||||
char interparg[SHPATHLEN]; /* interpreter arg */
|
char interparg[SHPATHLEN]; /* interpreter arg */
|
||||||
char interpreted; /* flag - this executable is interpreted */
|
char interpreted; /* flag - this executable is interpreted */
|
||||||
} sh;
|
} sh;
|
||||||
#endif
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
struct {
|
struct {
|
||||||
struct buf *stbp; /* String table buffer pointer */
|
struct buf *stbp; /* String table buffer pointer */
|
||||||
int stbpos; /* String table pos in buffer */
|
int stbpos; /* String table pos in buffer */
|
||||||
@@ -64,11 +47,8 @@ struct exec_params {
|
|||||||
int stoffset; /* String table file pos */
|
int stoffset; /* String table file pos */
|
||||||
char str[STRLEN];
|
char str[STRLEN];
|
||||||
} elf;
|
} elf;
|
||||||
#endif
|
|
||||||
#ifdef EXEC_AOUT
|
|
||||||
struct {
|
struct {
|
||||||
} aout;
|
} aout;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
|||||||
@@ -476,13 +476,11 @@ struct elf_args {
|
|||||||
#include "opt_execfmt.h"
|
#include "opt_execfmt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
int exec_elf_makecmds __P((struct proc *, struct exec_package *));
|
int exec_elf_makecmds __P((struct proc *, struct exec_package *));
|
||||||
int elf_read_from __P((struct proc *, struct vnode *, u_long,
|
int elf_read_from __P((struct proc *, struct vnode *, u_long,
|
||||||
caddr_t, int));
|
caddr_t, int));
|
||||||
void *elf_copyargs __P((struct exec_package *, struct ps_strings *,
|
void *elf_copyargs __P((struct exec_package *, struct ps_strings *,
|
||||||
void *, void *));
|
void *, void *));
|
||||||
#endif
|
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
int exec_elf_setup_stack __P((struct proc *, struct exec_package *));
|
int exec_elf_setup_stack __P((struct proc *, struct exec_package *));
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
* Miscellaneous virtual memory subsystem variables and structures.
|
||||||
|
*
|
||||||
* Copyright (c) 1982, 1986 Regents of the University of California.
|
* Copyright (c) 1982, 1986 Regents of the University of California.
|
||||||
* All rights reserved. The Berkeley software License Agreement
|
* All rights reserved. The Berkeley software License Agreement
|
||||||
* specifies the terms and conditions for redistribution.
|
* specifies the terms and conditions for redistribution.
|
||||||
@@ -6,20 +8,6 @@
|
|||||||
* @(#)vmsystm.h 7.2.1 (2.11BSD GTE) 1/15/95
|
* @(#)vmsystm.h 7.2.1 (2.11BSD GTE) 1/15/95
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Miscellaneous virtual memory subsystem variables and structures.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(KERNEL) && defined(UCB_METER) && !defined(SUPERVISOR)
|
|
||||||
size_t freemem; /* remaining clicks of free memory */
|
|
||||||
|
|
||||||
u_short avefree; /* moving average of remaining free clicks */
|
|
||||||
u_short avefree30; /* 30 sec (avefree is 5 sec) moving average */
|
|
||||||
|
|
||||||
/* writable copies of tunables */
|
|
||||||
int maxslp; /* max sleep time before very swappable */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fork/vfork accounting.
|
* Fork/vfork accounting.
|
||||||
*/
|
*/
|
||||||
@@ -31,6 +19,16 @@ struct forkstat
|
|||||||
long sizvfork;
|
long sizvfork;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(KERNEL) && defined(UCB_METER) && !defined(SUPERVISOR)
|
#if defined(KERNEL) && defined(UCB_METER)
|
||||||
|
size_t freemem; /* remaining clicks of free memory */
|
||||||
|
|
||||||
|
u_short avefree; /* moving average of remaining free clicks */
|
||||||
|
u_short avefree30; /* 30 sec (avefree is 5 sec) moving average */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* writable copies of tunables
|
||||||
|
*/
|
||||||
|
int maxslp; /* max sleep time before very swappable */
|
||||||
|
|
||||||
struct forkstat forkstat;
|
struct forkstat forkstat;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -31,26 +31,14 @@
|
|||||||
#include <sys/inode.h>
|
#include <sys/inode.h>
|
||||||
#include <sys/exec.h>
|
#include <sys/exec.h>
|
||||||
|
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
int exec_script_check(struct exec_params *epp);
|
int exec_script_check(struct exec_params *epp);
|
||||||
#endif
|
|
||||||
#ifdef EXEC_AOUT
|
|
||||||
int exec_aout_check(struct exec_params *epp);
|
int exec_aout_check(struct exec_params *epp);
|
||||||
#endif
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
int exec_elf_check(struct exec_params *epp);
|
int exec_elf_check(struct exec_params *epp);
|
||||||
#endif
|
|
||||||
|
|
||||||
const struct execsw execsw[] = {
|
const struct execsw execsw[] = {
|
||||||
#ifdef EXEC_AOUT
|
|
||||||
{ exec_aout_check, "a.out" }, /* a.out binaries */
|
{ exec_aout_check, "a.out" }, /* a.out binaries */
|
||||||
#endif
|
|
||||||
#ifdef EXEC_ELF
|
|
||||||
{ exec_elf_check, "elf" }, /* 32bit ELF bins */
|
{ exec_elf_check, "elf" }, /* 32bit ELF bins */
|
||||||
#endif
|
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
{ exec_script_check, "script" }, /* shell scripts */
|
{ exec_script_check, "script" }, /* shell scripts */
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
int nexecs = (sizeof(execsw) / sizeof(*execsw));
|
int nexecs = (sizeof(execsw) / sizeof(*execsw));
|
||||||
int exec_maxhdrsz;
|
int exec_maxhdrsz;
|
||||||
|
|||||||
@@ -260,13 +260,11 @@ void exec_save_args(struct exec_params *epp)
|
|||||||
if ((argp = epp->userargp) != NULL)
|
if ((argp = epp->userargp) != NULL)
|
||||||
while (argp[argc])
|
while (argp[argc])
|
||||||
argc++;
|
argc++;
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
if (epp->sh.interpreted) {
|
if (epp->sh.interpreted) {
|
||||||
argc++;
|
argc++;
|
||||||
if (epp->sh.interparg[0])
|
if (epp->sh.interparg[0])
|
||||||
argc++;
|
argc++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
if ((epp->argp = (char **)exec_alloc(argc * sizeof(char *), NBPW, epp)) == NULL)
|
if ((epp->argp = (char **)exec_alloc(argc * sizeof(char *), NBPW, epp)) == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -283,7 +281,7 @@ void exec_save_args(struct exec_params *epp)
|
|||||||
ap = *argp++;
|
ap = *argp++;
|
||||||
else
|
else
|
||||||
ap = NULL;
|
ap = NULL;
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
if (epp->sh.interpreted) {
|
if (epp->sh.interpreted) {
|
||||||
if (epp->argc == 0)
|
if (epp->argc == 0)
|
||||||
ap = epp->sh.interpname;
|
ap = epp->sh.interpname;
|
||||||
@@ -295,7 +293,6 @@ void exec_save_args(struct exec_params *epp)
|
|||||||
--argp;
|
--argp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (ap == 0)
|
if (ap == 0)
|
||||||
break;
|
break;
|
||||||
l = strlen(ap)+1;
|
l = strlen(ap)+1;
|
||||||
|
|||||||
@@ -66,9 +66,7 @@ int exec_check(struct exec_params *epp)
|
|||||||
* Read the first 'SHSIZE' bytes from the file to execute
|
* Read the first 'SHSIZE' bytes from the file to execute
|
||||||
*/
|
*/
|
||||||
DEBUG("Read header %d bytes from %d\n", sizeof(epp->hdr), 0);
|
DEBUG("Read header %d bytes from %d\n", sizeof(epp->hdr), 0);
|
||||||
#ifdef EXEC_SCRIPT
|
|
||||||
epp->hdr.sh[0] = '\0'; /* for zero length files */
|
epp->hdr.sh[0] = '\0'; /* for zero length files */
|
||||||
#endif
|
|
||||||
error = rdwri (UIO_READ, epp->ip,
|
error = rdwri (UIO_READ, epp->ip,
|
||||||
(caddr_t) &epp->hdr, sizeof(epp->hdr),
|
(caddr_t) &epp->hdr, sizeof(epp->hdr),
|
||||||
(off_t)0, IO_UNIT, &r);
|
(off_t)0, IO_UNIT, &r);
|
||||||
|
|||||||
@@ -118,6 +118,13 @@ extern void _keram_start(), _keram_end();
|
|||||||
#define USIZE 3072
|
#define USIZE 3072
|
||||||
#define SSIZE 2048 /* initial stack size (bytes) */
|
#define SSIZE 2048 /* initial stack size (bytes) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Collect kernel statistics by default.
|
||||||
|
*/
|
||||||
|
#if !defined(UCB_METER) && !defined(NO_UCB_METER)
|
||||||
|
#define UCB_METER
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
#include "machine/io.h"
|
#include "machine/io.h"
|
||||||
|
|
||||||
|
|||||||
@@ -10,27 +10,19 @@
|
|||||||
#
|
#
|
||||||
# For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig
|
# For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig
|
||||||
#
|
#
|
||||||
machine "pic32"
|
architecture "pic32"
|
||||||
|
|
||||||
cpu "PIC32MX7"
|
cpu "PIC32MX7"
|
||||||
ident CHIPKIT_MAX
|
board "CHIPKIT_MAX32"
|
||||||
|
|
||||||
# Linker script
|
# Linker script
|
||||||
ldscript "cfg/bootloader-max32.ld"
|
ldscript "cfg/bootloader-max32.ld"
|
||||||
|
|
||||||
# Need to set locally
|
|
||||||
timezone 8 dst
|
|
||||||
maxusers 1
|
|
||||||
|
|
||||||
# Standard system options
|
# Standard system options
|
||||||
|
hz 100 # Rate of clock interrupt
|
||||||
options "CPU_KHZ=80000" # Oscillator frequency of CPU core
|
options "CPU_KHZ=80000" # Oscillator frequency of CPU core
|
||||||
options "BUS_KHZ=80000" # Frequency of peripheral bus
|
options "BUS_KHZ=80000" # Frequency of peripheral bus
|
||||||
options "HZ=100" # Rate of clock interrupt
|
|
||||||
options "BUS_DIV=1" # Bus clock divisor 1/2/4/8
|
options "BUS_DIV=1" # Bus clock divisor 1/2/4/8
|
||||||
options "EXEC_AOUT" # Run a.out binaries
|
|
||||||
options "EXEC_ELF" # Run ELF binaries
|
|
||||||
options "EXEC_SCRIPT" # Run shell scripts
|
|
||||||
options "UCB_METER" # Collect kernel statistics
|
|
||||||
|
|
||||||
# LED
|
# LED
|
||||||
options "LED_KERNEL_PORT=TRISA" # for kernel activity LED...
|
options "LED_KERNEL_PORT=TRISA" # for kernel activity LED...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
PARAM = -DCHIPKIT_MAX
|
PARAM = -DCHIPKIT_MAX32
|
||||||
PARAM += -DPIC32MX7
|
PARAM += -DPIC32MX7
|
||||||
PARAM += -DPWM_ENABLED
|
PARAM += -DPWM_ENABLED
|
||||||
PARAM += -DADC_ENABLED
|
PARAM += -DADC_ENABLED
|
||||||
@@ -15,17 +15,10 @@ PARAM += -DUART2_ENABLED
|
|||||||
PARAM += -DUART1_ENABLED
|
PARAM += -DUART1_ENABLED
|
||||||
PARAM += -DLED_KERNEL_PIN=3
|
PARAM += -DLED_KERNEL_PIN=3
|
||||||
PARAM += -DLED_KERNEL_PORT=TRISA
|
PARAM += -DLED_KERNEL_PORT=TRISA
|
||||||
PARAM += -DUCB_METER
|
|
||||||
PARAM += -DEXEC_SCRIPT
|
|
||||||
PARAM += -DEXEC_ELF
|
|
||||||
PARAM += -DEXEC_AOUT
|
|
||||||
PARAM += -DBUS_DIV=1
|
PARAM += -DBUS_DIV=1
|
||||||
PARAM += -DHZ=100
|
|
||||||
PARAM += -DBUS_KHZ=80000
|
PARAM += -DBUS_KHZ=80000
|
||||||
PARAM += -DCPU_KHZ=80000
|
PARAM += -DCPU_KHZ=80000
|
||||||
PARAM += -DTIMEZONE=480
|
PARAM += -DHZ=100
|
||||||
PARAM += -DDST=1
|
|
||||||
PARAM += -DMAXUSERS=1
|
|
||||||
LDSCRIPT = "cfg/bootloader-max32.ld"
|
LDSCRIPT = "cfg/bootloader-max32.ld"
|
||||||
#
|
#
|
||||||
# Makefile for RetroBSD, pic32 target
|
# Makefile for RetroBSD, pic32 target
|
||||||
|
|||||||
@@ -7,27 +7,19 @@
|
|||||||
# make clean
|
# make clean
|
||||||
# make
|
# make
|
||||||
#
|
#
|
||||||
machine "pic32"
|
architecture "pic32"
|
||||||
|
|
||||||
cpu "PIC32MX7"
|
cpu "PIC32MX7"
|
||||||
ident CHIPKIT_WF
|
board "CHIPKIT_WF32"
|
||||||
|
|
||||||
# Linker script
|
# Linker script
|
||||||
ldscript "cfg/bootloader-max32.ld"
|
ldscript "cfg/bootloader-max32.ld"
|
||||||
|
|
||||||
# Need to set locally
|
|
||||||
timezone 8 dst
|
|
||||||
maxusers 1
|
|
||||||
|
|
||||||
# Standard system options
|
# Standard system options
|
||||||
|
hz 100 # Rate of clock interrupt
|
||||||
options "CPU_KHZ=80000" # Oscillator frequency of CPU core
|
options "CPU_KHZ=80000" # Oscillator frequency of CPU core
|
||||||
options "BUS_KHZ=80000" # Frequency of peripheral bus
|
options "BUS_KHZ=80000" # Frequency of peripheral bus
|
||||||
options "HZ=100" # Rate of clock interrupt
|
|
||||||
options "BUS_DIV=1" # Bus clock divisor 1/2/4/8
|
options "BUS_DIV=1" # Bus clock divisor 1/2/4/8
|
||||||
options "EXEC_AOUT" # Run a.out binaries
|
|
||||||
options "EXEC_ELF" # Run ELF binaries
|
|
||||||
options "EXEC_SCRIPT" # Run shell scripts
|
|
||||||
options "UCB_METER" # Collect kernel statistics
|
|
||||||
|
|
||||||
# LED
|
# LED
|
||||||
options "LED_KERNEL_PORT=TRISA" # for kernel activity LED...
|
options "LED_KERNEL_PORT=TRISA" # for kernel activity LED...
|
||||||
|
|||||||
@@ -1,6 +1,26 @@
|
|||||||
IDENT=-DCHIPKIT_WF -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART1_ENABLED -DLED_TTY_PIN=1 -DLED_TTY_PORT=TRISA -DLED_DISK_PIN=0 -DLED_DISK_PORT=TRISF -DLED_KERNEL_PIN=0 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000
|
PARAM = -DCHIPKIT_WF32
|
||||||
LDSCRIPT="cfg/bootloader-max32.ld"
|
PARAM += -DPIC32MX7
|
||||||
PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1
|
PARAM += -DPWM_ENABLED
|
||||||
|
PARAM += -DADC_ENABLED
|
||||||
|
PARAM += -DGPIO_ENABLED
|
||||||
|
PARAM += -DSD0_CS_PIN=4
|
||||||
|
PARAM += -DSD0_CS_PORT=TRISD
|
||||||
|
PARAM += -DSD0_PORT=2
|
||||||
|
PARAM += -DSD0_MHZ=10
|
||||||
|
PARAM += -DSPI_ENABLED
|
||||||
|
PARAM += -DCONSOLE_DEVICE=tty0
|
||||||
|
PARAM += -DUART1_ENABLED
|
||||||
|
PARAM += -DLED_TTY_PIN=1
|
||||||
|
PARAM += -DLED_TTY_PORT=TRISA
|
||||||
|
PARAM += -DLED_DISK_PIN=0
|
||||||
|
PARAM += -DLED_DISK_PORT=TRISF
|
||||||
|
PARAM += -DLED_KERNEL_PIN=0
|
||||||
|
PARAM += -DLED_KERNEL_PORT=TRISA
|
||||||
|
PARAM += -DBUS_DIV=1
|
||||||
|
PARAM += -DBUS_KHZ=80000
|
||||||
|
PARAM += -DCPU_KHZ=80000
|
||||||
|
PARAM += -DHZ=100
|
||||||
|
LDSCRIPT = "cfg/bootloader-max32.ld"
|
||||||
#
|
#
|
||||||
# Makefile for RetroBSD, pic32 target
|
# Makefile for RetroBSD, pic32 target
|
||||||
#
|
#
|
||||||
@@ -24,14 +44,14 @@ endif
|
|||||||
# sources are located via $S relative to the compilation directory
|
# sources are located via $S relative to the compilation directory
|
||||||
S = ../..
|
S = ../..
|
||||||
|
|
||||||
COPTS = -I. ${IDENT} -DKERNEL
|
DEFS = -I. ${PARAM} -DKERNEL
|
||||||
CFLAGS = -O ${COPTS} ${PARAM}
|
CFLAGS = -O ${DEFS}
|
||||||
|
|
||||||
# compile rules: rules are named COMPILE_${SUFFIX}
|
# compile rules: rules are named COMPILE_${SUFFIX}
|
||||||
# SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
|
# SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
|
||||||
|
|
||||||
COMPILE_C = ${CC} -c ${CFLAGS} $<
|
COMPILE_C = ${CC} -c ${CFLAGS} $<
|
||||||
COMPILE_S = ${CC} -c ${COPTS} $<
|
COMPILE_S = ${CC} -c ${DEFS} $<
|
||||||
|
|
||||||
OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \
|
OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \
|
||||||
init_main.o init_sysent.o kern_clock.o kern_descrip.o \
|
init_main.o init_sysent.o kern_clock.o kern_descrip.o \
|
||||||
@@ -114,24 +134,17 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig
|
|||||||
load: unix.elf
|
load: unix.elf
|
||||||
pic32prog unix.hex
|
pic32prog unix.hex
|
||||||
|
|
||||||
startup.o: ../startup.S
|
|
||||||
${COMPILE_S}
|
|
||||||
|
|
||||||
# the following are necessary because the files depend on the types of
|
|
||||||
# cpu's included in the system configuration
|
|
||||||
clock.o machdep.o conf.o: Makefile
|
|
||||||
|
|
||||||
machine:
|
machine:
|
||||||
ln -s .. $@
|
ln -s .. $@
|
||||||
|
|
||||||
sys:
|
sys:
|
||||||
ln -s ../../include $@
|
ln -s ../../include $@
|
||||||
|
|
||||||
depend: machine
|
startup.o: ../startup.S
|
||||||
mkdep ${COPTS} ${CFILES} ioconf.c
|
${COMPILE_S}
|
||||||
|
|
||||||
ioconf.o: ioconf.c
|
ioconf.o: ioconf.c
|
||||||
${CC} -c ${CFLAGS} ioconf.c
|
${COMPILE_C}
|
||||||
|
|
||||||
exec_aout.o: $S/kernel/exec_aout.c
|
exec_aout.o: $S/kernel/exec_aout.c
|
||||||
${COMPILE_C}
|
${COMPILE_C}
|
||||||
|
|||||||
@@ -122,15 +122,14 @@ struct config {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Config has a global notion of which machine type is
|
* Config has a global notion of which architecture is being used.
|
||||||
* being used.
|
|
||||||
*/
|
*/
|
||||||
int machine;
|
int arch;
|
||||||
char *machinename;
|
char *archname;
|
||||||
#define MACHINE_PIC32 1
|
#define ARCH_PIC32 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For each machine, a set of CPU's may be specified as supported.
|
* For each architecture, a set of CPU's may be specified as supported.
|
||||||
* These and the options (below) are put in the C flags in the makefile.
|
* These and the options (below) are put in the C flags in the makefile.
|
||||||
*/
|
*/
|
||||||
struct cputype {
|
struct cputype {
|
||||||
@@ -149,7 +148,7 @@ struct opt {
|
|||||||
struct opt *op_next;
|
struct opt *op_next;
|
||||||
} *opt, *mkopt;
|
} *opt, *mkopt;
|
||||||
|
|
||||||
char *ident;
|
char *board;
|
||||||
char *ldscript;
|
char *ldscript;
|
||||||
|
|
||||||
int do_trace;
|
int do_trace;
|
||||||
@@ -163,6 +162,7 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp;
|
|||||||
|
|
||||||
int zone, hadtz;
|
int zone, hadtz;
|
||||||
int dst;
|
int dst;
|
||||||
|
int hz;
|
||||||
int debugging;
|
int debugging;
|
||||||
|
|
||||||
int maxusers;
|
int maxusers;
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
%token AND
|
%token AND
|
||||||
%token ANY
|
%token ANY
|
||||||
|
%token ARCHITECTURE
|
||||||
%token AT
|
%token AT
|
||||||
|
%token BOARD
|
||||||
%token COMMA
|
%token COMMA
|
||||||
%token CONFIG
|
%token CONFIG
|
||||||
%token CONTROLLER
|
%token CONTROLLER
|
||||||
@@ -21,9 +23,7 @@
|
|||||||
%token EQUALS
|
%token EQUALS
|
||||||
%token FLAGS
|
%token FLAGS
|
||||||
%token HZ
|
%token HZ
|
||||||
%token IDENT
|
|
||||||
%token LDSCRIPT
|
%token LDSCRIPT
|
||||||
%token MACHINE
|
|
||||||
%token MAJOR
|
%token MAJOR
|
||||||
%token MASTER
|
%token MASTER
|
||||||
%token MAXUSERS
|
%token MAXUSERS
|
||||||
@@ -139,13 +139,13 @@ Spec:
|
|||||||
;
|
;
|
||||||
|
|
||||||
Config_spec:
|
Config_spec:
|
||||||
MACHINE Save_id
|
ARCHITECTURE Save_id
|
||||||
= {
|
= {
|
||||||
if (strcmp($2, "pic32") == 0) {
|
if (strcmp($2, "pic32") == 0) {
|
||||||
machine = MACHINE_PIC32;
|
arch = ARCH_PIC32;
|
||||||
machinename = "pic32";
|
archname = "pic32";
|
||||||
} else
|
} else
|
||||||
yyerror("Unknown machine type");
|
yyerror("Unknown architecture");
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
CPU Save_id
|
CPU Save_id
|
||||||
@@ -162,8 +162,8 @@ Config_spec:
|
|||||||
|
|
|
|
||||||
MAKEOPTIONS Mkopt_list
|
MAKEOPTIONS Mkopt_list
|
||||||
|
|
|
|
||||||
IDENT ID
|
BOARD ID
|
||||||
= { ident = strdup($2); }
|
= { board = strdup($2); }
|
||||||
|
|
|
|
||||||
LDSCRIPT ID
|
LDSCRIPT ID
|
||||||
= { ldscript = strdup($2); }
|
= { ldscript = strdup($2); }
|
||||||
@@ -758,9 +758,9 @@ void check_nexus(dev, num)
|
|||||||
register struct device *dev;
|
register struct device *dev;
|
||||||
int num;
|
int num;
|
||||||
{
|
{
|
||||||
switch (machine) {
|
switch (arch) {
|
||||||
|
|
||||||
case MACHINE_PIC32:
|
case ARCH_PIC32:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ A second file tells
|
|||||||
.Nm kconfig
|
.Nm kconfig
|
||||||
what files are needed to generate a kernel and
|
what files are needed to generate a kernel and
|
||||||
can be augmented by configuration specific set of files
|
can be augmented by configuration specific set of files
|
||||||
that give alternate files for a specific machine.
|
that give alternate files for a specific architecture.
|
||||||
(see the
|
(see the
|
||||||
.Sx FILES
|
.Sx FILES
|
||||||
section below)
|
section below)
|
||||||
@@ -39,7 +39,7 @@ and other system parameters for one kernel configuration.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
.Nm Kconfig
|
.Nm Kconfig
|
||||||
should be run from the machine and board specific
|
should be run from the architecture and board specific
|
||||||
subdirectory of the system source (like
|
subdirectory of the system source (like
|
||||||
.Pa sys/pic32/max32 ) .
|
.Pa sys/pic32/max32 ) .
|
||||||
.Nm Kconfig
|
.Nm Kconfig
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ static struct kt key_words[] = {
|
|||||||
{ "dumps", DUMPS },
|
{ "dumps", DUMPS },
|
||||||
{ "flags", FLAGS },
|
{ "flags", FLAGS },
|
||||||
{ "hz", HZ },
|
{ "hz", HZ },
|
||||||
{ "ident", IDENT },
|
{ "board", BOARD },
|
||||||
{ "ldscript", LDSCRIPT },
|
{ "ldscript", LDSCRIPT },
|
||||||
{ "machine", MACHINE },
|
{ "architecture", ARCHITECTURE },
|
||||||
{ "major", MAJOR },
|
{ "major", MAJOR },
|
||||||
{ "makeoptions", MAKEOPTIONS },
|
{ "makeoptions", MAKEOPTIONS },
|
||||||
{ "master", MASTER },
|
{ "master", MASTER },
|
||||||
|
|||||||
@@ -76,14 +76,14 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr);
|
|||||||
if (yyparse())
|
if (yyparse())
|
||||||
exit(3);
|
exit(3);
|
||||||
|
|
||||||
switch (machine) {
|
switch (arch) {
|
||||||
|
|
||||||
case MACHINE_PIC32:
|
case ARCH_PIC32:
|
||||||
pic32_ioconf();
|
pic32_ioconf();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Specify machine type, e.g. ``machine pic32''\n");
|
printf("Specify architecture, e.g. ``architecture pic32''\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
makefile(); /* build Makefile */
|
makefile(); /* build Makefile */
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ wnum(num)
|
|||||||
return (errbuf);
|
return (errbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MACHINE_PIC32
|
#if ARCH_PIC32
|
||||||
void pic32_ioconf()
|
void pic32_ioconf()
|
||||||
{
|
{
|
||||||
register struct device *dp, *mp;
|
register struct device *dp, *mp;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
/*
|
/*
|
||||||
* Build the makefile for the system, from
|
* Build the makefile for the system, from
|
||||||
* the information in the files files and the
|
* the information in the files files and the
|
||||||
* additional files for the machine being compiled to.
|
* additional files for the architecture being compiled to.
|
||||||
*/
|
*/
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "y.tab.h"
|
#include "y.tab.h"
|
||||||
@@ -108,15 +108,6 @@ new_fent()
|
|||||||
return (fp);
|
return (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct users {
|
|
||||||
int u_default;
|
|
||||||
int u_min;
|
|
||||||
int u_max;
|
|
||||||
} users[] = {
|
|
||||||
{ 2, 1, 16 }, /* MACHINE_PIC32 */
|
|
||||||
};
|
|
||||||
#define NUSERS (sizeof (users) / sizeof (users[0]))
|
|
||||||
|
|
||||||
int opteq(cp, dp)
|
int opteq(cp, dp)
|
||||||
char *cp, *dp;
|
char *cp, *dp;
|
||||||
{
|
{
|
||||||
@@ -164,7 +155,7 @@ next:
|
|||||||
if (wd == (char *)EOF) {
|
if (wd == (char *)EOF) {
|
||||||
(void) fclose(fp);
|
(void) fclose(fp);
|
||||||
if (first == 1) {
|
if (first == 1) {
|
||||||
(void) sprintf(fname, "files.%s", raise(ident));
|
(void) sprintf(fname, "files.%s", raise(board));
|
||||||
first++;
|
first++;
|
||||||
fp = fopen(fname, "r");
|
fp = fopen(fname, "r");
|
||||||
if (fp != 0)
|
if (fp != 0)
|
||||||
@@ -348,7 +339,7 @@ void do_cfiles(fp)
|
|||||||
}
|
}
|
||||||
if (eq(fl->f_fn, "generic"))
|
if (eq(fl->f_fn, "generic"))
|
||||||
fprintf(fp, "$A/%s/%s ",
|
fprintf(fp, "$A/%s/%s ",
|
||||||
machinename, swapname);
|
archname, swapname);
|
||||||
else
|
else
|
||||||
fprintf(fp, "%s ", swapname);
|
fprintf(fp, "%s ", swapname);
|
||||||
lpos += len + 1;
|
lpos += len + 1;
|
||||||
@@ -418,12 +409,11 @@ void makefile()
|
|||||||
FILE *ifp, *ofp;
|
FILE *ifp, *ofp;
|
||||||
char line[BUFSIZ];
|
char line[BUFSIZ];
|
||||||
struct opt *op;
|
struct opt *op;
|
||||||
struct users *up;
|
|
||||||
struct cputype *cp;
|
struct cputype *cp;
|
||||||
|
|
||||||
read_files();
|
read_files();
|
||||||
strcpy(line, "../Makefile.kconf");
|
strcpy(line, "../Makefile.kconf");
|
||||||
//(void) strcat(line, machinename);
|
//strcat(line, archname);
|
||||||
ifp = fopen(line, "r");
|
ifp = fopen(line, "r");
|
||||||
if (ifp == 0) {
|
if (ifp == 0) {
|
||||||
perror(line);
|
perror(line);
|
||||||
@@ -434,7 +424,7 @@ void makefile()
|
|||||||
perror("Makefile");
|
perror("Makefile");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(ofp, "PARAM = -D%s\n", raise(ident));
|
fprintf(ofp, "PARAM = -D%s\n", raise(board));
|
||||||
if (cputype == 0) {
|
if (cputype == 0) {
|
||||||
printf("cpu type must be specified\n");
|
printf("cpu type must be specified\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -448,25 +438,14 @@ void makefile()
|
|||||||
else
|
else
|
||||||
fprintf(ofp, "PARAM += -D%s\n", op->op_name);
|
fprintf(ofp, "PARAM += -D%s\n", op->op_name);
|
||||||
}
|
}
|
||||||
|
if (hadtz) {
|
||||||
if (hadtz == 0)
|
fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone);
|
||||||
printf("timezone not specified; gmt assumed\n");
|
fprintf(ofp, "PARAM += -DDST=%d\n", dst);
|
||||||
if ((unsigned)machine > NUSERS) {
|
}
|
||||||
printf("maxusers config info isn't present, using pic32\n");
|
if (maxusers > 0)
|
||||||
up = &users[MACHINE_PIC32-1];
|
fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers);
|
||||||
} else
|
if (hz > 0)
|
||||||
up = &users[machine-1];
|
fprintf(ofp, "PARAM += -DHZ=%d\n", hz);
|
||||||
if (maxusers == 0) {
|
|
||||||
printf("maxusers not specified; %d assumed\n", up->u_default);
|
|
||||||
maxusers = up->u_default;
|
|
||||||
} else if (maxusers < up->u_min) {
|
|
||||||
printf("minimum of %d maxusers assumed\n", up->u_min);
|
|
||||||
maxusers = up->u_min;
|
|
||||||
} else if (maxusers > up->u_max)
|
|
||||||
printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers);
|
|
||||||
fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone);
|
|
||||||
fprintf(ofp, "PARAM += -DDST=%d\n", dst);
|
|
||||||
fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers);
|
|
||||||
|
|
||||||
if (ldscript)
|
if (ldscript)
|
||||||
fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript);
|
fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript);
|
||||||
@@ -519,8 +498,7 @@ void do_swapspec(f, name)
|
|||||||
if (!eq(name, "generic"))
|
if (!eq(name, "generic"))
|
||||||
fprintf(f, "swap%s.o: swap%s.c\n", name, name);
|
fprintf(f, "swap%s.o: swap%s.c\n", name, name);
|
||||||
else
|
else
|
||||||
fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n",
|
fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", archname);
|
||||||
machinename);
|
|
||||||
fprintf(f, "\t${COMPILE_C}\n\n");
|
fprintf(f, "\t${COMPILE_C}\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user