package/linux-headers: with headers from kernel, also override srcdir
PATCH 1/1 package/linux-headers: with headers from kernel, also override srcdir
When using the headers from the kernel to be built, with the kernel set to a custom version, and overriding the kernel sources with LINUX_OVERRIDE_SRCDIR, the linux-headers package is still trying to download an archive, and fails to validate its hash.
What is going on under the hood is that, with _OVERRIDE_SRCDIR, the _VERSION of a package is set to 'custom'. Furthermore, the variable BR_NO_CHECK_HASH_FOR is recursively expanded, so its value is only evaluated when it is needed.
For linux-headers, we inherit the values from the linux package, and the LINUX_HEADERS_VERSION takes the value from the configuration.
Thus we end up with the following situation:
LINUX_VERSION=custom
LINUX_HEADERS_VERSION=5.10 # For example
BR_NO_CHECK_HASH_FOR=... linux-custom.tar.gz ...
And thus the archive downloaded by linux-headers will not match any exclusion, and since there will most probably not be a hash for it, the download will fail, as was noticed and reported by Jarkko.
But in this case, what we really want is to really use the headers from the kernel that we build, we do not even want to attempt a download at all.
So, when using the headers from the kernel to be built, we also propagate the LINUX_OVERRIDE_SRCDIR to linux-headers, so that we also use the headers from the overridden sources.
Furthermore, in that configuration, we explicitly disallow overriding the linux-headers specifically, as it does not make sense (even though, if they were overridden to the same location, that'd be OK, but to simplify the condition, we do not even check for that).
--- package/linux-headers/linux-headers.mk | 4 ++++ 1 file changed, 4 insertions(+)
package/linux-headers/linux-headers.mk +4 -0
@@ -18,6 +18,10 @@ LINUX_HEADERS_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION)) LINUX_HEADERS_CUSTOM_TARBALL_LOCATION = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION)) LINUX_HEADERS_REPO_URL = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)) LINUX_HEADERS_CIP = $(BR2_LINUX_KERNEL_LATEST_CIP_VERSION)$(BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION) +ifneq ($(LINUX_HEADERS_OVERRIDE_SRCDIR),) +$(error LINUX_HEADERS_OVERRIDE_SRCDIR must not be set when BR2_KERNEL_HEADERS_AS_KERNEL=y) +endif +LINUX_HEADERS_OVERRIDE_SRCDIR = $(LINUX_OVERRIDE_SRCDIR) else # ! BR2_KERNEL_HEADERS_AS_KERNEL LINUX_HEADERS_CUSTOM_TARBALL = $(call qstrip,$(BR2_KERNEL_HEADERS_CUSTOM_TARBALL)) LINUX_HEADERS_CUSTOM_GIT = $(call qstrip,$(BR2_KERNEL_HEADERS_CUSTOM_GIT))
Signature · 1 line
2.25.1
Arnout Vandecappelle
AppliedPATCH 1/1 package/linux-headers: with headers from kernel, also override srcdir
Quoted 27 lines · Yann E. MORIN
When using the headers from the kernel to be built, with the kernel set to a custom version, and overriding the kernel sources with
LINUX_OVERRIDE_SRCDIR, the linux-headers package is still trying to download an archive, and fails to validate its hash.What is going on under the hood is that, with
_OVERRIDE_SRCDIR, the_VERSIONof a package is set to 'custom'. Furthermore, the variableBR_NO_CHECK_HASH_FORis recursively expanded, so its value is only evaluated when it is needed.For linux-headers, we inherit the values from the linux package, and the
LINUX_HEADERS_VERSIONtakes the value from the configuration.Thus we end up with the following situation:
LINUX_VERSION=custom
LINUX_HEADERS_VERSION=5.10 # For example
BR_NO_CHECK_HASH_FOR=... linux-custom.tar.gz ...And thus the archive downloaded by linux-headers will not match any exclusion, and since there will most probably not be a hash for it, the download will fail, as was noticed and reported by Jarkko.
But in this case, what we really want is to really use the headers from the kernel that we build, we do not even want to attempt a download at all.
Quoted 8 lines
So, when using the headers from the kernel to be built, we also propagate the
LINUX_OVERRIDE_SRCDIRto linux-headers, so that we also use the headers from the overridden sources.Furthermore, in that configuration, we explicitly disallow overriding the linux-headers specifically, as it does not make sense (even though, if they were overridden to the same location, that'd be OK, but to simplify the condition, we do not even check for that).
It's likely that some people that are currently using this configuration will
have explicitly set LINUX_HEADERS_OVERRIDE_SRCDIR as well to overcome this problem, so this error will cause a regression for them.
That said, it's easy enough to fix and the error message is clear, so I guess
it's OK.
Applied to master, thanks.
Regards,
Arnout
PS: No spelling errors, congratulations! :-)
Quoted 26 lines
Reported-by Jarkko Sakkinen <[email protected]>Signed-off-by Yann E. MORIN <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Peter Korsgaard <[email protected]>Cc Arnout Vandecappelle <[email protected]>--- package/linux-headers/linux-headers.mk | 4 ++++ 1 file changed, 4 insertions(+)package/linux-headers/linux-headers.mk +4
-0@@ -18,6 +18,10 @@ LINUX_HEADERS_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION)) LINUX_HEADERS_CUSTOM_TARBALL_LOCATION = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION)) LINUX_HEADERS_REPO_URL = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)) LINUX_HEADERS_CIP = $(BR2_LINUX_KERNEL_LATEST_CIP_VERSION)$(BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION) +ifneq ($(LINUX_HEADERS_OVERRIDE_SRCDIR),) +$(error LINUX_HEADERS_OVERRIDE_SRCDIR must not be set when BR2_KERNEL_HEADERS_AS_KERNEL=y) +endif +LINUX_HEADERS_OVERRIDE_SRCDIR = $(LINUX_OVERRIDE_SRCDIR) else # ! BR2_KERNEL_HEADERS_AS_KERNEL LINUX_HEADERS_CUSTOM_TARBALL = $(call qstrip,$(BR2_KERNEL_HEADERS_CUSTOM_TARBALL)) LINUX_HEADERS_CUSTOM_GIT = $(call qstrip,$(BR2_KERNEL_HEADERS_CUSTOM_GIT))
PATCH 1/1 package/linux-headers: with headers from kernel, also override srcdir
Quoted 30 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Quoted 27 lines · Yann E. MORIN
When using the headers from the kernel to be built, with the kernel set to a custom version, and overriding the kernel sources with
LINUX_OVERRIDE_SRCDIR, the linux-headers package is still trying to download an archive, and fails to validate its hash.What is going on under the hood is that, with
_OVERRIDE_SRCDIR, the_VERSIONof a package is set to 'custom'. Furthermore, the variableBR_NO_CHECK_HASH_FORis recursively expanded, so its value is only evaluated when it is needed.For linux-headers, we inherit the values from the linux package, and the
LINUX_HEADERS_VERSIONtakes the value from the configuration.Thus we end up with the following situation:
LINUX_VERSION=custom
LINUX_HEADERS_VERSION=5.10 # For example
BR_NO_CHECK_HASH_FOR=... linux-custom.tar.gz ...And thus the archive downloaded by linux-headers will not match any exclusion, and since there will most probably not be a hash for it, the download will fail, as was noticed and reported by Jarkko.
But in this case, what we really want is to really use the headers from the kernel that we build, we do not even want to attempt a download at all.
Quoted 8 lines
Quoted 8 lines
So, when using the headers from the kernel to be built, we also propagate the
LINUX_OVERRIDE_SRCDIRto linux-headers, so that we also use the headers from the overridden sources.Furthermore, in that configuration, we explicitly disallow overriding the linux-headers specifically, as it does not make sense (even though, if they were overridden to the same location, that'd be OK, but to simplify the condition, we do not even check for that).
Committed to 2020.02.x and 2020.11.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard