lkml.org 
[lkml]   [1998]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] /proc/config.gz (take #2)
Date
Well, this is the real mccoy, folks. NJL's patch works a treat on my 2.0.25
system now. It should go into 2.0.34 if I could make a plea ... and on
my system (which has uncompressing libraries), all I have to do is a
cat /proc/config rather than a gunzip -c /proc/config.gz, and out comes
the list :-).

The increase in compressed kernel size appears to be about 1.2KB, as
far as I can tell. I didn't measure the running systems. The extra data
structure is very small. Under 1KB in my case. I think that will be the
memory footprint. I'm happy to donate it.

"A month of sundays ago Nicholas J. Leon wrote:"
>
> hehehe. The problem was that because of the "stripped" down nature of the
> .config file that I save, Configure would stop at every question it didn't
> know about (all the unset .config statements). It thought everything was
> "NEW" and prompted you for it.
>
> The "-di" is for "default - ignore new". It allows Configure to run
> straight through without any prompting.
>
> .............................................................................
> ..nicholas j. leon..........mrnick.binary9.net.........nicholas@binary9.net..

The output from "cat /proc/config" (gunzip -c /proc/config.gz) is


EXPERIMENTAL=y
MODULES=y
KERNELD=y
NET=y
PCI=y
PCI_OPTIMIZE=y
SYSVIPC=y
BINFMT_AOUT=m
BINFMT_ELF=y
BINFMT_JAVA=m
KERNEL_ELF=y
M586=y
BLK_DEV_FD=y
BLK_DEV_IDE=y
BLK_DEV_IDECD=y
BLK_DEV_IDETAPE=y
BLK_DEV_IDEFLOPPY=y
BLK_DEV_IDESCSI=y
BLK_DEV_IDE_PCMCIA=y
BLK_DEV_RZ1000=y
BLK_DEV_TRITON=y

bla blah. Here is the patch as adapted for 2.0.*. I made a mistake and
put one too many $(MAKE) proconfig's in the top Makefile, but I don't
know which to remove.

Peter ptb@it.uc3m.es

--- linux-2.0.25/fs/proc/array.c.pre-proc-config Sun May 31 01:11:30 1998
+++ linux-2.0.25/fs/proc/array.c Sun May 31 01:14:59 1998
@@ -998,6 +998,7 @@
extern int get_md_status (char *);
extern int get_rtc_status (char *);
extern int get_locks_status (char *);
+extern int get_proc_config (char *);
#ifdef __SMP_PROF__
extern int get_smp_prof_list(char *);
#endif
@@ -1074,6 +1075,10 @@
#endif
case PROC_LOCKS:
return get_locks_status(page);
+
+ case PROC_CONFIG:
+ return get_proc_config(page);
+
}
return -EBADF;
}
--- linux-2.0.25/fs/proc/root.c.pre-proc-config Sun May 31 01:15:39 1998
+++ linux-2.0.25/fs/proc/root.c Sun May 31 01:34:40 1998
@@ -382,8 +388,15 @@
S_IFREG | S_IRUGO, 1, 0, 0,
});

- proc_register( &proc_root, &(struct proc_dir_entry)
- { PROC_MTAB, 6, "mounts", S_IFREG | S_IRUGO, 1, 0, 0, } );
+ proc_register( &proc_root, &(struct proc_dir_entry) {
+ PROC_MTAB, 6, "mounts",
+ S_IFREG | S_IRUGO, 1, 0, 0,
+ } );
+
+ proc_register(&proc_root, &(struct proc_dir_entry) {
+ PROC_CONFIG, 9, "config.gz",
+ S_IFREG | S_IRUGO, 1, 0, 0,
+ });

