summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-06-08 23:27:16 +0000
committerjkh <jkh@FreeBSD.org>1996-06-08 23:27:16 +0000
commit91826e819af133ca9839fa2ec5087e87f336e699 (patch)
treebd1a8065d30ceda1e0825eb79e1c03c7d5f7c1ae /usr.sbin/config
parent3d420212c7ea85c09391275efbfb726a5aa7d448 (diff)
downloadFreeBSD-src-91826e819af133ca9839fa2ec5087e87f336e699.zip
FreeBSD-src-91826e819af133ca9839fa2ec5087e87f336e699.tar.gz
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>
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/config.87
-rw-r--r--usr.sbin/config/main.c38
2 files changed, 45 insertions, 0 deletions
diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8
index 32cb360..35de364 100644
--- a/usr.sbin/config/config.8
+++ b/usr.sbin/config/config.8
@@ -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
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index a203769..76f9a55 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -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.
OpenPOWER on IntegriCloud