Bring back the `config file in the kernel' feature from the 1.x days. This

is conditionalized by the INCLUDE_CONFIG_FILE option in your kernel config
file and is not turned on by default.

Submitted-By: Bill Pechter <pechter@shell.monmouth.com>
This commit is contained in:
jkh 1996-06-08 23:27:16 +00:00
parent bb8b7c7285
commit 2986a90248
5 changed files with 57 additions and 9 deletions

View File

@ -1,6 +1,7 @@
# Makefile.i386 -- with config changes.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.82 1996/05/07 23:19:46 wosch Exp $
# $Id: Makefile.i386,v 1.83 1996/05/31 01:01:24 peter Exp $
#
# Makefile for FreeBSD
#
@ -57,9 +58,9 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
SYSTEM_CFILES= ioconf.c param.c vnode_if.c
SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
SYSTEM_SFILES= ${I386}/i386/locore.s
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o

View File

@ -1,6 +1,7 @@
# Makefile.i386 -- with config changes.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.82 1996/05/07 23:19:46 wosch Exp $
# $Id: Makefile.i386,v 1.83 1996/05/31 01:01:24 peter Exp $
#
# Makefile for FreeBSD
#
@ -57,9 +58,9 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
SYSTEM_CFILES= ioconf.c param.c vnode_if.c
SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
SYSTEM_SFILES= ${I386}/i386/locore.s
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o

View File

@ -1,6 +1,7 @@
# Makefile.i386 -- with config changes.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.82 1996/05/07 23:19:46 wosch Exp $
# $Id: Makefile.i386,v 1.83 1996/05/31 01:01:24 peter Exp $
#
# Makefile for FreeBSD
#
@ -57,9 +58,9 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
SYSTEM_CFILES= ioconf.c param.c vnode_if.c
SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
SYSTEM_SFILES= ${I386}/i386/locore.s
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o

View File

@ -159,6 +159,13 @@ the problems in the configuration file should be corrected and
should be run again.
Attempts to compile a system that had configuration errors
are likely to fail.
.Pp
If the option "INCLUDE_CONFIG_FILE" is used in the configuration file the
entire input file is embedded in the new kernel. This means that
.Xr strings 1
can be used to extract it from a kernel.
.Pp
strings | grep ___ will print just the configure information.
.Sh FILES
.Bl -tag -width /sys/i386/conf/Makefile.i386 -compact
.It Pa /sys/conf/files

View File

@ -199,6 +199,7 @@ usage: fputs("usage: config [-gpn] sysname\n", stderr);
makefile(); /* build Makefile */
headers(); /* make a lot of .h files */
swapconf(); /* swap config files */
configfile(); /* put config file into kernel*/
printf("Kernel build directory is %s\n", p);
exit(0);
}
@ -332,6 +333,43 @@ path(file)
return (cp);
}
configfile()
{
FILE *fi, *fo;
char *p;
int i;
fi = fopen(PREFIX,"r");
if(!fi) {
perror(PREFIX);
exit(2);
}
fo = fopen(p=path("config.c"),"w");
if(!fo) {
perror(p);
exit(2);
}
fprintf(fo,"#ifdef INCLUDE_CONFIG_FILE \n");
fprintf(fo,"static char *config = \"\n");
fprintf(fo,"START CONFIG FILE %s\n___",PREFIX);
while (EOF != (i=getc(fi))) {
if(i == '\n') {
fprintf(fo,"\n___");
} else if(i == '\"') {
fprintf(fo,"\\\"");
} else if(i == '\\') {
fprintf(fo,"\\\\");
} else {
putc(i,fo);
}
}
fprintf(fo,"\nEND CONFIG FILE %s\n",PREFIX);
fprintf(fo,"\";\n");
fprintf(fo,"\n#endif INCLUDE_CONFIG_FILE");
fclose(fi);
fclose(fo);
}
/*
* moveifchanged --
* compare two files; rename if changed.