if (prof_shift) {
proc_register(&proc_root, &(struct proc_dir_entry) {
--- linux-2.0.25/init/patches/proc-config.pre-proc-config Sun May 31 03:20:21 1998
+++ linux-2.0.25/init/patches/proc-config Sun May 31 03:21:56 1998
@@ -0,0 +1 @@
+/proc/config.gz (N.J. Leon for 2.1.104 adapted by P.T.Breuer for 2.0.25)
--- linux-2.0.25/kernel/Makefile.pre-proc-config Sun May 31 02:15:01 1998
+++ linux-2.0.25/kernel/Makefile Sun May 31 02:15:36 1998
@@ -13,7 +13,7 @@
O_TARGET := kernel.o
O_OBJS = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \
module.o exit.o signal.o itimer.o info.o time.o softirq.o \
- resource.o sysctl.o
+ resource.o sysctl.o config.o

ifeq ($(CONFIG_MODULES),y)
OX_OBJS = ksyms.o
--- linux-2.0.25/include/linux/proc_fs.h.pre-proc-config Sun May 31 01:47:01 1998
+++ linux-2.0.25/include/linux/proc_fs.h Sun May 31 02:30:46 1998
@@ -44,7 +44,8 @@
PROC_MTAB,
PROC_MD,
PROC_RTC,
- PROC_LOCKS
+ PROC_LOCKS,
+ PROC_CONFIG
};

enum pid_directory_inos {
--- linux-2.0.25/scripts/makeproconfig.sh.pre-proc-config Sun May 31 02:01:52 1998
+++ linux-2.0.25/scripts/makeproconfig.sh Sun May 31 02:06:36 1998
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# make a suitable kernel/config.c file
+
+# headers
+cat -<<EOT
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/malloc.h>
+#include <linux/unistd.h>
+
+EOT
+
+# a "ucTable" (this might be better done here!)
+cat $TOPDIR/.config | grep '^CONFIG' | sed 's/CONFIG_//' | gzip -9c | \
+ scripts/makeproconfig
+
+# finally, what to return when get_proc_config is called
+cat -<<EOT
+
+int get_proc_config(char *page) {
+ memcpy(page,ucTable,sizeof(ucTable));
+ return sizeof(ucTable);
+}
+
+EOT
--- linux-2.0.25/scripts/makeproconfig.c.pre-proc-config Sun May 31 02:08:19 1998
+++ linux-2.0.25/scripts/makeproconfig.c Sun May 31 02:08:51 1998
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(void) {
+ int rows=0;
+ char c;
+
+ printf("unsigned char ucTable[]= {\n ");
+
+ while (1) {
+ c=getchar();
+ if (feof(stdin))
+ break;
+ printf("0x%02X, ",(unsigned char)c);
+ if (++rows%10==0) {
+ printf("\n ");
+ }
+ }
+ printf("\n};\n");
+ exit(0);
+}
--- linux-2.0.25/scripts/Makefile.pre-proc-config Sun May 31 02:10:15 1998
+++ linux-2.0.25/scripts/Makefile Sun May 31 02:12:54 1998
@@ -44,7 +44,10 @@
tkgen.o: tkgen.c tkparse.h
$(HOSTCC) $(HOSTCFLAGS) -c -o tkgen.o tkgen.c

+makeproconfig: makeproconfig.c
+ $(CC) makeproconfig.c -o makeproconfig
+
clean:
- rm -f *~ kconfig.tk *.o tkparse
+ rm -f *~ kconfig.tk *.o tkparse makecloneconfig

include $(TOPDIR)/Rules.make
--- linux-2.0.25/Makefile.pre-proc-config Sun May 31 01:49:13 1998
+++ linux-2.0.25/Makefile Sun May 31 02:18:51 1998
@@ -190,19 +190,37 @@
rm -f include/asm
( cd include ; ln -sf asm-$(ARCH) asm)

+proconfig:
+ $(MAKE) -C scripts makeproconfig
+ $(CONFIG_SHELL) scripts/makeproconfig.sh > $(TOPDIR)/kernel/config.c
+
oldconfig: symlinks
$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
+ $(MAKE) proconfig

xconfig: symlinks
$(MAKE) -C scripts kconfig.tk
wish -f scripts/kconfig.tk
+ $(MAKE) proconfig

menuconfig: include/linux/version.h symlinks
$(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
+ $(MAKE) proconfig

config: symlinks
$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
+ $(MAKE) proconfig
+
+cloneconfig: symlinks
+ @if [ -f "/proc/config.gz" ]; then \
+ rm -f .config; \
+ cat /proc/config.gz | gzip -dc | sed 's/^/CONFIG_/' >> .config; \
+ $(CONFIG_SHELL) scripts/Configure -di arch/$(ARCH)/config.in; \
+ $(MAKE) proconfig; \
+ else \
+ echo "Your current kernel does not support cloning."; \
+ fi

linuxsubdirs: dummy
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
@@ -376,7 +394,7 @@
rm -f drivers/scsi/aic7xxx_asm drivers/scsi/aic7xxx_seq.h
rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
rm -f .version .config* config.in config.old
- rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
+ rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp scripts/makeproconfig kernel/config.c
rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
rm -f .menuconfig .menuconfig.log
rm -f include/asm
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [from the cache]
©2003-2011 Jasper Spaans