[v2] Revert "linux-custom: support to add linux-libc-dev package with kernel name"

Message ID fcae98da-6825-4037-8edc-ce657e6735b1@siemens.com
State Accepted, archived
Headers show
Series [v2] Revert "linux-custom: support to add linux-libc-dev package with kernel name" | expand

Commit Message

Jan Kiszka Oct. 14, 2025, 1:56 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

This reverts commit 6cf35fc33d11f7d3feb0472a40e79dbd3ee3d759.

Besides having multiple implementations flaws, the general approach
turned out to be incompatible with Debian's dependency management: We
cannot replace a package A with a package B which only provides A. The
resolver will continue to prefer package A when it is requested,
explicitly or implicitly.

If a build enables multiple kernels, it is recommended to ensure at
recipe-level that only one kernel build enables KERNEL_LIBC_DEV_DEPLOY.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - rebased over next

 RECIPE-API-CHANGELOG.md                                |  7 +++++++
 doc/custom_kernel.md                                   |  4 ++--
 meta/recipes-kernel/linux/files/debian/control.tmpl    | 10 +++-------
 .../recipes-kernel/linux/files/debian/isar/common.tmpl |  2 +-
 .../linux/files/debian/isar/install.tmpl               |  2 +-
 meta/recipes-kernel/linux/linux-custom.inc             |  2 --
 6 files changed, 14 insertions(+), 13 deletions(-)

Comments

Bouska, Zdenek Oct. 20, 2025, 8:40 a.m. UTC | #1
On Tuesday, October 14, 2025 at 3:56:31 PM UTC+2 Jan Kiszka wrote:

From: Jan Kiszka <jan.k...@siemens.com> 

This reverts commit 6cf35fc33d11f7d3feb0472a40e79dbd3ee3d759. 

Besides having multiple implementations flaws, the general approach 
turned out to be incompatible with Debian's dependency management: We 
cannot replace a package A with a package B which only provides A. The 
resolver will continue to prefer package A when it is requested, 
explicitly or implicitly. 

If a build enables multiple kernels, it is recommended to ensure at 
recipe-level that only one kernel build enables KERNEL_LIBC_DEV_DEPLOY. 

Signed-off-by: Jan Kiszka <jan.k...@siemens.com> 
--- 

Changes in v2: 
- rebased over next 

RECIPE-API-CHANGELOG.md | 7 +++++++ 
doc/custom_kernel.md | 4 ++-- 
meta/recipes-kernel/linux/files/debian/control.tmpl | 10 +++------- 
.../recipes-kernel/linux/files/debian/isar/common.tmpl | 2 +- 
.../linux/files/debian/isar/install.tmpl | 2 +- 
meta/recipes-kernel/linux/linux-custom.inc | 2 -- 
6 files changed, 14 insertions(+), 13 deletions(-) 

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md 
index 2930ade9..21da672f 100644 
--- a/RECIPE-API-CHANGELOG.md 
+++ b/RECIPE-API-CHANGELOG.md 
@@ -761,3 +761,10 @@ the following variables in your image recipe. For 
example, to use German, add: 
LOCALE_GEN = "de_DE.UTF-8 UTF-8\n" 
LOCALE_DEFAULT = "de_DE.UTF-8" 
``` 
+ 
+### Revert enabling of linux-libc-dev package with KERNEL_NAME 
+ 
+The change "Enable linux-libc-dev package with KERNEL_NAME" turned out to 
be 
+incompatible with how Debian selects dependencies. It is therefore 
necessary 
+to only enable `KERNEL_LIBC_DEV_DEPLOY` for a single kernel in case 
multiples 
+are configured via `KERNEL_NAMES`. 
diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md 
index 2dca577c..ce5f1bf7 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-${KERNEL_NAME}` package to support 
user-land builds 
+ 10. Produce a `linux-libc-dev` package to support user-land builds 

- 11. Only build/ship the `linux-libc-dev-${KERNEL_NAME}` package if 
instructed to 
+ 11. Only build/ship the `linux-libc-dev` 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 112ff9bf..c27fe0c7 100644 
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl 
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl 
@@ -22,23 +22,19 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel 
headers for @KR@ 
. 
This is useful for people who need to build external modules 

-Package: linux-libc-dev-${KERNEL_NAME_PROVIDED} 
+Package: linux-libc-dev 
Build-Profiles: <!nolibcdev kernel> 
Section: devel 
-Conflicts: linux-libc-dev 
-Provides: linux-libc-dev 
-Replaces: linux-libc-dev 
+Provides: linux-kernel-headers 
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-${KERNEL_NAME_PROVIDED} 
+Package: linux-libc-dev-${DISTRO_ARCH}-cross 
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/common.tmpl 
b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl 
index b004214f..f9cc2f02 100644 
--- a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl 
+++ b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl 
@@ -8,7 +8,7 @@ set -e 
ARCH=${KERNEL_ARCH} 
KERNEL_PKG_IMAGE=linux-image-${KERNEL_NAME_PROVIDED} 
KERNEL_PKG_KERN_HEADERS=linux-headers-${KERNEL_NAME_PROVIDED} 
-KERNEL_PKG_LIBC_HEADERS=linux-libc-dev-${KERNEL_NAME_PROVIDED} 
+KERNEL_PKG_LIBC_HEADERS=linux-libc-dev 
KERNEL_PKG_LIBC_HEADERS_CROSS=linux-libc-dev-${DISTRO_ARCH}-cross 
KERNEL_PKG_KERN_KBUILD=linux-kbuild-${KERNEL_NAME_PROVIDED} 
KERNEL_PKG_KERN_KBUILD_CROSS=${KERNEL_PKG_KERN_KBUILD}-${DISTRO_ARCH}-cross 
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl 
b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl 
index d7e711ef..fe0bd810 100644 
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl 
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl 
@@ -240,7 +240,7 @@ install_headers() { 
if dpkg --compare-versions "${krel}" "lt" "5.4.24"; then 
headers_check 
fi 
- [ -z ${kern_pkgs["linux-libc-dev-${KERNEL_NAME_PROVIDED}"]} ] || 
libc_headers 
+ [ -z ${kern_pkgs["linux-libc-dev"]} ] || libc_headers 
kernel_headers 
} 

diff --git a/meta/recipes-kernel/linux/linux-custom.inc 
b/meta/recipes-kernel/linux/linux-custom.inc 
index ca90c4e9..9da10c31 100644 
--- a/meta/recipes-kernel/linux/linux-custom.inc 
+++ b/meta/recipes-kernel/linux/linux-custom.inc 
@@ -150,9 +150,7 @@ 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 \
Zhihang Wei Oct. 21, 2025, 3:20 p.m. UTC | #2
Applied to next, thanks.

Best regards,
Zhihang

On 10/14/25 15:56, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This reverts commit 6cf35fc33d11f7d3feb0472a40e79dbd3ee3d759.
>
> Besides having multiple implementations flaws, the general approach
> turned out to be incompatible with Debian's dependency management: We
> cannot replace a package A with a package B which only provides A. The
> resolver will continue to prefer package A when it is requested,
> explicitly or implicitly.
>
> If a build enables multiple kernels, it is recommended to ensure at
> recipe-level that only one kernel build enables KERNEL_LIBC_DEV_DEPLOY.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Changes in v2:
>   - rebased over next
>
>   RECIPE-API-CHANGELOG.md                                |  7 +++++++
>   doc/custom_kernel.md                                   |  4 ++--
>   meta/recipes-kernel/linux/files/debian/control.tmpl    | 10 +++-------
>   .../recipes-kernel/linux/files/debian/isar/common.tmpl |  2 +-
>   .../linux/files/debian/isar/install.tmpl               |  2 +-
>   meta/recipes-kernel/linux/linux-custom.inc             |  2 --
>   6 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 2930ade9..21da672f 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -761,3 +761,10 @@ the following variables in your image recipe. For example, to use German, add:
>   LOCALE_GEN = "de_DE.UTF-8 UTF-8\n"
>   LOCALE_DEFAULT = "de_DE.UTF-8"
>   ```
> +
> +### Revert enabling of linux-libc-dev package with KERNEL_NAME
> +
> +The change "Enable linux-libc-dev package with KERNEL_NAME" turned out to be
> +incompatible with how Debian selects dependencies. It is therefore necessary
> +to only enable `KERNEL_LIBC_DEV_DEPLOY` for a single kernel in case multiples
> +are configured via `KERNEL_NAMES`.
> diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
> index 2dca577c..ce5f1bf7 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-${KERNEL_NAME}` package to support user-land builds
> + 10. Produce a `linux-libc-dev` package to support user-land builds
>   
> - 11. Only build/ship the `linux-libc-dev-${KERNEL_NAME}` package if instructed to
> + 11. Only build/ship the `linux-libc-dev` 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 112ff9bf..c27fe0c7 100644
> --- a/meta/recipes-kernel/linux/files/debian/control.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
> @@ -22,23 +22,19 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
>    .
>    This is useful for people who need to build external modules
>   
> -Package: linux-libc-dev-${KERNEL_NAME_PROVIDED}
> +Package: linux-libc-dev
>   Build-Profiles: <!nolibcdev kernel>
>   Section: devel
> -Conflicts: linux-libc-dev
> -Provides: linux-libc-dev
> -Replaces: linux-libc-dev
> +Provides: linux-kernel-headers
>   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-${KERNEL_NAME_PROVIDED}
> +Package: linux-libc-dev-${DISTRO_ARCH}-cross
>   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/common.tmpl b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
> index b004214f..f9cc2f02 100644
> --- a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
> @@ -8,7 +8,7 @@ set -e
>   ARCH=${KERNEL_ARCH}
>   KERNEL_PKG_IMAGE=linux-image-${KERNEL_NAME_PROVIDED}
>   KERNEL_PKG_KERN_HEADERS=linux-headers-${KERNEL_NAME_PROVIDED}
> -KERNEL_PKG_LIBC_HEADERS=linux-libc-dev-${KERNEL_NAME_PROVIDED}
> +KERNEL_PKG_LIBC_HEADERS=linux-libc-dev
>   KERNEL_PKG_LIBC_HEADERS_CROSS=linux-libc-dev-${DISTRO_ARCH}-cross
>   KERNEL_PKG_KERN_KBUILD=linux-kbuild-${KERNEL_NAME_PROVIDED}
>   KERNEL_PKG_KERN_KBUILD_CROSS=${KERNEL_PKG_KERN_KBUILD}-${DISTRO_ARCH}-cross
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> index d7e711ef..fe0bd810 100644
> --- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> @@ -240,7 +240,7 @@ install_headers() {
>       if dpkg --compare-versions "${krel}" "lt" "5.4.24"; then
>           headers_check
>       fi
> -    [ -z ${kern_pkgs["linux-libc-dev-${KERNEL_NAME_PROVIDED}"]} ] || libc_headers
> +    [ -z ${kern_pkgs["linux-libc-dev"]} ] || libc_headers
>       kernel_headers
>   }
>   
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index ca90c4e9..9da10c31 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -150,9 +150,7 @@ 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 \

