meta: build the linux-kernels cross libc-dev package if cross-profile is active

Message ID 20251218095705.1234100-1-tobias.schaffner@siemens.com
State Under Review
Headers show
Series meta: build the linux-kernels cross libc-dev package if cross-profile is active | expand

Commit Message

Tobias Schaffner Dec. 18, 2025, 9:57 a.m. UTC
The linux-libc-dev-${DISTRO_ARCH}-cross package is not created when cross
building the kernel because the pkg.${BPN}.cross build profile is only
activated for -native builds with the :cross-pkgs override.

This is an issue for custom kernels, because without the custom cross package,
dependent packages fall back to the default linux-libc-dev, which may lack
custom kernel headers.

Ensure that the cross package is also build for cross-builds when
KERNEL_LIBC_DEV_DEPLOY=1 is set, by adding the pkg.${BPN}.cross profile to the
default BUILD_PROFILES.

Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
---
 meta/classes-recipe/linux-kernel.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

MOESSBAUER, Felix Dec. 18, 2025, 10:17 a.m. UTC | #1
On Thu, 2025-12-18 at 10:57 +0100, Tobias Schaffner wrote:
> The linux-libc-dev-${DISTRO_ARCH}-cross package is not created when cross
> building the kernel because the pkg.${BPN}.cross build profile is only
> activated for -native builds with the :cross-pkgs override.
> 
> This is an issue for custom kernels, because without the custom cross package,
> dependent packages fall back to the default linux-libc-dev, which may lack
> custom kernel headers.
> 
> Ensure that the cross package is also build for cross-builds when
> KERNEL_LIBC_DEV_DEPLOY=1 is set, by adding the pkg.${BPN}.cross profile to the
> default BUILD_PROFILES.

Hi,

this issue probably was found on the xenomai-images layer. As this is
the second or third time we have issues on the libc-dev dependency
chain, we definitely need a test.

Please also try to find the commit that broke it and add a fixes tag.

+ CC Stefan

Best regards,
Felix

> 
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
>  meta/classes-recipe/linux-kernel.bbclass | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
> index 8f38a617..c9ac3336 100644
> --- a/meta/classes-recipe/linux-kernel.bbclass
> +++ b/meta/classes-recipe/linux-kernel.bbclass
> @@ -126,7 +126,9 @@ BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
>  
>  # When cross-profile is active:
>  # build only kernel (including config) with the default variant of the recipe
> -BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
> +# and build the cross libc-dev package if KERNEL_LIBC_DEV_DEPLOY is enabled
> +BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel \
> +    ${@ 'pkg.' + d.getVar('BPN') + '.cross' if bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')) else '' }"
>  
>  # -native: kbuild package for host
>  BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
> -- 
> 2.43.0
Jan Kiszka Dec. 18, 2025, 12:13 p.m. UTC | #2
On 18.12.25 11:17, Moessbauer, Felix (FT RPD CED OES-DE) wrote:
> On Thu, 2025-12-18 at 10:57 +0100, Tobias Schaffner wrote:
>> The linux-libc-dev-${DISTRO_ARCH}-cross package is not created when cross
>> building the kernel because the pkg.${BPN}.cross build profile is only
>> activated for -native builds with the :cross-pkgs override.
>>
>> This is an issue for custom kernels, because without the custom cross package,
>> dependent packages fall back to the default linux-libc-dev, which may lack
>> custom kernel headers.
>>
>> Ensure that the cross package is also build for cross-builds when
>> KERNEL_LIBC_DEV_DEPLOY=1 is set, by adding the pkg.${BPN}.cross profile to the
>> default BUILD_PROFILES.
> 

Testing this now as well. Thanks already!

> Hi,
> 
> this issue probably was found on the xenomai-images layer. As this is
> the second or third time we have issues on the libc-dev dependency
> chain, we definitely need a test.
> 

Yes, we need that. I wasn't updating xenomai-images for a while, so I
didn't catch the regression this way.

> Please also try to find the commit that broke it and add a fixes tag.
> 

Most likely afba99fe6aeb7d4aae1209e37d1f64458b31f62e.

Jan

> + CC Stefan
> 
> Best regards,
> Felix
> 
>>
>> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
>> ---
>>  meta/classes-recipe/linux-kernel.bbclass | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
>> index 8f38a617..c9ac3336 100644
>> --- a/meta/classes-recipe/linux-kernel.bbclass
>> +++ b/meta/classes-recipe/linux-kernel.bbclass
>> @@ -126,7 +126,9 @@ BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
>>  
>>  # When cross-profile is active:
>>  # build only kernel (including config) with the default variant of the recipe
>> -BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
>> +# and build the cross libc-dev package if KERNEL_LIBC_DEV_DEPLOY is enabled
>> +BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel \
>> +    ${@ 'pkg.' + d.getVar('BPN') + '.cross' if bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')) else '' }"
>>  
>>  # -native: kbuild package for host
>>  BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
>> -- 
>> 2.43.0
>
Jan Kiszka Dec. 18, 2025, 12:27 p.m. UTC | #3
On 18.12.25 13:13, 'Jan Kiszka' via isar-users wrote:
> On 18.12.25 11:17, Moessbauer, Felix (FT RPD CED OES-DE) wrote:
>> On Thu, 2025-12-18 at 10:57 +0100, Tobias Schaffner wrote:
>>> The linux-libc-dev-${DISTRO_ARCH}-cross package is not created when cross
>>> building the kernel because the pkg.${BPN}.cross build profile is only
>>> activated for -native builds with the :cross-pkgs override.
>>>
>>> This is an issue for custom kernels, because without the custom cross package,
>>> dependent packages fall back to the default linux-libc-dev, which may lack
>>> custom kernel headers.
>>>
>>> Ensure that the cross package is also build for cross-builds when
>>> KERNEL_LIBC_DEV_DEPLOY=1 is set, by adding the pkg.${BPN}.cross profile to the
>>> default BUILD_PROFILES.
>>
> 
> Testing this now as well. Thanks already!
> 
>> Hi,
>>
>> this issue probably was found on the xenomai-images layer. As this is
>> the second or third time we have issues on the libc-dev dependency
>> chain, we definitely need a test.
>>
> 
> Yes, we need that. I wasn't updating xenomai-images for a while, so I
> didn't catch the regression this way.
> 
>> Please also try to find the commit that broke it and add a fixes tag.
>>
> 
> Most likely afba99fe6aeb7d4aae1209e37d1f64458b31f62e.
> 
> Jan
> 

BTW, we also still have an issues with multiple providers for linux-libc-dev and -cross at bitbake level, e.g.:

 NOTE: Multiple providers are available for linux-libc-dev-armhf-cross (linux-xenomai-4, linux-xenomai-4-kbuildtarget)
Consider defining a PREFERRED_PROVIDER entry to match linux-libc-dev-armhf-cross

Jan
Jan Kiszka Dec. 18, 2025, 12:39 p.m. UTC | #4
On 18.12.25 10:57, Tobias Schaffner wrote:
> The linux-libc-dev-${DISTRO_ARCH}-cross package is not created when cross
> building the kernel because the pkg.${BPN}.cross build profile is only
> activated for -native builds with the :cross-pkgs override.
> 
> This is an issue for custom kernels, because without the custom cross package,
> dependent packages fall back to the default linux-libc-dev, which may lack
> custom kernel headers.
> 
> Ensure that the cross package is also build for cross-builds when
> KERNEL_LIBC_DEV_DEPLOY=1 is set, by adding the pkg.${BPN}.cross profile to the
> default BUILD_PROFILES.
> 
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
>  meta/classes-recipe/linux-kernel.bbclass | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
> index 8f38a617..c9ac3336 100644
> --- a/meta/classes-recipe/linux-kernel.bbclass
> +++ b/meta/classes-recipe/linux-kernel.bbclass
> @@ -126,7 +126,9 @@ BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
>  
>  # When cross-profile is active:
>  # build only kernel (including config) with the default variant of the recipe
> -BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
> +# and build the cross libc-dev package if KERNEL_LIBC_DEV_DEPLOY is enabled
> +BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel \
> +    ${@ 'pkg.' + d.getVar('BPN') + '.cross' if bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')) else '' }"

Why conditional? pkg.*.cross is also not only pulling
linux-libc-dev-*-cross. It's also switching to linux-kbuild-*-cross. If 
that does not matter, why not just

diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
index c9ac3336..1d55a50e 100644
--- a/meta/classes-recipe/linux-kernel.bbclass
+++ b/meta/classes-recipe/linux-kernel.bbclass
@@ -113,9 +113,8 @@ python() {
         if "class-native" not in d.getVar("OVERRIDES").split(":"):
             # cross compiling
             d.appendVar("OVERRIDES", ":cross-profile")
-        else:
-            # generating -cross packages (in HOST_ARCH) from a -native variant
-            d.appendVar("OVERRIDES", ":cross-pkgs")
+        # generating -cross packages (in HOST_ARCH) from a -native variant
+        d.appendVar("OVERRIDES", ":cross-pkgs")
 }
 
 # Default profiles and provides


If it does matter, we have some other issue now.

Jan

Patch

diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
index 8f38a617..c9ac3336 100644
--- a/meta/classes-recipe/linux-kernel.bbclass
+++ b/meta/classes-recipe/linux-kernel.bbclass
@@ -126,7 +126,9 @@  BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
 
 # When cross-profile is active:
 # build only kernel (including config) with the default variant of the recipe
-BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"
+# and build the cross libc-dev package if KERNEL_LIBC_DEV_DEPLOY is enabled
+BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel \
+    ${@ 'pkg.' + d.getVar('BPN') + '.cross' if bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')) else '' }"
 
 # -native: kbuild package for host
 BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"