Skip to contentSkip to conversation

linux-headers: allow use of headers from kernel "package" selected

PATCH Superseded Alexey Brodkin 2 participants 2 messages Oct 12, 2014

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-headers: allow use of headers from kernel "package" selected

From: Karoly Kasza <[email protected]>

This is a re-work of http://patchwork.ozlabs.org/patch/346823/

In buildroot kernel headers used for building toolchain come from upstream kernel sources (even though user may specify version, but not origin).

This change makes it possible to use exactly the same sources for both headers during toolchain building and for kernel building itself.

Moreover if "kernel" is selected to be built by defaut its sources will be used for kernel headers on toolchain build.

That way user might be sure that ABI mismatch won't happen between toolchain and kernel.

Cc Peter Korsgaard <[email protected]>
---
 package/linux-headers/Config.in.host   | 8 ++++++++
 package/linux-headers/linux-headers.mk | 7 +++++++
 2 files changed, 15 insertions(+)
package/linux-headers/Config.in.host +8 -0
index 101136a..64d4b9e 100644
@@ -5,6 +5,7 @@ comment "Kernel Header Options"
 
 choice
 	prompt "Kernel Headers"
+	default BR2_KERNEL_HEADERS_SAME_AS_KERNEL if BR2_LINUX_KERNEL
 	default BR2_KERNEL_HEADERS_3_17
 	help
 	  Select the version of kernel header files you wish to use.
@@ -69,6 +70,13 @@ choice
 
 	config BR2_KERNEL_HEADERS_VERSION
 		bool "Manually specified Linux version"
+
+	config BR2_KERNEL_HEADERS_SAME_AS_KERNEL
+		bool "Use Linux kernel specified for target"
+		depends on BR2_LINUX_KERNEL
+		help
+		  Use the Linux kernel specified for the target in
+		  the Kernel menu.
 endchoice
 
 config BR2_DEFAULT_KERNEL_VERSION
package/linux-headers/linux-headers.mk +7 -0
index d770927..29a9b38 100644
@@ -7,6 +7,12 @@
 # This package is used to provide Linux kernel headers for the
 # internal toolchain backend.
 
+ifeq ($(BR2_KERNEL_HEADERS_SAME_AS_KERNEL),y)
+LINUX_HEADERS_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+LINUX_HEADERS_SOURCE = $(LINUX_SOURCE)
+LINUX_HEADERS_SITE = $(LINUX_SITE)
+LINUX_HEADERS_SITE_METHOD = $(LINUX_SITE_METHOD)
+else
 LINUX_HEADERS_VERSION = $(call qstrip,$(BR2_DEFAULT_KERNEL_HEADERS))
 ifeq ($(findstring x2.6.,x$(LINUX_HEADERS_VERSION)),x2.6.)
 LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v2.6
@@ -14,6 +20,7 @@ else
 LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v3.x
 endif
 LINUX_HEADERS_SOURCE = linux-$(LINUX_HEADERS_VERSION).tar.xz
+endif
 
 LINUX_HEADERS_INSTALL_STAGING = YES
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 linux-headers: allow use of headers from kernel "package" selected

Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alexey" == Alexey Brodkin <[email protected]> writes:

From: Karoly Kasza <[email protected]>
This is a re-work of http://patchwork.ozlabs.org/patch/346823/

In buildroot kernel headers used for building toolchain come from upstream kernel sources (even though user may specify version, but not origin).

This change makes it possible to use exactly the same sources for both headers during toolchain building and for kernel building itself.

Moreover if "kernel" is selected to be built by defaut its sources will be used for kernel headers on toolchain build.

That way user might be sure that ABI mismatch won't happen between toolchain and kernel.

Cc Peter Korsgaard <[email protected]>
---
 package/linux-headers/Config.in.host   | 8 ++++++++
 package/linux-headers/linux-headers.mk | 7 +++++++
 2 files changed, 15 insertions(+)
package/linux-headers/Config.in.host +1 -0
index 101136a..64d4b9e 100644
@@ -5,6 +5,7 @@ comment "Kernel Header Options"
 
 choice
 	prompt "Kernel Headers"
+	default BR2_KERNEL_HEADERS_SAME_AS_KERNEL if BR2_LINUX_KERNEL
 	default BR2_KERNEL_HEADERS_3_17
 	help
 	  Select the version of kernel header files you wish to use.

package/linux-headers/Config.in.host choice · line 79

Quoted 10 lines
package/linux-headers/Config.in.host +7 -0
@@ -69,6 +70,13 @@ choice
 
 	config BR2_KERNEL_HEADERS_VERSION
 		bool "Manually specified Linux version"
+
+	config BR2_KERNEL_HEADERS_SAME_AS_KERNEL
+		bool "Use Linux kernel specified for target"
+		depends on BR2_LINUX_KERNEL
+		help
+		  Use the Linux kernel specified for the target in
+		  the Kernel menu.

Thanks, but we also need to have the BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_XX stuff working, so you need to show the version selection like we do for BR2_KERNEL_HEADERS_VERSION (but probably with another description).

With that said, is this really helpful when you still need to provide the kernel version for the _TOOLCHAIN_HEADERS_AT_LEAST_ stuff? The only reason I can think of is if you have custom kernel which provides some kind of extra userspace API (headers).

Signature · 1 line
Peter Korsgaard