linux-headers: allow use of headers from kernel "package" selected
PATCH 1/1 linux-headers: allow use of headers from kernel "package" selected
This change makes it possible to use exactly the same sources for both headers during toolchain building and for kernel building itself, even if custom kernel is selected.
That way user might be sure that ABI mismatch won't happen between toolchain and kernel.
---
Changes v2 -> v3:
- Forbid KERNEL_SAME_AS_HEADERS w/ HEADERS_SAME_AS_KERNEL
- Made the calculation of LINUX_ variables to be a subroutine, which can be called compulsorily when needed
linux/Config.in | 1 + linux/linux.mk | 7 +++++++ package/linux-headers/Config.in.host | 14 ++++++++++++-- package/linux-headers/linux-headers.mk | 9 +++++++++ 4 files changed, 29 insertions(+), 2 deletions(-)
linux/Config.in +1 -0
@@ -26,6 +26,7 @@ config BR2_LINUX_KERNEL_LATEST_VERSION config BR2_LINUX_KERNEL_SAME_AS_HEADERS bool "Same as toolchain kernel headers" depends on BR2_TOOLCHAIN_BUILDROOT + depends on !BR2_KERNEL_HEADERS_SAME_AS_KERNEL help This option will re-use the same kernel sources as the one that have been used for the kernel headers of the
linux/linux.mk +7 -0
@@ -8,6 +8,9 @@ LINUX_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION)) LINUX_LICENSE = GPLv2 LINUX_LICENSE_FILES = COPYING +# Compute variables as a function, so linux-headers can call it when needed +define BR2_LINUX_COMPUTE_VARS + # Compute LINUX_SOURCE and LINUX_SITE from the configuration ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TARBALL),y) LINUX_TARBALL = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION))
@@ -38,6 +41,10 @@ LINUX_SITE := $(LINUX_SITE)/testing/ endif # -rc endif +endef + +$(eval $(BR2_LINUX_COMPUTE_VARS)) + LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) LINUX_INSTALL_IMAGES = YES
package/linux-headers/Config.in.host +12 -2
@@ -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
@@ -80,10 +88,12 @@ config BR2_DEFAULT_KERNEL_VERSION choice bool "Custom kernel headers series" - depends on BR2_KERNEL_HEADERS_VERSION + depends on BR2_KERNEL_HEADERS_VERSION || BR2_KERNEL_HEADERS_SAME_AS_KERNEL default BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_REALLY_OLD help - Set to the kernel headers series you manually set above. + Set to the kernel headers series you manually entered in + "linux version" field or matching version of specific kernel selected + for building in "kernel" section. This is used to hide/show some packages that have strict requirements on the version of kernel headers.
package/linux-headers/linux-headers.mk +9 -0
@@ -7,6 +7,14 @@ # This package is used to provide Linux kernel headers for the # internal toolchain backend. +ifeq ($(BR2_KERNEL_HEADERS_SAME_AS_KERNEL),y) +# Force computing the variables from the Kernel package +$(eval $(BR2_LINUX_COMPUTE_VARS)) +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 +22,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.7.10.4
PATCH 1/1 linux-headers: allow use of headers from kernel "package" selected
Hi Karoly,
2014-10-28 16:33 GMT+03:00 Karoly Kasza <[email protected]>:
Quoted 15 lines
This change makes it possible to use exactly the same sources for both headers during toolchain building and for kernel building itself, even if custom kernel is selected.
That way user might be sure that ABI mismatch won't happen between toolchain and kernel.
Signed-off-by Karoly Kasza <[email protected]>---
Changes v2 -> v3:
- ForbidKERNEL_SAME_AS_HEADERSw/HEADERS_SAME_AS_KERNEL
- Made the calculation ofLINUX_variables to be a subroutine, which can be called compulsorily when needed
Quoted 5 lines
linux/Config.in | 1 + linux/linux.mk | 7 +++++++ package/linux-headers/Config.in.host | 14 ++++++++++++-- package/linux-headers/linux-headers.mk | 9 +++++++++ 4 files changed, 29 insertions(+), 2 deletions(-)
For me this one looks good. Solution with dedicated function for calculation of variables works and looks much better than duplicated code.
I tried it and indeed it worked flawlessly.
So let's wait for comments from others.
-Alexey