[V3] linux-custom: support to add linux-libc-dev package with kernel name

Message ID 20250117173715.89204-1-arulpandiyan.vadivel@siemens.com
State New
Headers show
Series [V3] linux-custom: support to add linux-libc-dev package with kernel name | expand

Commit Message

Arulpandiyan Vadivel Jan. 17, 2025, 5:37 p.m. UTC
Debian and Ubuntu use unified kernel headers and a single linux-libc-dev
package is shipped. In contrast, Isar may build multiple kernel variants
with different versions and/or patches and their packages but linux-libc-dev
are suffixed with -${KERNEL_NAME_PROVIDED}: this allows
each variant to exist in isar-apt (reprepro may not have more than one
version of a given package for a given suite).
Apply the same suffix to linux-libc-dev / linux-libc-dev-${DISTRO_ARCH}-cross
and a Provides: clause.

Signed-off-by: Arulpandiyan Vadivel <arulpandiyan.vadivel@siemens.com>
---
 RECIPE-API-CHANGELOG.md                              | 12 ++++++++++++
 doc/custom_kernel.md                                 |  4 ++--
 meta/recipes-kernel/linux/files/debian/control.tmpl  | 10 +++++++---
 .../linux/files/debian/isar/install.tmpl             |  2 +-
 meta/recipes-kernel/linux/linux-custom.inc           |  2 ++
 5 files changed, 24 insertions(+), 6 deletions(-)

Comments

Jan Kiszka Jan. 17, 2025, 5:40 p.m. UTC | #1
On 17.01.25 18:37, 'Arulpandiyan Vadivel' via isar-users wrote:
> Debian and Ubuntu use unified kernel headers and a single linux-libc-dev
> package is shipped. In contrast, Isar may build multiple kernel variants
> with different versions and/or patches and their packages but linux-libc-dev
> are suffixed with -${KERNEL_NAME_PROVIDED}: this allows
> each variant to exist in isar-apt (reprepro may not have more than one
> version of a given package for a given suite).
> Apply the same suffix to linux-libc-dev / linux-libc-dev-${DISTRO_ARCH}-cross
> and a Provides: clause.
> 
> Signed-off-by: Arulpandiyan Vadivel <arulpandiyan.vadivel@siemens.com>
> ---
>  RECIPE-API-CHANGELOG.md                              | 12 ++++++++++++
>  doc/custom_kernel.md                                 |  4 ++--
>  meta/recipes-kernel/linux/files/debian/control.tmpl  | 10 +++++++---
>  .../linux/files/debian/isar/install.tmpl             |  2 +-
>  meta/recipes-kernel/linux/linux-custom.inc           |  2 ++
>  5 files changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index f310553a..5d470c94 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -702,3 +702,15 @@ enable cross-compilation. Otherwize ISAR_CROSS_COMPILE = "0" now should be set
>  in local.conf to disable cross-compilation for all the recipes.
>  Sample local.conf from meta-isar used by isar-init-build-env is also changed
>  to enable cross-compilation by default.
> +
> +### Enable linux-libc-dev package with KERNEL_NAME_PROVIDED
> +
> +By default linux-libc-dev and linux-libc-dev-${DISTRO_ARCH}-cross package
> +was generated for architecture it builds for.
> +
> +This change helps to generate the `linux-libc-dev-${KERNEL_NAME_PROVIDED}` and
> +`linux-libc-dev-cross-${KERNEL_NAME_PROVIDED}`.
> +For example, If `KERNEL_NAME_PROVIDED` is configured as `foo` for arm64, now
> +`linux-libc-dev-foo` and `linux-libc-dev-arm64-cross-foo` package will be
> +generated. This will help to have multiple versions of linux-libc-dev packages
> +available for respective bsps in apt feeds.
> diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
> index ce5f1bf7..ade4ad7a 100644
> --- a/doc/custom_kernel.md
> +++ b/doc/custom_kernel.md
> @@ -51,9 +51,9 @@ The linux-custom recipe provides support for:
>  
>      Only the `host` specific package is built automatically at cross builds.
>  
> - 10. Produce a `linux-libc-dev` package to support user-land builds
> + 10. Produce a `linux-libc-dev-${KERNEL_NAME_PROVIDED}` package to support user-land builds

KERNEL_NAME - this is what the user will deal with. KERNEL_NAME_PROVIDED
is internal to the kernel recipes.

>  
> - 11. Only build/ship the `linux-libc-dev` package if instructed to
> + 11. Only build/ship the `linux-libc-dev-${KERNEL_NAME_PROVIDED}` package if instructed to
>       (`KERNEL_LIBC_DEV_DEPLOY` equals to `"1"`)

Same here.

>  
>   12. Support both native and cross compiles (`ISAR_CROSS_COMPILE`)
> diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
> index ec0da1ab..a79b86c4 100644
> --- a/meta/recipes-kernel/linux/files/debian/control.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
> @@ -22,19 +22,23 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
>   .
>   This is useful for people who need to build external modules
>  
> -Package: linux-libc-dev
> +Package: linux-libc-dev-${KERNEL_NAME_PROVIDED}
>  Build-Profiles: <!nolibcdev kernel>
>  Section: devel
> -Provides: linux-kernel-headers
> +Conflicts: linux-libc-dev
> +Provides: linux-libc-dev
> +Replaces: linux-libc-dev
>  Architecture: ${KERNEL_LIBC_DEV_ARCH}
>  Description: Linux support headers for userspace development
>   This package provides userspaces headers from the Linux kernel. These headers
>   are used by the installed headers for GNU glibc and other system libraries.
>  
> -Package: linux-libc-dev-${DISTRO_ARCH}-cross
> +Package: linux-libc-dev-${DISTRO_ARCH}-cross-${KERNEL_NAME_PROVIDED}
>  Build-Profiles: <!nolibcdev cross !kbuild>
>  Section: devel
> +Conflicts: linux-kernel-headers-${DISTRO_ARCH}-cross
>  Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
> +Replaces: linux-kernel-headers-${DISTRO_ARCH}-cross
>  Architecture: all
>  Description: Linux Kernel Headers for development (for cross-compiling)
>   This package provides headers from the Linux kernel.  These headers
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> index 6d742f02..290a7d56 100644
> --- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> @@ -248,7 +248,7 @@ install_headers() {
>      if dpkg --compare-versions "${krel}" "lt" "5.4.24"; then
>          headers_check
>      fi
> -    [ -z ${kern_pkgs["linux-libc-dev"]} ] || libc_headers
> +    [ -z ${kern_pkgs["linux-libc-dev-${KERNEL_NAME_PROVIDED}"]} ] || libc_headers
>      kernel_headers
>  }
>  
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index 77700a5d..4f68f4cd 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -152,7 +152,9 @@ RECIPE_PROVIDES = " \
>      linux-image-${KERNEL_NAME_PROVIDED} \
>      linux-headers-${KERNEL_NAME_PROVIDED} \
>      linux-libc-dev \
> +    linux-libc-dev-${KERNEL_NAME_PROVIDED} \
>      linux-libc-dev-${DISTRO_ARCH}-cross \
> +    linux-libc-dev-${DISTRO_ARCH}-cross-${KERNEL_NAME_PROVIDED} \
>      linux-image-${KERNEL_NAME_PROVIDED}-dbg \
>      linux-kbuild-${KERNEL_NAME_PROVIDED} \
>      ${BPN}-pseudo-native \

Jan
Jan Kiszka Jan. 17, 2025, 5:44 p.m. UTC | #2
On 17.01.25 18:40, Jan Kiszka wrote:
> On 17.01.25 18:37, 'Arulpandiyan Vadivel' via isar-users wrote:
>> Debian and Ubuntu use unified kernel headers and a single linux-libc-dev
>> package is shipped. In contrast, Isar may build multiple kernel variants
>> with different versions and/or patches and their packages but linux-libc-dev
>> are suffixed with -${KERNEL_NAME_PROVIDED}: this allows
>> each variant to exist in isar-apt (reprepro may not have more than one
>> version of a given package for a given suite).
>> Apply the same suffix to linux-libc-dev / linux-libc-dev-${DISTRO_ARCH}-cross
>> and a Provides: clause.
>>
>> Signed-off-by: Arulpandiyan Vadivel <arulpandiyan.vadivel@siemens.com>
>> ---
>>  RECIPE-API-CHANGELOG.md                              | 12 ++++++++++++
>>  doc/custom_kernel.md                                 |  4 ++--
>>  meta/recipes-kernel/linux/files/debian/control.tmpl  | 10 +++++++---
>>  .../linux/files/debian/isar/install.tmpl             |  2 +-
>>  meta/recipes-kernel/linux/linux-custom.inc           |  2 ++
>>  5 files changed, 24 insertions(+), 6 deletions(-)
>>
>> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
>> index f310553a..5d470c94 100644
>> --- a/RECIPE-API-CHANGELOG.md
>> +++ b/RECIPE-API-CHANGELOG.md
>> @@ -702,3 +702,15 @@ enable cross-compilation. Otherwize ISAR_CROSS_COMPILE = "0" now should be set
>>  in local.conf to disable cross-compilation for all the recipes.
>>  Sample local.conf from meta-isar used by isar-init-build-env is also changed
>>  to enable cross-compilation by default.
>> +
>> +### Enable linux-libc-dev package with KERNEL_NAME_PROVIDED
>> +
>> +By default linux-libc-dev and linux-libc-dev-${DISTRO_ARCH}-cross package
>> +was generated for architecture it builds for.
>> +
>> +This change helps to generate the `linux-libc-dev-${KERNEL_NAME_PROVIDED}` and
>> +`linux-libc-dev-cross-${KERNEL_NAME_PROVIDED}`.
>> +For example, If `KERNEL_NAME_PROVIDED` is configured as `foo` for arm64, now
>> +`linux-libc-dev-foo` and `linux-libc-dev-arm64-cross-foo` package will be
>> +generated. This will help to have multiple versions of linux-libc-dev packages
>> +available for respective bsps in apt feeds.

