support/check-kernel-headers: Fixup couldn't compile linux rc version
diff mbox series

Message ID 1557222665-9498-1-git-send-email-guoren@kernel.org
State New
Headers show
Series
  • support/check-kernel-headers: Fixup couldn't compile linux rc version
Related show

Commit Message

Guo Ren May 7, 2019, 9:51 a.m. UTC
From: Guo Ren <ren_guo@c-sky.com>

Sometimes we want to try newest kernel rc version, but the
check-kernel-headers will prevent it. In package/linux-headers we
use BR2_TOOLCHAIN_HEADERS_AT_LEAST for checking, I think AT_LEAST means
"<" not "!=".

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
---
 support/scripts/check-kernel-headers.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnout Vandecappelle May 7, 2019, 10:24 p.m. UTC | #1
Hi Guo,

On 07/05/2019 11:51, guoren@kernel.org wrote:
> From: Guo Ren <ren_guo@c-sky.com>
> 
> Sometimes we want to try newest kernel rc version, but the
> check-kernel-headers will prevent it.

 It would indeed be good if we would be able to use newer kernel headers without
requiring an update of Buildroot.

> In package/linux-headers we
> use BR2_TOOLCHAIN_HEADERS_AT_LEAST for checking, I think AT_LEAST means
> "<" not "!=".

 However, I think we should not treat it as "at least" in general, but only for
the "newer" case. In other words, I think we should add
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_NEWER (and the equivalent in
toolchain-external) which selects BR2_TOOLCHAIN_HEADERS_NEWER, and make the
check > 5.0 (rather than == something) in that case.

 It's a bigger change though.

 Regards,
 Arnout

> 
> Signed-off-by: Guo Ren <ren_guo@c-sky.com>
> ---
>  support/scripts/check-kernel-headers.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/scripts/check-kernel-headers.sh b/support/scripts/check-kernel-headers.sh
> index a8cca78..4787678 100755
> --- a/support/scripts/check-kernel-headers.sh
> +++ b/support/scripts/check-kernel-headers.sh
> @@ -23,7 +23,7 @@ int main(int argc __attribute__((unused)),
>           char** argv __attribute__((unused)))
>  {
>      if((LINUX_VERSION_CODE & ~0xFF)
> -        != KERNEL_VERSION(${HDR_M},${HDR_m},0))
> +        < KERNEL_VERSION(${HDR_M},${HDR_m},0))
>      {
>          printf("Incorrect selection of kernel headers: ");
>          printf("expected %d.%d.x, got %d.%d.x\n", ${HDR_M}, ${HDR_m},
>
Guo Ren May 8, 2019, 2:04 a.m. UTC | #2
Thx Arnout,

On Wed, May 08, 2019 at 12:24:02AM +0200, Arnout Vandecappelle wrote:
>  Hi Guo,
> 
> On 07/05/2019 11:51, guoren@kernel.org wrote:
> > From: Guo Ren <ren_guo@c-sky.com>
> > 
> > Sometimes we want to try newest kernel rc version, but the
> > check-kernel-headers will prevent it.
> 
>  It would indeed be good if we would be able to use newer kernel headers without
> requiring an update of Buildroot.
> 
> > In package/linux-headers we
> > use BR2_TOOLCHAIN_HEADERS_AT_LEAST for checking, I think AT_LEAST means
> > "<" not "!=".
> 
>  However, I think we should not treat it as "at least" in general, but only for
> the "newer" case. In other words, I think we should add
> BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_NEWER (and the equivalent in
> toolchain-external) which selects BR2_TOOLCHAIN_HEADERS_NEWER, and make the
> check > 5.0 (rather than == something) in that case.
> 
>  It's a bigger change though.

In linux-headers.mk:

ifeq ($(BR2_KERNEL_HEADERS_VERSION)$(BR2_KERNEL_HEADERS_AS_KERNEL)$(BR2_KERNEL_HEADERS_CUSTOM_TARBALL)$(BR2_KERNEL_HEADERS_CUSTOM_GIT),y)
define LINUX_HEADERS_CHECK_VERSION
	$(call check_kernel_headers_version,\
		$(STAGING_DIR),\
		$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)))
endef
LINUX_HEADERS_POST_INSTALL_STAGING_HOOKS += LINUX_HEADERS_CHECK_VERSION
endif

If we use BR2_KERNEL_HEADERS_AS_KERNEL, I think it's no necessary to
check _AT_LEAST. Because user has specified the linux version and he want
the version without more checking.

Best Regards
 Guo Ren

Patch
diff mbox series

diff --git a/support/scripts/check-kernel-headers.sh b/support/scripts/check-kernel-headers.sh
index a8cca78..4787678 100755
--- a/support/scripts/check-kernel-headers.sh
+++ b/support/scripts/check-kernel-headers.sh
@@ -23,7 +23,7 @@  int main(int argc __attribute__((unused)),
          char** argv __attribute__((unused)))
 {
     if((LINUX_VERSION_CODE & ~0xFF)
-        != KERNEL_VERSION(${HDR_M},${HDR_m},0))
+        < KERNEL_VERSION(${HDR_M},${HDR_m},0))
     {
         printf("Incorrect selection of kernel headers: ");
         printf("expected %d.%d.x, got %d.%d.x\n", ${HDR_M}, ${HDR_m},