lkml.org 
[lkml]   [1998]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] /proc/config.gz (2.0.* version)
Date
Here's a more definitive version of the adaptation of your 2.1.*
/proc/config.gz to 2.0.*.

1) I added a Configure option below CONFIG_FS_PROC (or whatever it is).
How does one get it to default to "y"? I couldn't remember where
defaults are hidden.
2) I enclosed all kernel code in ifdef CONFIG_PROC_CONFIG
3) I changed the main Makefile entries to have a little more dependency
info. Before you did "make proconfig" as a final action under
several make *config variants and proconfig depended on nothing but
rebuilt config.c. I just changed it to depend on config.c and
defined config.c to depend on dummy so that it rebuilds itself
forcibly, rather than being forcibly rebuilt by other things.
Now please add/alter dependencies to taste.
4) I removed your scripts/makeproconfig.c and did it all in the shell
script instead. Please replace my use of "od" with a "hexdump" line.
My hexdump doesn't want to play. And I had to add an extra sed filter
to drop an extra line that my od adds (add ods?). I changed the
format to 8 per line, because I count better in octal. Is it right
that the last two bytes from gzip are always zero?
5) I corrected the make clean line as pointed out by other correspondents.

It compiles, but i haven't had a chance to run the result yet. I built
_and ran_ a kernel with roughly the same patch last night, however.

Please have a look and see if Jeanette's bounds checking idea is
required in the memcpy. And see if you can figure out if this really
does use memory or not :-).

Gotta go ...

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 15:03:10 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,12 @@
#endif
case PROC_LOCKS:
return get_locks_status(page);
+
+#ifdef CONFIG_PROC_CONFIG
+ case PROC_CONFIG:
+ return get_proc_config(page);
+#endif
+
}
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 15:03:56 1998
@@ -382,8 +382,17 @@
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,
+ } );
+
+#ifdef CONFIG_PROC_CONFIG
+ proc_register(&proc_root, &(struct proc_dir_entry) {
+ PROC_CONFIG, 9, "config.gz",
+ S_IFREG | S_IRUGO, 1, 0, 0,
+ });
+#endif

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 15:05:41 1998
@@ -45,6 +45,9 @@
PROC_MD,
PROC_RTC,
PROC_LOCKS
+#ifdef CONFIG_PROC_CONFIG
+ ,PROC_CONFIG
+#endif
};

enum pid_directory_inos {
--- 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 11:35:19 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 makeproconfig

include $(TOPDIR)/Rules.make
--- 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 13:34:29 1998
@@ -0,0 +1,29 @@
+#!/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 | \
+ od -v -t x1 -w8 | sed -e '/^[^ ]*$/d' | cut -d' ' -f 2- | \
+ ( echo "unsigned char ucTable[]= {"; sed -e 's/[^ ][^ ]*/ 0x&,/g' ; echo "};" )
+
+# 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/Documentation/Configure.help.pre-proc-config Sun May 31 15:23:51 1998
+++ linux-2.0.25/Documentation/Configure.help Sun May 31 15:27:32 1998
@@ -3406,6 +3406,14 @@
source of trouble if two devices are mistakenly configured to use
the same IRQ). 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 you build. This is extremely useful if you ever
+ build more than one kernel. The cost is about 1K-4K of running
+ memory. Only say no if you really can't spare it. You can sneeze
+ and lose out on more memory than this.

TCFS filesystem support
HAVE_TCFS
--- linux-2.0.25/Makefile.pre-proc-config Sun May 31 01:49:13 1998
+++ linux-2.0.25/Makefile Sun May 31 15:39:39 1998
@@ -190,19 +190,38 @@
rm -f include/asm
( cd include ; ln -sf asm-$(ARCH) asm)

+proconfig: $(TOPDIR)/kernel/config.c
+
+$(TOPDIR)/kernel/config.c: dummy
+ $(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 +395,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    [W:0.048 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site