aboutsummaryrefslogtreecommitdiff
path: root/toolchain
diff options
context:
space:
mode:
authorGravatar Vincent Fazio <vfazio@xes-inc.com>2020-01-15 19:29:07 +0100
committerGravatar Peter Korsgaard <peter@korsgaard.com>2020-02-08 20:25:10 +0100
commit338e62bd5d23e843a4bf69c06a02681450e858ae (patch)
treea6bea11db9c57d7cdcf1c81bb3daaae5ee70ea87 /toolchain
parentfbe18eb246375af9d8c9421045ba315573049c43 (diff)
downloadbuildroot-338e62bd5d23e843a4bf69c06a02681450e858ae.tar.gz
buildroot-338e62bd5d23e843a4bf69c06a02681450e858ae.tar.bz2
toolchain: allow using custom headers newer than latest known ones
When Buildroot is released, it knows up to a certain kernel header version, and no later. However, it is possible that an external toolchain will be used, that uses headers newer than the latest version Buildroot knows about. This may also happen when testing a development, an rc-class, or a newly released kernel, either in an external toolchain, or with an internal toolchain with custom headers (same-as-kernel, custom version, custom git, custom tarball). In the current state, Buildroot would refuse to use such toolchains, because the test is for strict equality. We'd like to make that situation possible, but we also want the user not to be lenient at the same time, and select the right headers version when it is known. So, we add a new Kconfig blind option that the latest kernel headers version selects. This options is then used to decide whether we do a strict or loose check of the kernel headers. Suggested-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Vincent Fazio <vfazio@xes-inc.com> [yann.morin.1998@free.fr: - only do a loose check for the latest version - expand commit log ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Tested-by: Vincent Fazio <vfazio@xes-inc.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/Config.in8
-rw-r--r--toolchain/helpers.mk6
-rw-r--r--toolchain/toolchain-external/pkg-toolchain-external.mk3
-rw-r--r--toolchain/toolchain-external/toolchain-external-custom/Config.in.options5
4 files changed, 19 insertions, 3 deletions
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 858121d2c5..973c03254f 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -457,6 +457,14 @@ config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_3
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_3
+ select BR2_TOOLCHAIN_HEADERS_LATEST
+
+# This should be selected by the latest version, above, to indicate that
+# Buildroot does not know of more recent headers than the ones selected.
+# This allows using toolchains with headers more recent than Buildroot
+# knows about, while still enforcing strict check for older headers.
+config BR2_TOOLCHAIN_HEADERS_LATEST
+ bool
# This order guarantees that the highest version is set, as kconfig
# stops affecting a value on the first matching default.
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 996cc70d44..2c2a987c3e 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -161,9 +161,13 @@ copy_toolchain_sysroot = \
# $1: build directory
# $2: sysroot directory
# $3: kernel version string, in the form: X.Y
+# $4: test to do for the latest kernel version, 'strict' or 'loose'
+# always 'strict' if this is not the latest version.
#
check_kernel_headers_version = \
- if ! support/scripts/check-kernel-headers.sh $(1) $(2) $(3); then \
+ if ! support/scripts/check-kernel-headers.sh $(1) $(2) $(3) \
+ $(if $(BR2_TOOLCHAIN_HEADERS_LATEST),$(4),strict); \
+ then \
exit 1; \
fi
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 1c43409514..b01082aadd 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -542,7 +542,8 @@ define $(2)_CONFIGURE_CMDS
$$(call check_kernel_headers_version,\
$$(BUILD_DIR)\
$$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC)),\
- $$(call qstrip,$$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
+ $$(call qstrip,$$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)),\
+ $$(if $$(BR2_TOOLCHAIN_EXTERNAL_CUSTOM),loose,strict)); \
$$(call check_gcc_version,$$(TOOLCHAIN_EXTERNAL_CC),\
$$(call qstrip,$$(BR2_TOOLCHAIN_GCC_AT_LEAST))); \
if test "$$(BR2_arm)" = "y" ; then \
diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index 9680509a13..302f6babac 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -112,8 +112,11 @@ choice
m = ( LINUX_VERSION_CODE >> 8 ) & 0xFF
p = ( LINUX_VERSION_CODE >> 0 ) & 0xFF
+ If your toolchain uses headers newer than the latest version
+ in the choice, then select the latest version.
+
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_4
- bool "5.4.x"
+ bool "5.4.x or later"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_3