diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk index 2361e40ac7..7b3edf4731 100644 --- a/package/linux-headers/linux-headers.mk +++ b/package/linux-headers/linux-headers.mk @@ -40,7 +40,7 @@ endef ifeq ($(BR2_KERNEL_HEADERS_VERSION),y) define LINUX_HEADERS_CHECK_VERSION $(call check_kernel_headers_version,\ - "$(TARGET_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\ + $(STAGING_DIR),\ $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))) endef LINUX_HEADERS_POST_INSTALL_STAGING_HOOKS += LINUX_HEADERS_CHECK_VERSION diff --git a/support/scripts/check-kernel-headers.sh b/support/scripts/check-kernel-headers.sh index 2a0a301eda..82cf9ac274 100755 --- a/support/scripts/check-kernel-headers.sh +++ b/support/scripts/check-kernel-headers.sh @@ -1,6 +1,6 @@ #!/bin/sh -CC="${1}" +SYSROOT="${1}" # Make sure we have enough version components HDR_VER="${2}.0.0" @@ -10,15 +10,6 @@ HDR_m="${HDR_V%%.*}" EXEC="$(mktemp --tmpdir check-headers.XXXXXX)" -# By the time we get here, we do not always have the staging-dir -# already populated (think external toolchain), so we can not use -# it. -# So we just ask the cross compiler what its default sysroot is. -# For multilib-aware toolchains where we should use a non-default -# sysroot, it's not really a problem since the version of the kernel -# headers is the same for all sysroots. -SYSROOT=$(${CC} -print-sysroot) - # We do not want to account for the patch-level, since headers are # not supposed to change for different patchlevels, so we mask it out. # This only applies to kernels >= 3.0, but those are the only one diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 68759163e6..9595196e9b 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -166,7 +166,7 @@ copy_toolchain_sysroot = \ # Check the specified kernel headers version actually matches the # version in the toolchain. # -# $1: cross-gcc path +# $1: sysroot directory # $2: kernel version string, in the form: X.Y # check_kernel_headers_version = \ diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index 547d55df26..1424c23ef7 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -431,7 +431,7 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS fi ; \ if [ "$(BR2_TOOLCHAIN_EXTERNAL_CUSTOM)" = "y" ]; then \ $(call check_kernel_headers_version,\ - "$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\ + $(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)),\ $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ fi ; \ if test "$(BR2_arm)" = "y" ; then \