Enable hardwiring of things like tunables from embedded enironments
that do not start from loader(8).
This commit is contained in:
parent
d0b8716702
commit
76cb0cadf1
@ -655,7 +655,10 @@ alpha_init(pfn, ptb, bim, bip, biv)
|
||||
|
||||
/* Get the loader(8) metadata */
|
||||
preload_metadata = (caddr_t)bootinfo.modptr;
|
||||
kern_envp = bootinfo.envp;
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else
|
||||
kern_envp = bootinfo.envp;
|
||||
|
||||
/* Do basic tuning, hz etc */
|
||||
init_param();
|
||||
|
@ -1813,7 +1813,9 @@ init386(first)
|
||||
} else {
|
||||
metadata_missing = 1;
|
||||
}
|
||||
if (bootinfo.bi_envp)
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else if (bootinfo.bi_envp)
|
||||
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
|
||||
|
||||
/* Init basic tunables, hz etc */
|
||||
|
@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 500007
|
||||
%VERSREQ= 500008
|
||||
|
||||
# Can be overridden by makeoptions or /etc/make.conf
|
||||
KERNEL_KO?= kernel
|
||||
@ -88,10 +88,10 @@ NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
|
||||
${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c config.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
||||
SYSTEM_SFILES= $S/$M/$M/locore.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o hack.So
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-e locorestart \
|
||||
-export-dynamic -dynamic-linker /red/herring \
|
||||
@ -357,6 +357,9 @@ vers.o:
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
|
||||
perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 500007
|
||||
%VERSREQ= 500008
|
||||
|
||||
# Can be overridden by makeoptions or /etc/make.conf
|
||||
KERNEL_KO?= kernel
|
||||
@ -91,10 +91,10 @@ NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
|
||||
${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c config.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
||||
SYSTEM_SFILES= $S/$M/$M/locore.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o hack.So
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-export-dynamic -dynamic-linker /red/herring \
|
||||
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
@ -315,6 +315,9 @@ vers.o:
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
|
||||
perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
|
||||
|
||||
|
@ -27,7 +27,7 @@ OBJDUMP= ia64-unknown-linux-objdump
|
||||
MACHINE_ARCH= ia64
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 500007
|
||||
%VERSREQ= 500008
|
||||
|
||||
# Can be overridden by makeoptions or /etc/make.conf
|
||||
KERNEL_KO?= kernel
|
||||
@ -101,10 +101,10 @@ NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
|
||||
${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c config.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
||||
SYSTEM_SFILES= $S/$M/$M/locore.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o \
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o \
|
||||
# hack.So ski can't cope with dynamic relocs
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-e locorestart \
|
||||
@ -326,6 +326,9 @@ vers.o:
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
|
||||
perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 500007
|
||||
%VERSREQ= 500008
|
||||
|
||||
# Can be overridden by makeoptions or /etc/make.conf
|
||||
KERNEL_KO?= kernel
|
||||
@ -93,10 +93,10 @@ NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
|
||||
${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c config.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
||||
SYSTEM_SFILES= $S/$M/$M/locore.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o hack.So
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-export-dynamic -dynamic-linker /red/herring \
|
||||
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
@ -319,6 +319,9 @@ vers.o:
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
|
||||
perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 500007
|
||||
%VERSREQ= 500008
|
||||
|
||||
# Temporary stuff while we're still embryonic
|
||||
NO_MODULES?= yes
|
||||
@ -94,10 +94,10 @@ NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
|
||||
${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c config.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
||||
SYSTEM_SFILES= $S/$M/$M/locore.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o hack.So
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-export-dynamic -dynamic-linker /red/herring \
|
||||
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
@ -318,6 +318,9 @@ vers.o:
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
|
||||
perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
|
||||
|
||||
|
@ -32,7 +32,7 @@ CWARNFLAGS= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
|
||||
-ansi
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 500007
|
||||
%VERSREQ= 500008
|
||||
|
||||
# Can be overridden by makeoptions or /etc/make.conf
|
||||
KERNEL_KO?= kernel
|
||||
@ -98,10 +98,10 @@ NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
|
||||
${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c config.c
|
||||
SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
|
||||
SYSTEM_SFILES= $S/$M/$M/locore.s $S/$M/$M/exception.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o exception.o vnode_if.o ${OBJS} hints.o config.o hack.So
|
||||
SYSTEM_OBJS= locore.o exception.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-export-dynamic -dynamic-linker /red/herring \
|
||||
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
@ -329,6 +329,9 @@ vers.o:
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
|
||||
perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
|
||||
|
||||
|
@ -1813,7 +1813,9 @@ init386(first)
|
||||
} else {
|
||||
metadata_missing = 1;
|
||||
}
|
||||
if (bootinfo.bi_envp)
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else if (bootinfo.bi_envp)
|
||||
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
|
||||
|
||||
/* Init basic tunables, hz etc */
|
||||
|
@ -387,7 +387,10 @@ ia64_init()
|
||||
if (bootinfo.kernend)
|
||||
kernend = round_page(bootinfo.kernend);
|
||||
preload_metadata = (caddr_t)bootinfo.modptr;
|
||||
kern_envp = bootinfo.envp;
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else
|
||||
kern_envp = bootinfo.envp;
|
||||
|
||||
/* Init basic tunables, including hz */
|
||||
init_param();
|
||||
|
@ -1877,7 +1877,9 @@ init386(first)
|
||||
} else {
|
||||
metadata_missing = 1;
|
||||
}
|
||||
if (bootinfo.bi_envp)
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else if (bootinfo.bi_envp)
|
||||
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
|
||||
|
||||
/* Init basic tunables, hz etc */
|
||||
|
@ -1877,7 +1877,9 @@ init386(first)
|
||||
} else {
|
||||
metadata_missing = 1;
|
||||
}
|
||||
if (bootinfo.bi_envp)
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else if (bootinfo.bi_envp)
|
||||
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
|
||||
|
||||
/* Init basic tunables, hz etc */
|
||||
|
@ -178,6 +178,8 @@ char *getenv __P((const char *name));
|
||||
int getenv_int __P((const char *name, int *data));
|
||||
quad_t getenv_quad __P((const char *name, quad_t *data));
|
||||
extern char *kern_envp;
|
||||
extern char *static_env;
|
||||
extern int envmode;
|
||||
|
||||
#ifdef APM_FIXUP_CALLTODO
|
||||
void adjust_timeout_calltodo __P((struct timeval *time_change));
|
||||
|
@ -122,8 +122,10 @@ struct opt_list {
|
||||
} *otab;
|
||||
|
||||
extern char *ident;
|
||||
extern char *env;
|
||||
extern char *hints;
|
||||
extern int do_trace;
|
||||
extern int envmode;
|
||||
extern int hintmode;
|
||||
|
||||
char *get_word(FILE *);
|
||||
|
@ -9,6 +9,7 @@
|
||||
%token CONFIG
|
||||
%token CPU
|
||||
%token DEVICE
|
||||
%token ENV
|
||||
%token EQUALS
|
||||
%token HINTS
|
||||
%token IDENT
|
||||
@ -75,6 +76,8 @@ static struct device *curp = 0;
|
||||
|
||||
struct device *dtab;
|
||||
char *ident;
|
||||
char *env;
|
||||
int envmode;
|
||||
char *hints;
|
||||
int hintmode;
|
||||
int yyline;
|
||||
@ -145,6 +148,11 @@ Config_spec:
|
||||
= { maxusers = $2; } |
|
||||
PROFILE NUMBER
|
||||
= { profiling = $2; } |
|
||||
ENV ID
|
||||
= {
|
||||
env = $2;
|
||||
envmode = 1;
|
||||
} |
|
||||
HINTS ID
|
||||
= {
|
||||
hints = $2;
|
||||
|
@ -8,4 +8,4 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#define CONFIGVERS 500007
|
||||
#define CONFIGVERS 500008
|
||||
|
@ -67,6 +67,7 @@ struct kt {
|
||||
{ "config", CONFIG },
|
||||
{ "cpu", CPU },
|
||||
{ "device", DEVICE },
|
||||
{ "env", ENV },
|
||||
{ "hints", HINTS },
|
||||
{ "ident", IDENT },
|
||||
{ "machine", ARCH }, /* MACHINE is defined in /sys/param.h */
|
||||
|
@ -206,19 +206,6 @@ makefile(void)
|
||||
ofp = fopen(path("hints.c.new"), "w");
|
||||
if (ofp == NULL)
|
||||
err(1, "%s", path("hints.c.new"));
|
||||
#if 0
|
||||
/*
|
||||
* This is causing more pain than it is worth. And besides, the
|
||||
* release has been fixed so that this isn't necessary anymore.
|
||||
* The boot floppies load hints now.
|
||||
*/
|
||||
if (hintmode == 0) {
|
||||
snprintf(line, sizeof(line), "%s.hints", PREFIX);
|
||||
ifp = fopen(line, "r");
|
||||
if (ifp)
|
||||
hintmode = 2;
|
||||
}
|
||||
#endif
|
||||
fprintf(ofp, "int hintmode = %d;\n", hintmode);
|
||||
fprintf(ofp, "char static_hints[] = {\n");
|
||||
if (ifp) {
|
||||
@ -257,6 +244,55 @@ makefile(void)
|
||||
fclose(ifp);
|
||||
fclose(ofp);
|
||||
moveifchanged(path("hints.c.new"), path("hints.c"));
|
||||
|
||||
if (env) {
|
||||
ifp = fopen(env, "r");
|
||||
if (ifp == NULL)
|
||||
err(1, "%s", env);
|
||||
} else {
|
||||
ifp = NULL;
|
||||
}
|
||||
ofp = fopen(path("env.c.new"), "w");
|
||||
if (ofp == NULL)
|
||||
err(1, "%s", path("env.c.new"));
|
||||
fprintf(ofp, "int envmode = %d;\n", envmode);
|
||||
fprintf(ofp, "char static_env[] = {\n");
|
||||
if (ifp) {
|
||||
while (fgets(line, BUFSIZ, ifp) != 0) {
|
||||
/* zap trailing CR and/or LF */
|
||||
while ((s = rindex(line, '\n')) != NULL)
|
||||
*s = '\0';
|
||||
while ((s = rindex(line, '\r')) != NULL)
|
||||
*s = '\0';
|
||||
/* remove # comments */
|
||||
s = index(line, '#');
|
||||
if (s)
|
||||
*s = '\0';
|
||||
/* remove any whitespace and " characters */
|
||||
s = line;
|
||||
while (*s) {
|
||||
if (*s == ' ' || *s == '\t' || *s == '"') {
|
||||
while (*s) {
|
||||
s[0] = s[1];
|
||||
s++;
|
||||
}
|
||||
/* start over */
|
||||
s = line;
|
||||
continue;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
/* anything left? */
|
||||
if (*line == '\0')
|
||||
continue;
|
||||
fprintf(ofp, "\"%s\\0\"\n", line);
|
||||
}
|
||||
}
|
||||
fprintf(ofp, "\"\\0\"\n};\n");
|
||||
if (ifp)
|
||||
fclose(ifp);
|
||||
fclose(ofp);
|
||||
moveifchanged(path("env.c.new"), path("env.c"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user