As you all may know, I'm not the best programmer in the world. So please
consider this to be an EXAMPLE patch of how this might work.
make proconfig
* creates kernel/config.c with all the set variables from .config. Stuff
like "# CONFIG_xyz is not set" is not copied. Currently the full
phrase "CONFIG_xyz" is saved, even though know I could strip it off.
At the end of make {config,oldconfig,xconfig,menuconfig} this is
called to regenerate kernel/config.c.
make curconfig
* if it exists, it will use /proc/config as defaults for this kernel.
This required patching scripts/Configure to support a new option
"-di" will standards for "Default (ignore NEW)". Otherwise at every
point where you don't have the option mention in /proc/config, it
would stop and ask you about it.
And that's basically it. Hopefully this will give a real programmer a
decent starting point for something that we could include in 2.2.
diff -Nur linux.104-prist/Makefile linux.104-config/Makefile
--- linux.104-prist/Makefile Thu May 28 11:18:38 1998
+++ linux.104-config/Makefile Thu May 28 12:36:47 1998
@@ -197,31 +197,50 @@
mkdir include/linux/modules; \
fi
+proconfig:
+ $(CONFIG_SHELL) scripts/makeproconf.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
+
+curconfig: symlinks scripts/split-include
+ @if [ -f "/proc/config" ]; then \
+ cat /proc/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 autoconfiguration"; \
+ fi
-xconfig: symlinks scripts/split-include
+xconfig: symlinks scripts/split-include
$(MAKE) -C scripts kconfig.tk
wish -f scripts/kconfig.tk
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
+menuconfig: include/linux/version.h symlinks scripts/split-include
$(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
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: 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
linuxsubdirs: dummy
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
@@ -359,7 +378,7 @@
rm -f drivers/net/hamradio/soundmodem/gentbl
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 .version .config* config.in config.old kernel/config.c
rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
rm -f .menuconfig.log
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 Thu May 28 11:34:32 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 Thu May 28 11:34:32 1998
@@ -623,6 +623,11 @@
NULL, NULL /* parent, subdir */
};
#endif
+static struct proc_dir_entry proc_root_config = {
+ PROC_CONFIG, 6, "config",
+ 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 Wed May 20 19:21:51 1998
+++ linux.104-config/include/linux/proc_fs.h Thu May 28 11:47:14 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 Thu May 28 11:34:32 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 Thu May 28 12:33:21 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/makeproconf.sh linux.104-config/scripts/makeproconf.sh
--- linux.104-prist/scripts/makeproconf.sh Wed Dec 31 19:00:00 1969
+++ linux.104-config/scripts/makeproconf.sh Thu May 28 12:41:15 1998
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cat -<<EOT
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/malloc.h>
+#include <linux/unistd.h>
+
+
+int get_proc_config(char *page) {
+ int size=0;
+
+EOT
+
+cat $TOPDIR/.config | grep '^CONFIG' | awk -F= '
+ {
+ print " size+=sprintf(page+size,\"" $1 "=" $2 "\\n\");"
+ }
+'
+
+cat -<<EOT
+
+ return (size);
+}
+EOT
___________________________________________________________________________
simple is elegant mrnick.binary9.net nicholas@binary9.net
___________________________________________________________________________
Linux 2.1.104 #4 SMP Thu May 28 12:07:14 EDT 1998, up 1:39
Linux 2.1.103 #2 Fri May 22 11:45:19 EDT 1998, up 33 min
Linux 2.1.96 #2 Wed Apr 15 11:38:48 EDT 1998, up 2 days
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu