Re: [PATCH] /proc/config.gz (take #2)

Nicholas J. Leon (nicholas@binary9.net)
Sat, 30 May 1998 18:30:01 -0400 (EDT)


[ i've reposted this with the patch not in base64 ]

diff -Nur linux.104-prist/Makefile linux.104-config/Makefile
--- linux.104-prist/Makefile Sat May 30 14:30:06 1998
+++ linux.104-config/Makefile Sat May 30 16:28:37 1998
@@ -197,11 +197,16 @@
mkdir include/linux/modules; \
fi

+proconfig:
+ $(MAKE) -C scripts makeproconfig
+ $(CONFIG_SHELL) scripts/makeproconfig.sh > $(TOPDIR)/kernel/config.c
+
oldconfig: symlinks scripts/split-include
$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
if [ -r include/linux/autoconf.h ]; then \
scripts/split-include include/linux/autoconf.h include/config; \
fi
+ $(MAKE) proconfig

xconfig: symlinks scripts/split-include
$(MAKE) -C scripts kconfig.tk
@@ -209,6 +214,7 @@
if [ -r include/linux/autoconf.h ]; then \
scripts/split-include include/linux/autoconf.h include/config; \
fi
+ $(MAKE) proconfig

menuconfig: include/linux/version.h symlinks scripts/split-include
$(MAKE) -C scripts/lxdialog all
@@ -216,12 +222,27 @@
if [ -r include/linux/autoconf.h ]; then \
scripts/split-include include/linux/autoconf.h include/config; \
fi
+ $(MAKE) proconfig

config: symlinks scripts/split-include
$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
if [ -r include/linux/autoconf.h ]; then \
scripts/split-include include/linux/autoconf.h include/config; \
fi
+ $(MAKE) proconfig
+
+cloneconfig: symlinks scripts/split-include
+ @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; \
+ if [ -r include/linux/autoconf.h ]; then \
+ scripts/split-include include/linux/autoconf.h include/config; \
+ fi; \
+ $(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
@@ -344,7 +365,7 @@
rm -f core `find . -name '.*.flags' -print`
rm -f vmlinux System.map
rm -f .tmp*
- rm -f drivers/char/consolemap_deftbl.c drivers/char/conmakehash
+ rm -f drivers/char/consolemap_deftbl.c drivers/char/conmakehash
rm -f drivers/sound/bin2hex drivers/sound/hex2hex
if [ -d modules ]; then \
rm -f core `find modules/ -type f -print`; \
@@ -360,7 +381,7 @@
rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
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.log
rm -f include/asm
diff -Nur linux.104-prist/fs/proc/array.c linux.104-config/fs/proc/array.c
--- linux.104-prist/fs/proc/array.c Wed May 6 14:01:45 1998
+++ linux.104-config/fs/proc/array.c Sat May 30 14:15:26 1998
@@ -1200,6 +1200,7 @@
extern int get_rtc_status (char *);
extern int get_locks_status (char *, char **, off_t, int);
extern int get_swaparea_info (char *);
+extern int get_proc_config (char *);
#ifdef CONFIG_ZORRO
extern int zorro_get_list(char *);
#endif
@@ -1290,6 +1291,9 @@
case PROC_HARDWARE:
return get_hardware_list(page);
#endif
+ case PROC_CONFIG:
+ return get_proc_config(page);
+
}
return -EBADF;
}
diff -Nur linux.104-prist/fs/proc/root.c linux.104-config/fs/proc/root.c
--- linux.104-prist/fs/proc/root.c Sun May 17 14:34:57 1998
+++ linux.104-config/fs/proc/root.c Sat May 30 14:16:10 1998
@@ -623,6 +623,11 @@
NULL, NULL /* parent, subdir */
};
#endif
+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
+};

void proc_root_init(void)
{
@@ -694,7 +699,7 @@
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
-
+ proc_register(&proc_root, &proc_root_config);
proc_bus = create_proc_entry("bus", S_IFDIR, 0);
}

