summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/alpha/machdep.c5
-rw-r--r--sys/amd64/amd64/machdep.c4
-rw-r--r--sys/conf/Makefile.alpha9
-rw-r--r--sys/conf/Makefile.i3869
-rw-r--r--sys/conf/Makefile.ia649
-rw-r--r--sys/conf/Makefile.pc989
-rw-r--r--sys/conf/Makefile.powerpc9
-rw-r--r--sys/conf/Makefile.sparc649
-rw-r--r--sys/i386/i386/machdep.c4
-rw-r--r--sys/ia64/ia64/machdep.c5
-rw-r--r--sys/pc98/i386/machdep.c4
-rw-r--r--sys/pc98/pc98/machdep.c4
-rw-r--r--sys/sys/systm.h2
-rw-r--r--usr.sbin/config/config.h2
-rw-r--r--usr.sbin/config/config.y8
-rw-r--r--usr.sbin/config/configvers.h2
-rw-r--r--usr.sbin/config/lang.l1
-rw-r--r--usr.sbin/config/mkmakefile.c62
18 files changed, 119 insertions, 38 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 54c7b65..ea385be 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -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();
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index c1148e9..95f729d 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -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 */
diff --git a/sys/conf/Makefile.alpha b/sys/conf/Makefile.alpha
index 2a2a1ef..e9c5ade 100644
--- a/sys/conf/Makefile.alpha
+++ b/sys/conf/Makefile.alpha
@@ -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
diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386
index 5cf3310..aea5aff 100644
--- a/sys/conf/Makefile.i386
+++ b/sys/conf/Makefile.i386
@@ -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
diff --git a/sys/conf/Makefile.ia64 b/sys/conf/Makefile.ia64
index 6c23e24..56d44a5 100644
--- a/sys/conf/Makefile.ia64
+++ b/sys/conf/Makefile.ia64
@@ -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
diff --git a/sys/conf/Makefile.pc98 b/sys/conf/Makefile.pc98
index c995942..d082fa6 100644
--- a/sys/conf/Makefile.pc98
+++ b/sys/conf/Makefile.pc98
@@ -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
diff --git a/sys/conf/Makefile.powerpc b/sys/conf/Makefile.powerpc
index 382e9bf..8b492fa 100644
--- a/sys/conf/Makefile.powerpc
+++ b/sys/conf/Makefile.powerpc
@@ -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
diff --git a/sys/conf/Makefile.sparc64 b/sys/conf/Makefile.sparc64
index 7c578d1..5cc86a8 100644
--- a/sys/conf/Makefile.sparc64
+++ b/sys/conf/Makefile.sparc64
@@ -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
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index c1148e9..95f729d 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -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 */
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 8a6d335..04b9e1a 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -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();
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index c0d5eff..c6768ac 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -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 */
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index c0d5eff..c6768ac 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -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 */
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 469a490..5b52481 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -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));
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
index 8b6606f..7c493d8 100644
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -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 *);
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index 5f15774..b1f5f2b 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -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;
diff --git a/usr.sbin/config/configvers.h b/usr.sbin/config/configvers.h
index 3dbb96d..e62ab7b 100644
--- a/usr.sbin/config/configvers.h
+++ b/usr.sbin/config/configvers.h
@@ -8,4 +8,4 @@
*
* $FreeBSD$
*/
-#define CONFIGVERS 500007
+#define CONFIGVERS 500008
diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l
index 63e46e4..f7f6ee0 100644
--- a/usr.sbin/config/lang.l
+++ b/usr.sbin/config/lang.l
@@ -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 */
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 45516fc..29a5cb0 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -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"));
}
/*
OpenPOWER on IntegriCloud