And for explaining this situation better, have a look at
https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#using-custom-package-name-for-linux-kernel-and-headers

Jan

>> diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
>> index ce5f1bf7..ade4ad7a 100644
>> --- a/doc/custom_kernel.md
>> +++ b/doc/custom_kernel.md
>> @@ -51,9 +51,9 @@ The linux-custom recipe provides support for:
>>  
>>      Only the `host` specific package is built automatically at cross builds.
>>  
>> - 10. Produce a `linux-libc-dev` package to support user-land builds
>> + 10. Produce a `linux-libc-dev-${KERNEL_NAME_PROVIDED}` package to support user-land builds
> 
> KERNEL_NAME - this is what the user will deal with. KERNEL_NAME_PROVIDED
> is internal to the kernel recipes.
> 
>>  
>> - 11. Only build/ship the `linux-libc-dev` package if instructed to
>> + 11. Only build/ship the `linux-libc-dev-${KERNEL_NAME_PROVIDED}` package if instructed to
>>       (`KERNEL_LIBC_DEV_DEPLOY` equals to `"1"`)
> 
> Same here.
> 
>>  
>>   12. Support both native and cross compiles (`ISAR_CROSS_COMPILE`)
>> diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
>> index ec0da1ab..a79b86c4 100644
>> --- a/meta/recipes-kernel/linux/files/debian/control.tmpl
>> +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
>> @@ -22,19 +22,23 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
>>   .
>>   This is useful for people who need to build external modules
>>  
>> -Package: linux-libc-dev
>> +Package: linux-libc-dev-${KERNEL_NAME_PROVIDED}
>>  Build-Profiles: <!nolibcdev kernel>
>>  Section: devel
>> -Provides: linux-kernel-headers
>> +Conflicts: linux-libc-dev
>> +Provides: linux-libc-dev
>> +Replaces: linux-libc-dev
>>  Architecture: ${KERNEL_LIBC_DEV_ARCH}
>>  Description: Linux support headers for userspace development
>>   This package provides userspaces headers from the Linux kernel. These headers
>>   are used by the installed headers for GNU glibc and other system libraries.
>>  
>> -Package: linux-libc-dev-${DISTRO_ARCH}-cross
>> +Package: linux-libc-dev-${DISTRO_ARCH}-cross-${KERNEL_NAME_PROVIDED}
>>  Build-Profiles: <!nolibcdev cross !kbuild>
>>  Section: devel
>> +Conflicts: linux-kernel-headers-${DISTRO_ARCH}-cross
>>  Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
>> +Replaces: linux-kernel-headers-${DISTRO_ARCH}-cross
>>  Architecture: all
>>  Description: Linux Kernel Headers for development (for cross-compiling)
>>   This package provides headers from the Linux kernel.  These headers
>> diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
>> index 6d742f02..290a7d56 100644
>> --- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
>> +++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
>> @@ -248,7 +248,7 @@ install_headers() {
>>      if dpkg --compare-versions "${krel}" "lt" "5.4.24"; then
>>          headers_check
>>      fi
>> -    [ -z ${kern_pkgs["linux-libc-dev"]} ] || libc_headers
>> +    [ -z ${kern_pkgs["linux-libc-dev-${KERNEL_NAME_PROVIDED}"]} ] || libc_headers
>>      kernel_headers
>>  }
>>  
>> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
>> index 77700a5d..4f68f4cd 100644
>> --- a/meta/recipes-kernel/linux/linux-custom.inc
>> +++ b/meta/recipes-kernel/linux/linux-custom.inc
>> @@ -152,7 +152,9 @@ RECIPE_PROVIDES = " \
>>      linux-image-${KERNEL_NAME_PROVIDED} \
>>      linux-headers-${KERNEL_NAME_PROVIDED} \
>>      linux-libc-dev \
>> +    linux-libc-dev-${KERNEL_NAME_PROVIDED} \
>>      linux-libc-dev-${DISTRO_ARCH}-cross \
>> +    linux-libc-dev-${DISTRO_ARCH}-cross-${KERNEL_NAME_PROVIDED} \
>>      linux-image-${KERNEL_NAME_PROVIDED}-dbg \
>>      linux-kbuild-${KERNEL_NAME_PROVIDED} \
>>      ${BPN}-pseudo-native \
> 
> Jan
>

Patch

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index f310553a..5d470c94 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -702,3 +702,15 @@  enable cross-compilation. Otherwize ISAR_CROSS_COMPILE = "0" now should be set
 in local.conf to disable cross-compilation for all the recipes.
 Sample local.conf from meta-isar used by isar-init-build-env is also changed
 to enable cross-compilation by default.
+
+### Enable linux-libc-dev package with KERNEL_NAME_PROVIDED
+
+By default linux-libc-dev and linux-libc-dev-${DISTRO_ARCH}-cross package
+was generated for architecture it builds for.
+
+This change helps to generate the `linux-libc-dev-${KERNEL_NAME_PROVIDED}` and
+`linux-libc-dev-cross-${KERNEL_NAME_PROVIDED}`.
+For example, If `KERNEL_NAME_PROVIDED` is configured as `foo` for arm64, now
+`linux-libc-dev-foo` and `linux-libc-dev-arm64-cross-foo` package will be
+generated. This will help to have multiple versions of linux-libc-dev packages
+available for respective bsps in apt feeds.
diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
index ce5f1bf7..ade4ad7a 100644
--- a/doc/custom_kernel.md
+++ b/doc/custom_kernel.md
@@ -51,9 +51,9 @@  The linux-custom recipe provides support for:
 
     Only the `host` specific package is built automatically at cross builds.
 
- 10. Produce a `linux-libc-dev` package to support user-land builds
+ 10. Produce a `linux-libc-dev-${KERNEL_NAME_PROVIDED}` package to support user-land builds
 
- 11. Only build/ship the `linux-libc-dev` package if instructed to
+ 11. Only build/ship the `linux-libc-dev-${KERNEL_NAME_PROVIDED}` package if instructed to
      (`KERNEL_LIBC_DEV_DEPLOY` equals to `"1"`)
 
  12. Support both native and cross compiles (`ISAR_CROSS_COMPILE`)
diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index ec0da1ab..a79b86c4 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -22,19 +22,23 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
  .
  This is useful for people who need to build external modules
 
-Package: linux-libc-dev
+Package: linux-libc-dev-${KERNEL_NAME_PROVIDED}
 Build-Profiles: <!nolibcdev kernel>
 Section: devel
-Provides: linux-kernel-headers
+Conflicts: linux-libc-dev
+Provides: linux-libc-dev
+Replaces: linux-libc-dev
 Architecture: ${KERNEL_LIBC_DEV_ARCH}
 Description: Linux support headers for userspace development
  This package provides userspaces headers from the Linux kernel. These headers
  are used by the installed headers for GNU glibc and other system libraries.
 
-Package: linux-libc-dev-${DISTRO_ARCH}-cross
+Package: linux-libc-dev-${DISTRO_ARCH}-cross-${KERNEL_NAME_PROVIDED}
 Build-Profiles: <!nolibcdev cross !kbuild>
 Section: devel
+Conflicts: linux-kernel-headers-${DISTRO_ARCH}-cross
 Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
+Replaces: linux-kernel-headers-${DISTRO_ARCH}-cross
 Architecture: all
 Description: Linux Kernel Headers for development (for cross-compiling)
  This package provides headers from the Linux kernel.  These headers
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
index 6d742f02..290a7d56 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
@@ -248,7 +248,7 @@  install_headers() {
     if dpkg --compare-versions "${krel}" "lt" "5.4.24"; then
         headers_check
     fi
-    [ -z ${kern_pkgs["linux-libc-dev"]} ] || libc_headers
+    [ -z ${kern_pkgs["linux-libc-dev-${KERNEL_NAME_PROVIDED}"]} ] || libc_headers
     kernel_headers
 }
 
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 77700a5d..4f68f4cd 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -152,7 +152,9 @@  RECIPE_PROVIDES = " \
     linux-image-${KERNEL_NAME_PROVIDED} \
     linux-headers-${KERNEL_NAME_PROVIDED} \
     linux-libc-dev \
+    linux-libc-dev-${KERNEL_NAME_PROVIDED} \
     linux-libc-dev-${DISTRO_ARCH}-cross \
+    linux-libc-dev-${DISTRO_ARCH}-cross-${KERNEL_NAME_PROVIDED} \
     linux-image-${KERNEL_NAME_PROVIDED}-dbg \
     linux-kbuild-${KERNEL_NAME_PROVIDED} \
     ${BPN}-pseudo-native \