diff -Nur linux.104-prist/include/linux/proc_fs.h linux.104-config/include/linux/proc_fs.h
--- linux.104-prist/include/linux/proc_fs.h Fri May 29 13:55:01 1998
+++ linux.104-config/include/linux/proc_fs.h Sat May 30 14:20:28 1998
@@ -51,6 +51,7 @@
PROC_PPC_HTAB,
PROC_SOUND,
PROC_MTRR, /* whether enabled or not */
+ PROC_CONFIG,
PROC_FS
};

diff -Nur linux.104-prist/kernel/Makefile linux.104-config/kernel/Makefile
--- linux.104-prist/kernel/Makefile Wed May 6 14:01:46 1998
+++ linux.104-config/kernel/Makefile Sat May 30 14:17:16 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 itimer.o info.o time.o softirq.o resource.o \
- sysctl.o acct.o capability.o
+ sysctl.o acct.o capability.o config.o

OX_OBJS += signal.o

diff -Nur linux.104-prist/scripts/Configure linux.104-config/scripts/Configure
--- linux.104-prist/scripts/Configure Sun May 3 20:52:06 1998
+++ linux.104-config/scripts/Configure Sat May 30 14:49:58 1998
@@ -120,14 +120,19 @@
# readln prompt default oldval
#
function readln () {
- if [ "$DEFAULT" = "-d" -a -n "$3" ]; then
+ if [ "$DEFAULT" = "-d" -o "$DEFAULT" = "-di" -a -n "$3" ]; then
echo "$1"
ans=$2
else
- echo -n "$1"
- [ -z "$3" ] && echo -n "(NEW) "
- IFS='@' read ans </dev/tty || exit 1
- [ -z "$ans" ] && ans=$2
+ if [ "$DEFAULT" = "-di" -a -z "$3" ]; then
+ echo "$1"
+ ans=$2
+ else
+ echo -n "$1"
+ [ -z "$3" ] && echo -n "(NEW) "
+ IFS='@' read ans </dev/tty || exit 1
+ [ -z "$ans" ] && ans=$2
+ fi
fi
}

@@ -488,6 +493,10 @@
DEFAULT=""
if [ "$1" = "-d" ] ; then
DEFAULT="-d"
+ shift
+fi
+if [ "$1" = "-di" ] ; then
+ DEFAULT="-di"
shift
fi

diff -Nur linux.104-prist/scripts/Makefile linux.104-config/scripts/Makefile
--- linux.104-prist/scripts/Makefile Mon Jan 5 04:41:01 1998
+++ linux.104-config/scripts/Makefile Sat May 30 14:13:44 1998
@@ -33,7 +33,10 @@
tkparse.o tkcond.o tkgen.o:
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)

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

include $(TOPDIR)/Rules.make
diff -Nur linux.104-prist/scripts/makeproconfig.c linux.104-config/scripts/makeproconfig.c
--- linux.104-prist/scripts/makeproconfig.c Wed Dec 31 19:00:00 1969
+++ linux.104-config/scripts/makeproconfig.c Sat May 30 16:17:56 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);
+}
diff -Nur linux.104-prist/scripts/makeproconfig.sh linux.104-config/scripts/makeproconfig.sh
--- linux.104-prist/scripts/makeproconfig.sh Wed Dec 31 19:00:00 1969
+++ linux.104-config/scripts/makeproconfig.sh Sat May 30 14:13:03 1998
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+cat -<<EOT
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/malloc.h>
+#include <linux/unistd.h>
+
+EOT
+
+cat $TOPDIR/.config | grep '^CONFIG' | sed 's/CONFIG_//' | gzip -9c | \
+ scripts/makeproconfig
+
+cat -<<EOT
+
+int get_proc_config(char *page) {
+ memcpy(page,ucTable,sizeof(ucTable));
+ return sizeof(ucTable);
+}
+
+EOT

.............................................................................
..nicholas j. leon..........mrnick.binary9.net.........nicholas@binary9.net..

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu