[PATCH] external kernel .config

Daniel Santos daniel.santos at pobox.com
Thu Mar 8 23:39:33 EST 2018


---
 config/Config-devel.in     | 8 ++++++++
 include/kernel-build.mk    | 4 ++--
 include/kernel-defaults.mk | 8 ++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/config/Config-devel.in b/config/Config-devel.in
index d096c18a72..8603010485 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
@@ -65,6 +65,14 @@ menuconfig DEVEL
 		string "Use external kernel tree" if DEVEL
 		default ""
 
+	config EXTERNAL_KERNEL_CONFIG
+		bool "Use .config in external kernel tree (and do not modify it)." if DEVEL
+		depends on (EXTERNAL_KERNEL_TREE != "")
+		default N
+		help
+		  If enabled, OpenWRT will not generate or modify the .config
+		  file in the external kernel tree.
+
 	config KERNEL_GIT_CLONE_URI
 		string "Enter git repository to clone" if DEVEL
 		default ""
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 9abfd542e8..7f19a7260e 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -126,9 +126,9 @@ define BuildKernel
 
   oldconfig menuconfig nconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
 	rm -f $(STAMP_CONFIGURED)
-	$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
+	$(ifdef EXTERNAL_KERNEL_CONFIG,,$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config)
 	$(_SINGLE)$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@
-	$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config > $(LINUX_RECONFIG_TARGET)
+	$(ifdef EXTERNAL_KERNEL_CONFIG,,$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config > $(LINUX_RECONFIG_TARGET))
 
   install: $(LINUX_DIR)/.image
 	+$(MAKE) -C image compile install TARGET_BUILD=
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 24d26308b1..454c9da53d 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -100,6 +100,7 @@ define Kernel/SetNoInitramfs
 	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
 endef
 
+ifdef EXTERNAL_KERNEL_CONFIG
 define Kernel/Configure/Default
 	$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
 # copy CONFIG_KERNEL_* settings over to .config.target
@@ -114,6 +115,13 @@ define Kernel/Configure/Default
 	$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
 	$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
 endef
+else
+define Kernel/Configure/Default
+	rm -rf $(KERNEL_BUILD_DIR)/modules
+	$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
+	$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
+endef
+endif
 
 define Kernel/Configure/Initramfs
 	$(call Kernel/SetInitramfs)
-- 
2.15.0


--------------927D81727AEA499DC246752D
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Kb3BlbndydC1k
ZXZlbCBtYWlsaW5nIGxpc3QKb3BlbndydC1kZXZlbEBsaXN0cy5vcGVud3J0Lm9yZwpodHRwczov
L2xpc3RzLm9wZW53cnQub3JnL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9vcGVud3J0LWRldmVs
Cg==

--------------927D81727AEA499DC246752D--



More information about the openwrt-devel mailing list