lkml.org 
[lkml]   [2000]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
Subject[PATCH] 2.2: /proc/config.gz
This is a 2.2.17pre20 refresh of the /proc/config.gz patch originally
created by, well, here are the credits:

Oliver Xymoron <oxymoron@waste.org> Jan 15 1999
Derived from a patch by Nicholas Leon <nicholas@binary9.net> with
suggestions from Michael Chastain <mec@shout.net> and Peter T. Breuer

I've been using it for at least a year and it's great....
Index: Documentation/Configure.help
--- Documentation/Configure.help.prev
+++ Documentation/Configure.help Fri Aug 4 18:52:48 2000
@@ -7816,4 +7816,12 @@
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
Index: include/linux/proc_fs.h
--- include/linux/proc_fs.h.prev
+++ include/linux/proc_fs.h Fri Aug 4 18:52:48 2000
@@ -52,5 +52,6 @@
PROC_STRAM,
PROC_SOUND,
- PROC_MTRR, /* whether enabled or not */
+ PROC_MTRR, /* whether enabled or not */
+ PROC_CONFIG, /* whether enabled or not */
PROC_FS
};
Index: Makefile
--- Makefile.prev
+++ Makefile Fri Aug 4 18:52:48 2000
@@ -264,4 +264,15 @@
@ touch include/config/MARKER

+cloneconfig: symlinks scripts/split-include
+ @if [ -f "/proc/config.gz" ]; then \
+ mv -f .config .config.bak; \
+ gzip -d < /proc/config.gz > .config; \
+ if [ -r include/linux/autoconf.h ]; then \
+ scripts/split-include include/linux/autoconf.h include/config; \
+ fi; \
+ else \
+ echo "Your current kernel does not support cloning."; \
+ fi
+
linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))

@@ -297,4 +308,7 @@
@mv -f .ver $@

+include/linux/config_data.h: newversion scripts/bin2c
+ gzip -9 < .config | scripts/bin2c kernel_config_data > $@
+
include/linux/version.h: ./Makefile
@echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
@@ -303,5 +317,5 @@
@mv -f .ver $@

-init/version.o: init/version.c include/linux/compile.h include/config/MARKER
+init/version.o: init/version.c include/linux/compile.h include/linux/config_data.h include/config/MARKER
$(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c

@@ -375,5 +389,5 @@
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
@@ -406,5 +420,5 @@
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
@@ -488,2 +502,5 @@
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
Index: fs/Config.in
--- fs/Config.in.prev
+++ fs/Config.in Fri Aug 4 18:52:48 2000
@@ -35,4 +35,7 @@
tristate 'OS/2 HPFS filesystem support (read only)' 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
Index: fs/proc/array.c
--- fs/proc/array.c.prev
+++ fs/proc/array.c Fri Aug 4 18:52:48 2000
@@ -415,4 +415,15 @@ static int get_version(char * 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)
{
@@ -1461,4 +1472,9 @@ static long get_root_array(char * page,
return get_stram_list(page);
#endif
+#ifdef CONFIG_PROC_CONFIG
+ case PROC_CONFIG:
+ return get_proc_config(page);
+#endif
+
}
return -EBADF;
Index: fs/proc/root.c
--- fs/proc/root.c.prev
+++ fs/proc/root.c Fri Aug 4 18:52:48 2000
@@ -691,4 +691,11 @@ static struct proc_dir_entry proc_root_p
};
#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))
@@ -771,5 +778,7 @@ __initfunc(void proc_root_init(void))
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);
}
Index: init/version.c
--- init/version.c.prev
+++ init/version.c Fri Aug 4 18:52:48 2000
@@ -7,8 +7,12 @@
*/

+#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
Index: scripts/bin2c.c
--- /dev/null Tue May 9 16:53:16 2000
+++ scripts/bin2c.c Fri Aug 4 18:52:48 2000
@@ -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;
+}
--
Chip Salzenberg - a.k.a. - <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
but he stepped in a wormhole and had to go in early." // MST3K
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:38    [from the cache]
©2003-2011 Jasper Spaans