[OpenWrt-Devel] [PATCH] toolchain/kernel-headers: use target config when generating headers

Karl Vogel karl.vogel at gmail.com
Thu Mar 24 09:03:59 EDT 2016


Without this change, the oldconfig could actually use the host
system's kernel defaults from /boot, ie on an ubuntu build node
the oldconfig would give:

 # using defaults found in /boot/config-3.13.0-77-generic

This patch uses the Kernel/Prepare and Kernel/Configure for the
actual target to generate the .config. While the kernel to userspace
ABI is fixed, there might be additions to the kernel which would
not be known when using the host configuration.

ie. in the past the iptables Makefile was altered because the
toolchain kernel headers were actually missing the layer7 headers
(layer7 patches has since been dropped), but it indicates the
issue.

With this patch, the toolchain kernel headers will be those
of the actual target kernel.

Signed-off-by: Karl Vogel <karl.vogel at gmail.com>
---
 include/kernel-defaults.mk        | 2 ++
 toolchain/kernel-headers/Makefile | 7 +++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 406fd46..19ff994 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -66,6 +66,7 @@ else
 	ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
   endef
 endif
+Kernel/Prepare?=$(Kernel/Prepare/Default)
 
 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
   ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"")
@@ -122,6 +123,7 @@ 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.set | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
 endef
+Kernel/Configure?=$(Kernel/Configure/Default)
 
 define Kernel/Configure/Initramfs
 	$(call Kernel/SetInitramfs)
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index 68c83a0..fae20d4 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -46,9 +46,7 @@ KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
 
 define Host/Configure/all
 	mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
-	$(KMAKE) \
-		INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
-		headers_install
+	$(CP) $(LINUX_DIR)/user_headers/* $(BUILD_DIR_TOOLCHAIN)/linux-dev/
 endef
 
 # XXX: the following is needed to build lzma-loader
@@ -71,12 +69,13 @@ define Host/Configure/post/mipsel
 endef
 
 define Host/Prepare
-	$(call Kernel/Prepare/Default)
+	$(call Kernel/Prepare)
 	ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
 	$(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
 endef
 
 define Host/Configure
+	$(call Kernel/Configure)
 	env
 	yes '' | $(KMAKE) oldconfig
 	$(call Host/Configure/all)
-- 
2.7.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list