Patch

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 2930ade9..21da672f 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -761,3 +761,10 @@  the following variables in your image recipe. For example, to use German, add:
 LOCALE_GEN = "de_DE.UTF-8 UTF-8\n"
 LOCALE_DEFAULT = "de_DE.UTF-8"
 ```
+
+### Revert enabling of linux-libc-dev package with KERNEL_NAME
+
+The change "Enable linux-libc-dev package with KERNEL_NAME" turned out to be
+incompatible with how Debian selects dependencies. It is therefore necessary
+to only enable `KERNEL_LIBC_DEV_DEPLOY` for a single kernel in case multiples
+are configured via `KERNEL_NAMES`.
diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
index 2dca577c..ce5f1bf7 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-${KERNEL_NAME}` package to support user-land builds
+ 10. Produce a `linux-libc-dev` package to support user-land builds
 
- 11. Only build/ship the `linux-libc-dev-${KERNEL_NAME}` package if instructed to
+ 11. Only build/ship the `linux-libc-dev` 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 112ff9bf..c27fe0c7 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -22,23 +22,19 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
  .
  This is useful for people who need to build external modules
 
-Package: linux-libc-dev-${KERNEL_NAME_PROVIDED}
+Package: linux-libc-dev
 Build-Profiles: <!nolibcdev kernel>
 Section: devel
-Conflicts: linux-libc-dev
-Provides: linux-libc-dev
-Replaces: linux-libc-dev
+Provides: linux-kernel-headers
 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-${KERNEL_NAME_PROVIDED}
+Package: linux-libc-dev-${DISTRO_ARCH}-cross
 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/common.tmpl b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
index b004214f..f9cc2f02 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
@@ -8,7 +8,7 @@  set -e
 ARCH=${KERNEL_ARCH}
 KERNEL_PKG_IMAGE=linux-image-${KERNEL_NAME_PROVIDED}
 KERNEL_PKG_KERN_HEADERS=linux-headers-${KERNEL_NAME_PROVIDED}
-KERNEL_PKG_LIBC_HEADERS=linux-libc-dev-${KERNEL_NAME_PROVIDED}
+KERNEL_PKG_LIBC_HEADERS=linux-libc-dev
 KERNEL_PKG_LIBC_HEADERS_CROSS=linux-libc-dev-${DISTRO_ARCH}-cross
 KERNEL_PKG_KERN_KBUILD=linux-kbuild-${KERNEL_NAME_PROVIDED}
 KERNEL_PKG_KERN_KBUILD_CROSS=${KERNEL_PKG_KERN_KBUILD}-${DISTRO_ARCH}-cross
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
index d7e711ef..fe0bd810 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
@@ -240,7 +240,7 @@  install_headers() {
     if dpkg --compare-versions "${krel}" "lt" "5.4.24"; then
         headers_check
     fi
-    [ -z ${kern_pkgs["linux-libc-dev-${KERNEL_NAME_PROVIDED}"]} ] || libc_headers
+    [ -z ${kern_pkgs["linux-libc-dev"]} ] || libc_headers
     kernel_headers
 }
 
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index ca90c4e9..9da10c31 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -150,9 +150,7 @@  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 \