and contains the text of the file input to config(8). This allows you to
retreive from a binary kernel, using strings(1), the name of the file used,
and the contents of it. The delta in kernel size is in the order of 2k. This
file is put right after locore, so that we don't get too much garbage in
strings before the stuff we want.
*** YOU NEED TO RECOMPILE config(8) ***
Pyramids had something like this too.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
-# $Id: Makefile.i386,v 1.23 1994/03/21 20:48:47 ats Exp $
+# $Id: Makefile.i386,v 1.24 1994/04/02 07:00:12 davidg Exp $
#
# Makefile for FreeBSD
#
#
# Makefile for FreeBSD
#
NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
+SYSTEM_OBJS=locore.o config.o exception.o swtch.o support.o ${OBJS} param.o \
ioconf.o conf.o machdep.o
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
ioconf.o conf.o machdep.o
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)config.8 6.5 (Berkeley) 3/16/91
.\" SUCH DAMAGE.
.\"
.\" from: @(#)config.8 6.5 (Berkeley) 3/16/91
-.\" $Id: config.8,v 1.6 1993/08/07 07:53:27 cgd Exp $
+.\" $Id: config.8,v 1.2 1993/09/26 23:11:06 rgrimes Exp $
.\"
.Dd March 16, 1991
.Dt CONFIG 8
.\"
.Dd March 16, 1991
.Dt CONFIG 8
should be run again.
Attempts to compile a system that had configuration errors
are likely to fail.
should be run again.
Attempts to compile a system that had configuration errors
are likely to fail.
+.Pp
+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.
.Sh FILES
.Bl -tag -width /sys/i386/conf/Makefile.i386 -compact
.It Pa /sys/conf/files
.Sh FILES
.Bl -tag -width /sys/i386/conf/Makefile.i386 -compact
.It Pa /sys/conf/files
makefile(); /* build Makefile */
headers(); /* make a lot of .h files */
swapconf(); /* swap config files */
makefile(); /* build Makefile */
headers(); /* make a lot of .h files */
swapconf(); /* swap config files */
+ configfile(); /* add config file into kernel */
printf("Don't forget to run \"make depend\"\n");
exit(0);
}
printf("Don't forget to run \"make depend\"\n");
exit(0);
}
+
+
+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,"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");
+ fclose(fi);
+ fclose(fo);
+}