Messages in this thread Patch in this message | | | Date | Tue, 20 Jul 1999 15:03:45 -0500 (CDT) | From | Oliver Xymoron <> | Subject | [patch] config.gz and make cloneconfig |
| |
Please consider the following patch against 2.3.10 which adds a config option to store the kernel configuration in the kernel image and make it available as a file in /proc. It also adds 'make cloneconfig' which will duplicate your running kernel configuration.
Also worth noting is scripts/bin2c, which is meant to replace the poorly named and poorly located bin2hex programs that are in various places.
diff -urN linux/Documentation/Configure.help linux-cfg/Documentation/Configure.help --- linux/Documentation/Configure.help Mon Jul 5 22:37:25 1999 +++ linux-cfg/Documentation/Configure.help Tue Jul 20 13:35:21 1999 @@ -7464,6 +7464,14 @@ This option will enlarge your kernel by about 18 KB. Several programs depend on this, so everyone should say Y here. +/proc/config.gz support +CONFIG_PROC_CONFIG + Say Y here if you want a copy of your current kernel configuration + saved in the kernel that you build. This is extremely useful if you + ever build more than one kernel. The cost is around 1K-4K of running + memory. Only say no if you really can't spare this. You can sneeze + and lose more on memory than this. + NFS filesystem support CONFIG_NFS_FS If you are connected to some other (usually local) Unix computer diff -urN linux/Documentation/patches/cfg linux-cfg/Documentation/patches/cfg --- linux/Documentation/patches/cfg Wed Dec 31 18:00:00 1969 +++ linux-cfg/Documentation/patches/cfg Tue Jul 20 14:26:27 1999 @@ -0,0 +1,10 @@ +This patch adds /proc/config.gz and make cloneconfig + +Oliver Xymoron <oxymoron@waste.org> + +Jan 15 1999 - original 2.0.0-pre version +Jul 20 1999 - updated to 2.3.10 + +Derived from a patch by Nicholas Leon <nicholas@binary9.net> with +suggestions from Michael Chastain <mec@shout.net> and Peter T. Breuer +<ptb@it.uc3m.es> diff -urN linux/Makefile linux-cfg/Makefile --- linux/Makefile Thu Jul 1 12:54:31 1999 +++ linux-cfg/Makefile Tue Jul 20 14:22:52 1999 @@ -243,6 +243,15 @@ config: symlinks $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in +cloneconfig: symlinks + @if [ -f "/proc/config.gz" ]; then \ + mv -f .config .config.bak; \ + gzip -d < /proc/config.gz > .config; \ + $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in; \ + else \ + echo "Sorry, your current kernel was built without cloning support."; \ + fi + include/config/MARKER: scripts/split-include include/linux/autoconf.h scripts/split-include include/linux/autoconf.h include/config @ touch include/config/MARKER @@ -286,7 +295,10 @@ @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver @mv -f .ver $@ -init/version.o: init/version.c include/linux/compile.h include/config/MARKER +include/linux/config_data.h: newversion scripts/bin2c + gzip -9 < .config | scripts/bin2c kernel_config_data > $@ + +init/version.o: init/version.c include/linux/compile.h include/config/MARKER include/linux/config_data.h $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c init/main.o: init/main.c include/config/MARKER @@ -354,7 +366,7 @@ rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print` rm -f core `find . -type f -name 'core' -print` rm -f core `find . -name '.*.flags' -print` - rm -f vmlinux System.map + rm -f vmlinux System.map include/linux/config_data.h rm -f .tmp* rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c rm -f drivers/char/conmakehash @@ -380,7 +392,7 @@ rm -rf include/config rm -f .depend `find . -name .depend -print` rm -f core `find . -size 0 -print` - rm -f .hdepend scripts/mkdep scripts/split-include + rm -f .hdepend scripts/mkdep scripts/split-include scripts/bin2c rm -f $(TOPDIR)/include/linux/modversions.h rm -rf $(TOPDIR)/include/linux/modules rm -rf modules @@ -448,3 +460,6 @@ scripts/split-include: scripts/split-include.c $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c + +scripts/bin2c: scripts/bin2c.c + $(HOSTCC) $(HOSTCFLAGS) -o scripts/bin2c scripts/bin2c.c diff -urN linux/fs/Config.in linux-cfg/fs/Config.in --- linux/fs/Config.in Wed Jun 16 21:26:27 1999 +++ linux-cfg/fs/Config.in Tue Jul 20 13:35:21 1999 @@ -38,6 +38,9 @@ fi tristate 'OS/2 HPFS filesystem support (read/write) (NEW)' CONFIG_HPFS_FS bool '/proc filesystem support' CONFIG_PROC_FS +if [ "$CONFIG_PROC_FS" = "y" ] ; then + bool ' /proc/config.gz (kernel configuration)' CONFIG_PROC_CONFIG +fi if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then # It compiles as a module for testing only. It should not be used # as a module in general. If we make this "tristate", a bunch of people diff -urN linux/fs/proc/array.c linux-cfg/fs/proc/array.c --- linux/fs/proc/array.c Sat Jul 3 14:04:12 1999 +++ linux-cfg/fs/proc/array.c Tue Jul 20 13:35:21 1999 @@ -379,6 +379,17 @@ return strlen(buffer); } +#ifdef CONFIG_PROC_CONFIG +static int get_proc_config(char *buffer) +{ + extern char *kernel_config_data; + extern int kernel_config_data_size; + + memcpy(buffer, kernel_config_data, kernel_config_data_size); + return kernel_config_data_size; +} +#endif + static int get_cmdline(char * buffer) { extern char saved_command_line[]; @@ -1355,6 +1366,11 @@ case PROC_STRAM: return get_stram_list(page); #endif +#ifdef CONFIG_PROC_CONFIG + case PROC_CONFIG: + return get_proc_config(page); +#endif + } return -EBADF; } diff -urN linux/fs/proc/root.c linux-cfg/fs/proc/root.c --- linux/fs/proc/root.c Sat Jul 3 12:42:21 1999 +++ linux-cfg/fs/proc/root.c Tue Jul 20 13:35:21 1999 @@ -703,6 +703,13 @@ NULL, NULL /* parent, subdir */ }; #endif +#ifdef CONFIG_PROC_CONFIG +static struct proc_dir_entry proc_root_config = { + PROC_CONFIG, 9, "config.gz", + S_IFREG | S_IRUGO, 1, 0, 0, + 0, &proc_array_inode_operations +}; +#endif __initfunc(void proc_root_init(void)) { @@ -780,7 +787,9 @@ #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); #endif - +#ifdef CONFIG_PROC_CONFIG + proc_register(&proc_root, &proc_root_config); +#endif proc_bus = create_proc_entry("bus", S_IFDIR, 0); } diff -urN linux/include/linux/proc_fs.h linux-cfg/include/linux/proc_fs.h --- linux/include/linux/proc_fs.h Wed Jul 7 11:21:05 1999 +++ linux-cfg/include/linux/proc_fs.h Tue Jul 20 14:03:37 1999 @@ -54,6 +54,7 @@ PROC_SOUND, PROC_MTRR, /* whether enabled or not */ PROC_FS, + PROC_CONFIG, /* whether enabled or not */ PROC_SYSVIPC }; diff -urN linux/init/version.c linux-cfg/init/version.c --- linux/init/version.c Mon Jan 5 03:41:01 1998 +++ linux-cfg/init/version.c Tue Jul 20 13:35:21 1999 @@ -6,10 +6,14 @@ * May be freely distributed as part of Linux. */ +#include <linux/config.h> #include <linux/uts.h> #include <linux/utsname.h> #include <linux/version.h> #include <linux/compile.h> +#ifdef CONFIG_PROC_CONFIG +#include <linux/config_data.h> +#endif #define version(a) Version_ ## a #define version_string(a) version(a) diff -urN linux/scripts/bin2c.c linux-cfg/scripts/bin2c.c --- linux/scripts/bin2c.c Wed Dec 31 18:00:00 1969 +++ linux-cfg/scripts/bin2c.c Tue Jul 20 13:35:21 1999 @@ -0,0 +1,23 @@ +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + int ch,total=0; + + if(argc>1) printf("const char *%s %s=\n",argv[1],argc>2?argv[2]:""); + + do { + printf("\t\""); + while((ch=getchar())!=EOF) + { + total++; + printf("\\x%02x",ch); + if(total%16==0) break; + } + printf("\"\n"); + } while(ch!=EOF); + + if(argc>1) printf("\t;\n\nconst int %s_size = %d;\n",argv[1],total); + + return 0; +} -- "Love the dolphins," she advised him. "Write by W.A.S.T.E.."
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |