[3/5] kernel: make source package architecture specific

Message ID 20260813164500.3092151-4-felix.moessbauer@siemens.com
State Under Review
Headers show
Series Fix single-name single-content rule for kernel packages | expand

Commit Message

MOESSBAUER, Felix Aug. 13, 2026, 4:44 p.m. UTC
Currently we mark our kernel source packages as Arch=any all, despite
the content of the package is architecture specific. Here, we make the
package architecture specific by avoiding any Arch=any identifier in the
control file. This results in having Architecture: ${DISTRO_ARCH} all in
the generated .dsc file. The same applies to the custom kernel modules.

A special case is the "linux-kbuild-${KERNEL_NAME_PROVIDED}-
${DISTRO_ARCH}-cross" package, which is specific to the BUILD_ARCH, as
it contains host tooling binaries for the host, which are derived from
the target specific kernel.

Ensuring that we do not generate multiple kernel packages with different
content but the same name (for multiple architectures) will be done in
later commits.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/linux-kernel.bbclass               |  3 ++-
 .../linux-module/files/debian/control.tmpl             |  2 +-
 meta/recipes-kernel/linux/files/debian/control.tmpl    | 10 +++++-----
 3 files changed, 8 insertions(+), 7 deletions(-)

Patch

diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
index ac587b17..74a49aa8 100644
--- a/meta/classes-recipe/linux-kernel.bbclass
+++ b/meta/classes-recipe/linux-kernel.bbclass
@@ -78,6 +78,7 @@  TEMPLATE_FILES += "                  \
 
 TEMPLATE_VARS += "                \
     BPN                           \
+    BUILD_ARCH                    \
     KBUILD_DEPENDS                \
     KERNEL_ARCH                   \
     KERNEL_DEBIAN_DEPENDS         \
@@ -274,7 +275,7 @@  def get_additional_build_profiles(d):
         profiles += ' pkg.{}.libcdev-arch-all'.format(d.getVar('BPN'))
     return profiles
 
-KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', 'any', d) }"
+KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', d.getVar('DISTRO_ARCH'), d) }"
 DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"
 
 do_prepare_build[cleandirs] += "${S}/debian"
diff --git a/meta/recipes-kernel/linux-module/files/debian/control.tmpl b/meta/recipes-kernel/linux-module/files/debian/control.tmpl
index d8f4aded..3c222979 100644
--- a/meta/recipes-kernel/linux-module/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux-module/files/debian/control.tmpl
@@ -7,6 +7,6 @@  Maintainer: ${MAINTAINER}
 Rules-Requires-Root: no
 
 Package: ${PN}
-Architecture: any
+Architecture: ${DISTRO_ARCH}
 Depends: ${KERNEL_IMAGE_PKG}, kmod
 Description: ${DESCRIPTION}
diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index 77c4048b..f89a1f56 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -8,7 +8,7 @@  Rules-Requires-Root: no
 
 Package: linux-image-${KERNEL_NAME_PROVIDED}
 Build-Profiles: <pkg.${BPN}.kernel>
-Architecture: any
+Architecture: ${DISTRO_ARCH}
 Depends: ${KERNEL_DEBIAN_DEPENDS}
 Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
  This package contains the Linux kernel, modules and corresponding other
@@ -16,7 +16,7 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
 
 Package: linux-headers-${KERNEL_NAME_PROVIDED}
 Build-Profiles: <pkg.${BPN}.kernel>
-Architecture: any
+Architecture: ${DISTRO_ARCH}
 Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlibs:Depends}
 Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
  This package provides kernel header files for @KR@ on ${DISTRO_ARCH}
@@ -47,14 +47,14 @@  Description: Linux Kernel Headers for development (for cross-compiling)
 Package: linux-image-${KERNEL_NAME_PROVIDED}-dbg
 Build-Profiles: <pkg.${BPN}.kernel>
 Section: debug
-Architecture: any
+Architecture: ${DISTRO_ARCH}
 Description: Linux kernel debugging symbols for @KR@
  This package will come in handy if you need to debug the kernel. It provides
  all the necessary debug symbols for the kernel and its modules.
 
 Package: linux-kbuild-${KERNEL_NAME_PROVIDED}
 Build-Profiles: <pkg.${BPN}.kbuild !pkg.${BPN}.cross>
-Architecture: any
+Architecture: ${DISTRO_ARCH}
 Depends: ${perl:Depends}, ${shlibs:Depends}
 Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
  This package provides kernel kbuild scripts and tools for @KR@
@@ -62,7 +62,7 @@  Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
 
 Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross
 Build-Profiles: <pkg.${BPN}.kbuild pkg.${BPN}.cross>
-Architecture: any
+Architecture: ${BUILD_ARCH}
 Multi-Arch: foreign
 Depends: ${perl:Depends}, ${shlibs:Depends}
 Conflicts: linux-kbuild-${KERNEL_NAME_PROVIDED}