aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-06-23 19:24:10 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-23 19:24:10 -0700
commit11e4e1e82c3de5869bfe18a46e2718cbdf586929 (patch)
treeebf482aeb921b924d16f397c3abaf668bded3cf5 /kernel
parent3224bf995b3a18f3c5b47fcb39ca1cc2caf143cf (diff)
downloadhistory-11e4e1e82c3de5869bfe18a46e2718cbdf586929.tar.gz
[PATCH] consolidate in-kernel configuration
From: Andy Whitcroft <apw@shadowen.org> Being able to recover the configuration from a kernel is very useful and it would be nice to default this option to Yes. Currently, to have the config available both from the image (using extract-ikconfig) and via /proc we keep two copies of the original .config in the kernel. One in plain text and one gzip compressed. This is not optimal. This patch removes the plain text version of the configuration and updates the extraction tools to locate and use the gzip'd version of the file. This has the added bonus of providing us with the exact same results in both cases, the original .config; including the comments. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/Makefile18
-rw-r--r--kernel/configs.c25
2 files changed, 20 insertions, 23 deletions
diff --git a/kernel/Makefile b/kernel/Makefile
index 2b7b352b1a38b..47f98594e9e57 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -33,23 +33,7 @@ ifneq ($(CONFIG_IA64),y)
CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
endif
-# configs.o uses generated files - dependecies must be listed explicitly
-$(obj)/configs.o: $(obj)/ikconfig.h
-
-ifdef CONFIG_IKCONFIG_PROC
$(obj)/configs.o: $(obj)/config_data.h
-endif
-
-# ikconfig.h contains all the selected config entries - generated
-# from top-level Makefile and .config. Info from ikconfig.h can
-# be extracted from the kernel binary.
-
-quiet_cmd_ikconfig = IKCFG $@
- cmd_ikconfig = $(CONFIG_SHELL) $< .config $(srctree)/Makefile > $@
-
-targets += ikconfig.h
-$(obj)/ikconfig.h: scripts/mkconfigs .config $(srctree)/Makefile FORCE
- $(call if_changed,ikconfig)
# config_data.h contains the same information as ikconfig.h but gzipped.
# Info from config_data can be extracted from /proc/config*
@@ -58,7 +42,7 @@ $(obj)/config_data.gz: .config FORCE
$(call if_changed,gzip)
quiet_cmd_ikconfiggz = IKCFG $@
- cmd_ikconfiggz = cat $< | scripts/bin2c kernel_config_data > $@
+ cmd_ikconfiggz = (echo "const char kernel_config_data[] = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") > $@
targets += config_data.h
$(obj)/config_data.h: $(obj)/config_data.gz FORCE
$(call if_changed,ikconfiggz)
diff --git a/kernel/configs.c b/kernel/configs.c
index 326ab7b214f60..d18a944ad249d 100644
--- a/kernel/configs.c
+++ b/kernel/configs.c
@@ -34,13 +34,26 @@
/**************************************************/
/* the actual current config file */
-/* This one is for extraction from the kernel binary file image. */
-#include "ikconfig.h"
+/*
+ * Define kernel_config_data and kernel_config_data_size, which contains the
+ * wrapped and compressed configuration file. The file is first compressed
+ * with gzip and then bounded by two eight byte magic numbers to allow
+ * extraction from a binary kernel image:
+ *
+ * IKCFG_ST
+ * <image>
+ * IKCFG_ED
+ */
+#define MAGIC_START "IKCFG_ST"
+#define MAGIC_END "IKCFG_ED"
+#include "config_data.h"
-#ifdef CONFIG_IKCONFIG_PROC
-/* This is the data that can be read from /proc/config.gz. */
-#include "config_data.h"
+#define MAGIC_SIZE (sizeof(MAGIC_START) - 1)
+#define kernel_config_data_size \
+ (sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)
+
+#ifdef CONFIG_IKCONFIG_PROC
/**************************************************/
/* globals and useful constants */
@@ -58,7 +71,7 @@ ikconfig_read_current(struct file *file, char __user *buf,
return 0;
count = min(len, (size_t)(kernel_config_data_size - pos));
- if(copy_to_user(buf, kernel_config_data + pos, count))
+ if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count))
return -EFAULT;
*offset += count;