2005-01-18 19:38:14

by Andreas Gruenbacher

[permalink] [raw]
Subject: [kbuild 3/5] Add cloneconfig target

Cloneconfig takes the first configuration it finds which appears to
belong to the running kernel, and configures the kernel sources to match
this configuration as closely as possible.

Signed-off-by: Andreas Gruenbacher <[email protected]>

Index: linux-2.6.11-rc1-bk6/scripts/kconfig/Makefile
===================================================================
--- linux-2.6.11-rc1-bk6.orig/scripts/kconfig/Makefile
+++ linux-2.6.11-rc1-bk6/scripts/kconfig/Makefile
@@ -37,6 +37,22 @@ allnoconfig: $(obj)/conf
allmodconfig: $(obj)/conf
$< -m arch/$(ARCH)/Kconfig

+UNAME_RELEASE := $(shell uname -r)
+CLONECONFIG := $(firstword $(wildcard /proc/config.gz \
+ /lib/modules/$(UNAME_RELEASE)/.config \
+ /etc/kernel-config \
+ /boot/config-$(UNAME_RELEASE)))
+cloneconfig: $(obj)/conf
+ $(Q)case "$(CLONECONFIG)" in \
+ '') echo -e "The configuration of the running" \
+ "kernel could not be determined\n"; \
+ false ;; \
+ *.gz) gzip -cd $(CLONECONFIG) > .config.running ;; \
+ *) cat $(CLONECONFIG) > .config.running ;; \
+ esac && \
+ echo -e "Cloning configuration file $(CLONECONFIG)\n"
+ $(Q)$< -D .config.running arch/$(ARCH)/Kconfig
+
defconfig: $(obj)/conf
ifeq ($(KBUILD_DEFCONFIG),)
$< -d arch/$(ARCH)/Kconfig

--
Andreas Gruenbacher <[email protected]>
SUSE Labs, SUSE LINUX PRODUCTS GMBH