[PATCH 1/2] do not add cross profile when building native package

9 views
Skip to first unread message

Felix Moessbauer

unread,
Nov 3, 2025, 11:01:49 AM (3 days ago) Nov 3
to isar-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com, Felix Moessbauer, Benedikt Niedermayr
When building a -native package, the cross profile must not be added as
otherwise stricter apt cache checks added in trixie trigger. It anyways
makes no sense to add the cross profile when BUILD_ARCH equals
PACKAGE_ARCH. Previously this check was implemented incorrectly, as the
build arch was compared to the DISTRO_ARCH, which is always the target
arch in isar terms. This resulted in the following error message in
sbuild:

E: The package cache was built for different architectures: amd64 vs arm64
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted
E: apt-get dist-upgrade failed

On bookworm, the incorrect check remained unnoticed, as apt did not have
the stricter checks yet.

Fixes: 872ef2e3 ("dpkg-base: Fix enabling of cross build profile")
Tested-by: Benedikt Niedermayr <benedikt....@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
meta/classes/dpkg-base.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 4468a49a..d8287e8d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -146,7 +146,7 @@ dpkg_runbuild() {

def isar_deb_build_profiles(d):
deb_build_profiles = d.getVar('DEB_BUILD_PROFILES')
- if d.getVar('BUILD_ARCH') != d.getVar('DISTRO_ARCH'):
+ if d.getVar('BUILD_ARCH') != d.getVar('PACKAGE_ARCH'):
deb_build_profiles += ' cross'
return deb_build_profiles.strip()

--
2.51.0

Felix Moessbauer

unread,
Nov 3, 2025, 11:02:00 AM (3 days ago) Nov 3
to isar-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com, Felix Moessbauer, Benedikt Niedermayr
DPKG_ARCH=all packages are always build in their -native variant.
However, these packages still can have non-native dependencies which
must be built for the distro arch.

Fixes: 23a73895 ("multiarch: inject native variants of preferred providers")
Tested-by: Benedikt Niedermayr <benedikt....@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
meta/classes/multiarch.bbclass | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
index c2bba21f..74b8f5b8 100644
--- a/meta/classes/multiarch.bbclass
+++ b/meta/classes/multiarch.bbclass
@@ -106,11 +106,13 @@ python multiarch_virtclass_handler() {
# Arch=all packages might build depend on other arch=all packages,
# hence we need to correctly model the dependency chain.
# We implement this by dispatching the non-native variant to the -native
- # variant by adding a dependency. We further replace the non-native
- # do_deploy_dep task with a noop to preserve the dependency chain.
+ # variant by adding a dependency. We further empty the non-native
+ # do_deploy_dep task and clear the internal dependency chain, but keep
+ # other attached variables like RDEPENDS to preserve the dependency chain.
e.data.setVar('do_deploy_deb', '')
- bb.build.deltask('deploy_deb', e.data)
- bb.build.addtask('deploy_deb', 'do_build', '', e.data)
+ # clear internal dependencies (e.g. to do_dpkg_build)
+ e.data.setVarFlag('do_deploy_deb', 'deps', [])
+ # dispatch to native variant
e.data.setVarFlag('do_deploy_deb', 'depends', f'{pn}-native:do_deploy_deb')
}
addhandler multiarch_virtclass_handler
--
2.51.0

Jan Kiszka

unread,
Nov 3, 2025, 11:06:06 AM (3 days ago) Nov 3
to Felix Moessbauer, isar-...@googlegroups.com, cedric.h...@siemens.com, Benedikt Niedermayr
Tested here as well: Works, and this makes sense, indeed. Resolves
https://groups.google.com/g/isar-users/c/IUSoAfSF5OU/m/ZYPR34b9AAAJ.

Thanks,
Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center

Zhihang Wei

unread,
Nov 4, 2025, 7:25:14 AM (2 days ago) Nov 4
to Felix Moessbauer, isar-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com, Benedikt Niedermayr
Hi,

The patch caused one test failed on fast CI, and another failed on full CI.

For fast CI, the failed test case is citest.py:CrossTest.test_cross, when
building target 'mc:phyboard-mira-bookworm:isar-image-base'. Log follows:

21:11:12  (07/22)
/build/isar_wzh_3_fast/21/testsuite/citest.py:CrossTest.test_cross: STARTED
21:52:04  (07/22)
/build/isar_wzh_3_fast/21/testsuite/citest.py:CrossTest.test_cross:
FAIL: Bitbake failed (2451.57 s)

[stdlog] 2025-11-03 21:45:44,063 avocado.app cibuilder L0322 ERROR|
ERROR: mc:phyboard-mira-bookworm:example-module-phy-1.0-r0
do_dpkg_build:
ExecutionError('/build/isar_wzh_3_fast/21/build/tmp/work/debian-bookworm-armhf/example-module-phy/1.0-r0/temp/run.dpkg_runbuild.2797715',
3, None, None)
[stdlog] 2025-11-03 21:45:44,063 avocado.test cibuilder L0320 INFO | Log
data follows:
[stdlog] 2025-11-03 21:45:44,063 avocado.app cibuilder L0322 ERROR|
ERROR: Logfile of failure stored in:
/build/isar_wzh_3_fast/21/build/tmp/work/debian-bookworm-armhf/example-module-phy/1.0-r0/temp/log.do_dpkg_build.2797715

DEBUG: Executing python function sstate_task_prefunc
DEBUG: Python function sstate_task_prefunc finished
DEBUG: Executing python function do_dpkg_build
DEBUG: Executing shell function dpkg_schroot_create_configs
Creating
/etc/schroot/chroot.d/isar-jenkins-c83a1f30-2c3c-4e94-9101-7bae88f0c388-2797715
DEBUG: Shell function dpkg_schroot_create_configs finished
DEBUG: Executing shell function dpkg_runbuild
sbuild (Debian sbuild) 0.85.0 (04 January 2023) on arqalyq.m.ilbers.de

+==============================================================================+
| example-module-phy 1.0 (armhf)               Mon, 03 Nov 2025 20:43:20
+0000 |
+==============================================================================+

Package: example-module-phy
Version: 1.0
Source Version: 1.0
Distribution: isar
Machine Architecture: amd64
Host Architecture: armhf
Build Architecture: amd64
Build Profiles: cross
Build Type: binary

I: NOTICE: Log filtering will replace
'var/run/schroot/mount/isar-jenkins-c83a1f30-2c3c-4e94-9101-7bae88f0c388-2797715-d5717322-f8d3-4405-8cca-3c6de6d5cb2e'
with '<<CHROOT>>'

+------------------------------------------------------------------------------+
| Chroot Setup Commands             |
+------------------------------------------------------------------------------+


echo "Package: *\nPin: release n=isar\nPin-Priority: 1000" >
/etc/apt/preferences.d/isar-apt
--------------------------------------------------------------------------------------------


I: Finished running 'echo "Package: *\nPin: release
n=isar\nPin-Priority: 1000" > /etc/apt/preferences.d/isar-apt'.

echo "APT::Get::allow-downgrades 1;" > /etc/apt/apt.conf.d/50isar-apt
---------------------------------------------------------------------


I: Finished running 'echo "APT::Get::allow-downgrades 1;" >
/etc/apt/apt.conf.d/50isar-apt'.

rm -f /var/log/dpkg.log
-----------------------


I: Finished running 'rm -f /var/log/dpkg.log'.

mkdir -p /var/cache/apt/archives
--------------------------------


I: Finished running 'mkdir -p /var/cache/apt/archives'.

find /home/builder/example-module-phy/rootfs/var/cache/apt/archives
-maxdepth 1 -name '*.deb' -exec ln -t /var/cache/apt/archives/ -sf {} +
-------------------------------------------------------------------------------------------------------------------------------------------


I: Finished running 'find
/home/builder/example-module-phy/rootfs/var/cache/apt/archives -maxdepth
1 -name '*.deb' -exec ln -t /var/cache/apt/archives/ -sf {} +'.

apt-get update -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" -o
Dir::Etc::SourceParts="-" -o APT::Get::List-Cleanup="0"
--------------------------------------------------------------------------------------------------------------------------------

Get:1 file:/isar-apt isar InRelease
Ign:1 file:/isar-apt isar InRelease
Get:2 file:/isar-apt isar Release [5105 B]
Get:2 file:/isar-apt isar Release [5105 B]
Get:3 file:/isar-apt isar Release.gpg
Ign:3 file:/isar-apt isar Release.gpg
Get:4 file:/isar-apt isar/main Sources [5394 B]
Get:5 file:/isar-apt isar/main amd64 Packages [2762 B]
Get:6 file:/isar-apt isar/main armhf Packages [5352 B]
Reading package lists...

I: Finished running 'apt-get update -o
Dir::Etc::SourceList="sources.list.d/isar-apt.list" -o
Dir::Etc::SourceParts="-" -o APT::Get::List-Cleanup="0"'.

Finished processing commands.
--------------------------------------------------------------------------------
I: NOTICE: Log filtering will replace
'build/example-module-phy-32rpQ2/resolver-lDWJSX' with '<<RESOLVERDIR>>'

+------------------------------------------------------------------------------+
| Update chroot             |
+------------------------------------------------------------------------------+

Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

+------------------------------------------------------------------------------+
| Fetch source files              |
+------------------------------------------------------------------------------+


Local sources
-------------

/build/isar_wzh_3_fast/21/build/tmp/work/debian-bookworm-armhf/example-module-phy/1.0-r0/example-module-phy_1.0.dsc
exists in
/build/isar_wzh_3_fast/21/build/tmp/work/debian-bookworm-armhf/example-module-phy/1.0-r0;
copying to chroot
I: NOTICE: Log filtering will replace
'build/example-module-phy-32rpQ2/example-module-phy-1.0' with
'<<PKGBUILDDIR>>'
I: NOTICE: Log filtering will replace 'build/example-module-phy-32rpQ2'
with '<<BUILDDIR>>'

+------------------------------------------------------------------------------+
| Install package build dependencies              |
+------------------------------------------------------------------------------+


Setup apt archive
-----------------

Merged Build-Depends: debhelper-compat (= 13), linux-headers-phy,
build-essential:amd64, fakeroot:amd64, crossbuild-essential-armhf:amd64,
libc-dev:armhf, libstdc++-dev:armhf
Filtered Build-Depends: debhelper-compat (= 13), linux-headers-phy,
build-essential:amd64, fakeroot:amd64, crossbuild-essential-armhf:amd64,
libc-dev:armhf, libstdc++-dev:armhf
dpkg-deb: building package 'sbuild-build-depends-main-dummy' in
'/<<RESOLVERDIR>>/apt_archive/sbuild-build-depends-main-dummy.deb'.
Ign:1 copy:/<<RESOLVERDIR>>/apt_archive ./ InRelease
Get:2 copy:/<<RESOLVERDIR>>/apt_archive ./ Release [609 B]
Ign:3 copy:/<<RESOLVERDIR>>/apt_archive ./ Release.gpg
Get:4 copy:/<<RESOLVERDIR>>/apt_archive ./ Sources [708 B]
Get:5 copy:/<<RESOLVERDIR>>/apt_archive ./ Packages [751 B]
Fetched 2068 B in 0s (50.9 kB/s)
Reading package lists...
Reading package lists...

Install main build dependencies (apt-based resolver)
----------------------------------------------------

Installing build dependencies
Reading package lists...
Building dependency tree...
Reading state information...
The solver encountered an error of type: ERR_UNSOLVABLE
The following information might help you to understand what is wrong:
The following packages have unmet dependencies:
 linux-headers-phy:armhf : Depends: linux-kbuild-phy:armhf but it is
not installable or
linux-kbuild-phy-armhf-cross:armhf but it is not installable

Execute external solver...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sbuild-build-depends-main-dummy:armhf : Depends:
linux-headers-phy:armhf but it is not going to be installed
E: External solver failed with: The following packages have unmet
dependencies:
apt-get failed.
E: Package installation failed
Not removing build depends: cloned chroot in use
Reading package lists...
Building dependency tree...
Reading state information...
The solver encountered an error of type: ERR_UNSOLVABLE
The following information might help you to understand what is wrong:
The following packages have unmet dependencies:
 linux-headers-phy:armhf : Depends: linux-kbuild-phy:armhf but it is
not installable or
linux-kbuild-phy-armhf-cross:armhf but it is not installable

Execute external solver...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sbuild-build-depends-main-dummy:armhf : Depends:
linux-headers-phy:armhf but it is not going to be installed
E: External solver failed with: The following packages have unmet
dependencies:
apt-get failed.


For full CI, the failed test case is citest.py:KernelTests.test_per_kernel.
Log follows:

20:17:33  (07/48)
/build/isar_wzh_devel_2/8/testsuite/citest.py:KernelTests.test_per_kernel:
STARTED
20:26:41  (07/48)
/build/isar_wzh_devel_2/8/testsuite/citest.py:KernelTests.test_per_kernel:
FAIL: Bitbake failed (547.80 s)

[stdlog] 2025-11-03 20:25:41,022 avocado.app cibuilder L0322 ERROR|
ERROR: mc:qemuarm64-bookworm:example-module-mainline-1.0-r0
do_dpkg_build:
ExecutionError('/build/isar_wzh_devel_2/8/build/tmp/work/debian-bookworm-arm64/example-module-mainline/1.0-r0/temp/run.dpkg_runbuild.3369904',
3, None, None)
[stdlog] 2025-11-03 20:25:41,022 avocado.test cibuilder L0320 INFO | Log
data follows:
[stdlog] 2025-11-03 20:25:41,022 avocado.app cibuilder L0322 ERROR|
ERROR: Logfile of failure stored in:
/build/isar_wzh_devel_2/8/build/tmp/work/debian-bookworm-arm64/example-module-mainline/1.0-r0/temp/log.do_dpkg_build.3369904
[stdlog] 2025-11-03 20:25:41,022 avocado.test cibuilder L0320 INFO | |
DEBUG: Executing python function sstate_task_prefunc
[stdlog] 2025-11-03 20:25:41,023 avocado.app cibuilder L0322 ERROR|
ERROR: Task
(mc:qemuarm64-bookworm:virtual:per-kernel:mainline:/build/isar_wzh_devel_2/8/meta-isar/recipes-kernel/example-module/example-module.bb:do_dpkg_build)
failed with exit code '1'

DEBUG: Executing python function sstate_task_prefunc
DEBUG: Python function sstate_task_prefunc finished
DEBUG: Executing python function do_dpkg_build
DEBUG: Executing shell function dpkg_schroot_create_configs
Creating
/etc/schroot/chroot.d/isar-builder-14a278ef-6154-47ed-818a-ce779ad05af2-476170
DEBUG: Shell function dpkg_schroot_create_configs finished
DEBUG: Executing shell function dpkg_runbuild
sbuild (Debian sbuild) 0.85.0 (04 January 2023) on ecf5e4d8eab2

+==============================================================================+
| example-module-mainline 1.0 (arm64)          Tue, 04 Nov 2025 09:09:25
+0000 |
+==============================================================================+

Package: example-module-mainline
Version: 1.0
Source Version: 1.0
Distribution: isar
Machine Architecture: amd64
Host Architecture: arm64
Build Architecture: amd64
Build Profiles: cross
Build Type: binary

I: NOTICE: Log filtering will replace
'var/run/schroot/mount/isar-builder-14a278ef-6154-47ed-818a-ce779ad05af2-476170-f0be66c4-3503-406e-a046-128e9596ef80'
with '<<CHROOT>>'

+------------------------------------------------------------------------------+
| Chroot Setup Commands             |
+------------------------------------------------------------------------------+


echo "Package: *\nPin: release n=isar\nPin-Priority: 1000" >
/etc/apt/preferences.d/isar-apt
--------------------------------------------------------------------------------------------


I: Finished running 'echo "Package: *\nPin: release
n=isar\nPin-Priority: 1000" > /etc/apt/preferences.d/isar-apt'.

echo "APT::Get::allow-downgrades 1;" > /etc/apt/apt.conf.d/50isar-apt
---------------------------------------------------------------------


I: Finished running 'echo "APT::Get::allow-downgrades 1;" >
/etc/apt/apt.conf.d/50isar-apt'.

rm -f /var/log/dpkg.log
-----------------------


I: Finished running 'rm -f /var/log/dpkg.log'.

mkdir -p /var/cache/apt/archives
--------------------------------


I: Finished running 'mkdir -p /var/cache/apt/archives'.

find /home/builder/example-module-mainline/rootfs/var/cache/apt/archives
-maxdepth 1 -name '*.deb' -exec ln -t /var/cache/apt/archives/ -sf {} +
------------------------------------------------------------------------------------------------------------------------------------------------


I: Finished running 'find
/home/builder/example-module-mainline/rootfs/var/cache/apt/archives
-maxdepth 1 -name '*.deb' -exec ln -t /var/cache/apt/archives/ -sf {} +'.

apt-get update -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" -o
Dir::Etc::SourceParts="-" -o APT::Get::List-Cleanup="0"
--------------------------------------------------------------------------------------------------------------------------------

Get:1 file:/isar-apt isar InRelease
Ign:1 file:/isar-apt isar InRelease
Get:2 file:/isar-apt isar Release [5087 B]
Get:2 file:/isar-apt isar Release [5087 B]
Get:3 file:/isar-apt isar Release.gpg
Ign:3 file:/isar-apt isar Release.gpg
Get:4 file:/isar-apt isar/main Sources [2834 B]
Get:5 file:/isar-apt isar/main armhf Packages [1532 B]
Get:6 file:/isar-apt isar/main arm64 Packages [2695 B]
Get:7 file:/isar-apt isar/main amd64 Packages [893 B]
Reading package lists...

I: Finished running 'apt-get update -o
Dir::Etc::SourceList="sources.list.d/isar-apt.list" -o
Dir::Etc::SourceParts="-" -o APT::Get::List-Cleanup="0"'.

Finished processing commands.
--------------------------------------------------------------------------------
I: NOTICE: Log filtering will replace
'build/example-module-mainline-Om9YZL/resolver-cMiwQg' with
'<<RESOLVERDIR>>'

+------------------------------------------------------------------------------+
| Update chroot             |
+------------------------------------------------------------------------------+

Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

+------------------------------------------------------------------------------+
| Fetch source files              |
+------------------------------------------------------------------------------+


Local sources
-------------

/work/build/tmp/work/debian-bookworm-arm64/example-module-mainline/1.0-r0/example-module-mainline_1.0.dsc
exists in
/work/build/tmp/work/debian-bookworm-arm64/example-module-mainline/1.0-r0;
copying to chroot
I: NOTICE: Log filtering will replace
'build/example-module-mainline-Om9YZL/example-module-mainline-1.0' with
'<<PKGBUILDDIR>>'
I: NOTICE: Log filtering will replace
'build/example-module-mainline-Om9YZL' with '<<BUILDDIR>>'

+------------------------------------------------------------------------------+
| Install package build dependencies              |
+------------------------------------------------------------------------------+


Setup apt archive
-----------------

Merged Build-Depends: debhelper-compat (= 13), linux-headers-mainline,
build-essential:amd64, fakeroot:amd64, crossbuild-essential-arm64:amd64,
libc-dev:arm64, libstdc++-dev:arm64
Filtered Build-Depends: debhelper-compat (= 13), linux-headers-mainline,
build-essential:amd64, fakeroot:amd64, crossbuild-essential-arm64:amd64,
libc-dev:arm64, libstdc++-dev:arm64
dpkg-deb: building package 'sbuild-build-depends-main-dummy' in
'/<<RESOLVERDIR>>/apt_archive/sbuild-build-depends-main-dummy.deb'.
Ign:1 copy:/<<RESOLVERDIR>>/apt_archive ./ InRelease
Get:2 copy:/<<RESOLVERDIR>>/apt_archive ./ Release [609 B]
Ign:3 copy:/<<RESOLVERDIR>>/apt_archive ./ Release.gpg
Get:4 copy:/<<RESOLVERDIR>>/apt_archive ./ Sources [713 B]
Get:5 copy:/<<RESOLVERDIR>>/apt_archive ./ Packages [756 B]
Fetched 2078 B in 0s (0 B/s)
Reading package lists...
Reading package lists...

Install main build dependencies (apt-based resolver)
----------------------------------------------------

Installing build dependencies
Reading package lists...
Building dependency tree...
Reading state information...
The solver encountered an error of type: ERR_UNSOLVABLE
The following information might help you to understand what is wrong:
The following packages have unmet dependencies:
 linux-headers-mainline:arm64 : Depends: linux-kbuild-mainline:arm64
but it is not installable or
 linux-kbuild-mainline-arm64-cross:arm64 but it is not installable

Execute external solver...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sbuild-build-depends-main-dummy:arm64 : Depends:
linux-headers-mainline:arm64 but it is not going to be installed
E: External solver failed with: The following packages have unmet
dependencies:
apt-get failed.
E: Package installation failed
Not removing build depends: cloned chroot in use
Reading package lists...
Building dependency tree...
Reading state information...
The solver encountered an error of type: ERR_UNSOLVABLE
The following information might help you to understand what is wrong:
The following packages have unmet dependencies:
 linux-headers-mainline:arm64 : Depends: linux-kbuild-mainline:arm64
but it is not installable or
 linux-kbuild-mainline-arm64-cross:arm64 but it is not installable

Execute external solver...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sbuild-build-depends-main-dummy:arm64 : Depends:
linux-headers-mainline:arm64 but it is not going to be installed
E: External solver failed with: The following packages have unmet
dependencies:
apt-get failed.


You can redo the test on your machine using avocado:
1. Have a clean clone of isar, checkout to branch next and apply your
patches:
$ git clone -b next https://github.com/ilbers/isar.git
$ cd isar
$ git am /path-to/0001-my-contribution-to-isar.patch
2. Disable several unrelated targets to make error appears faster, by
applying
the following diff:

diff --git a/testsuite/citest.py b/testsuite/citest.py
index 675015af..f573a9a7 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -197,13 +197,6 @@ class CrossTest(CIBaseTest):

     def test_cross(self):
         targets = [
-            'mc:qemuarm-buster:isar-image-ci',
-            'mc:qemuarm-bullseye:isar-image-ci',
-            'mc:de0-nano-soc-bullseye:isar-image-base',
-            'mc:stm32mp15x-bullseye:isar-image-base',
-            'mc:qemuarm-bookworm:isar-image-ci',
-            'mc:qemuarm64-focal:isar-image-base',
-            'mc:nanopi-neo-efi-bookworm:isar-image-base',
             'mc:phyboard-mira-bookworm:isar-image-base',
         ]

3.Run kas shell, setup CI prerequisites (avocado, qemu) and cleanup:
$ ./kas/kas-container shell kas/isar.yaml --command \
    "rm -rf /work/build/conf && /work/scripts/ci_setup.sh"
4.Run the failed test in fast:
$ cd /work/testsuite
$ avocado run citest.py:CrossTest.test_cross$
4.Run the failed test in full:
$ avocado run citest.py:KernelTests.test_per_kernel

Best regards,
Zhihang

MOESSBAUER, Felix

unread,
Nov 4, 2025, 9:20:26 AM (2 days ago) Nov 4
to isar-...@googlegroups.com, w...@ilbers.de, Niedermayr, BENEDIKT, Kiszka, Jan, cedric.h...@siemens.com
On Tue, 2025-11-04 at 13:25 +0100, Zhihang Wei wrote:
> Hi,
>
> The patch caused one test failed on fast CI, and another failed on full CI.
>
> For fast CI, the failed test case is citest.py:CrossTest.test_cross, when
> building target 'mc:phyboard-mira-bookworm:isar-image-base'. Log follows:

Hi, thanks for this report. Unfortunately I'm still not able to execute
the whole testsuite due to the issues reported in the other thread.

With the reproducer from below I was able to pin-point the issue.
Actually, it fails because the cross-profile variant of the kernel
build does not set the cross profile. This just worked previously, as
the cross profile was accidentally added for that special case as well
- which is no longer true.

The following patch fixes this for me. I'll add it to the series and
send a v2. Hopefully this will then pass the CI.

diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-
kernel/linux/linux-custom.inc
index f2892921..c3fe4fc1 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -221,6 +221,7 @@ def get_additional_build_profiles(d):

KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES',
'libcdev-arch-all', 'all\nMulti-Arch: foreign', 'any', d) }"
DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"
+DEB_BUILD_PROFILES:append:cross-profile = " cross"

Best regards,
Felix

>
> 21:11:12  (07/22)
> /build/isar_wzh_3_fast/21/testsuite/citest.py:CrossTest.test_cross: STARTED
> 21:52:04  (07/22)
> /build/isar_wzh_3_fast/21/testsuite/citest.py:CrossTest.test_cross:
> FAIL: Bitbake failed (2451.57 s)
>
> [stdlog] 2025-11-03 21:45:44,063 avocado.app cibuilder L0322 ERROR|
> ERROR: mc:phyboard-mira-bookworm:example-module-phy-1.0-r0
> do_dpkg_build:
> ExecutionError('/build/isar_wzh_3_fast/21/build/tmp/work/debian-bookworm-armhf/example-module-phy/1.0-r0/temp/run.dpkg_runbuild.2797715',
> 3, None, None)
> [stdlog] 2025-11-03 21:45:44,063 avocado.test cibuilder L0320 INFO | Log
> data follows:
> [stdlog] 2025-11-03 21:45:44,063 avocado.app cibuilder L0322 ERROR|
> ERROR: Logfile of failure stored in:
> /build/isar_wzh_3_fast/21/build/tmp/work/debian-bookworm-armhf/example-module-phy/1.0-r0/temp/log.do_dpkg_build.2797715
>
> DEBUG: Executing python function sstate_task_prefunc
> DEBUG: Python function sstate_task_prefunc finished
> DEBUG: Executing python function do_dpkg_build
> DEBUG: Executing shell function dpkg_schroot_create_configs
> Creating
> /etc/schroot/chroot.d/isar-jenkins-c83a1f30-2c3c-4e94-9101-7bae88f0c388-2797715
> DEBUG: Shell function dpkg_schroot_create_configs finished
> DEBUG: Executing shell function dpkg_runbuild
> sbuild (Debian sbuild) 0.85.0 (04 January 2023) on arqalyq.m.ilbers.de
>
>

--
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Felix Moessbauer

unread,
Nov 4, 2025, 10:45:06 AM (2 days ago) Nov 4
to isar-...@googlegroups.com, Felix Moessbauer, stefa...@siemens.com, jan.k...@siemens.com, Benedikt Niedermayr
When building a -native package, the cross profile must not be added as
otherwise stricter apt cache checks added in trixie trigger. It anyways
makes no sense to add the cross profile when BUILD_ARCH equals
PACKAGE_ARCH. Previously this check was implemented incorrectly, as the
build arch was compared to the DISTRO_ARCH, which is always the target
arch in isar terms. This resulted in the following error message in
sbuild:

E: The package cache was built for different architectures: amd64 vs arm64
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted
E: apt-get dist-upgrade failed

On bookworm, the incorrect check remained unnoticed, as apt did not have
the stricter checks yet.

Fixes: 872ef2e3 ("dpkg-base: Fix enabling of cross build profile")
Tested-by: Benedikt Niedermayr <benedikt....@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
meta/classes/dpkg-base.bbclass | 2 +-
meta/recipes-kernel/linux/linux-custom.inc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 4468a49a..d8287e8d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -146,7 +146,7 @@ dpkg_runbuild() {

def isar_deb_build_profiles(d):
deb_build_profiles = d.getVar('DEB_BUILD_PROFILES')
- if d.getVar('BUILD_ARCH') != d.getVar('DISTRO_ARCH'):
+ if d.getVar('BUILD_ARCH') != d.getVar('PACKAGE_ARCH'):
deb_build_profiles += ' cross'
return deb_build_profiles.strip()

diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index f2892921..01398697 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -109,7 +109,7 @@ KERNEL_NAME_PROVIDED ?= "${@ d.getVar('BPN').partition('linux-')[2]}"

# Determine cross-profile override
python() {
- if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")) and "class-native" not in d.getVar("OVERRIDES").split(":"):
+ if d.getVar('BUILD_ARCH') != d.getVar('PACKAGE_ARCH') and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")) and "class-native" not in d.getVar("OVERRIDES").split(":"):
d.appendVar("OVERRIDES", ":cross-profile")
}

--
2.51.0

Felix Moessbauer

unread,
Nov 4, 2025, 10:45:10 AM (2 days ago) Nov 4
to isar-...@googlegroups.com, Felix Moessbauer, stefa...@siemens.com, jan.k...@siemens.com, Benedikt Niedermayr
DPKG_ARCH=all packages are always build in their -native variant.
However, these packages still can have non-native dependencies which
must be built for the distro arch.

Fixes: 23a73895 ("multiarch: inject native variants of preferred providers")
Tested-by: Benedikt Niedermayr <benedikt....@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---

Jan Kiszka

unread,
Nov 4, 2025, 11:19:14 AM (2 days ago) Nov 4
to Felix Moessbauer, isar-...@googlegroups.com, stefa...@siemens.com, Benedikt Niedermayr
This looks like a separate patch, even if a dependency for this one. Or
would fixing linux-custom.inc not be possible before fixing dpkg-base?

MOESSBAUER, Felix

unread,
Nov 4, 2025, 1:24:08 PM (2 days ago) Nov 4
to isar-...@googlegroups.com, Kiszka, Jan, Niedermayr, BENEDIKT, Koch, Stefan
This needs to be fixed in a lockstep, as otherwise the :cross-profile
override and the DEB_BUILD_PROFILE = cross are not in sync.

Felix

>
> Jan
>
> --
> Siemens AG, Foundational Technologies
> Linux Expert Center

MOESSBAUER, Felix

unread,
3:47 AM (6 hours ago) 3:47 AM
to isar-...@googlegroups.com, Niedermayr, BENEDIKT, Schmidt, Adriaan, Kiszka, Jan, Koch, Stefan
I again see the same build error as reported by ... in the v1, but I
can only reproduce it in 100% clean CI runs with just that target. To
me it looks like the linux-kbuild-phy:arm64 package is still lingering
around in some cache which hides the error.

Anyways, back to the error:

I'm pretty sure we now model the build-dependency chain of packages
correctly, however it looks like the build of the kbuild-<kernel>
package has logical errors:

Currently, the linux-kbuild-phy is generated from linux-phy-native, but
for the host architecture (instead of the target architecture). This is
correct from bitbake perspective, but incorrect from debian
perspective, as the module needs the kbuild-<> package for the target
architecture.

IOW, currently we have the following situation:

- linux-<name> generates the image and headers for the target arch
(arm64)
- linux-<name>-native generates the kbuild package in the host arch
(amd64)

All that is correct, but not helpful. In the past, we generated an
architecture specific package from a -native recipe - which IMHO is
plain wrong.

To move forward, someone familiar with the linux-custom recipe needs to
have a look and model the overrides correctly. We further need to
clearly state which profile does what in human readable terms.

Felix

> }
>
> --
> 2.51.0

Andreas Naumann

unread,
6:08 AM (3 hours ago) 6:08 AM
to Felix Moessbauer, isar-...@googlegroups.com, stefa...@siemens.com, jan.k...@siemens.com, Benedikt Niedermayr
Hi Felix,

Am 04.11.25 um 16:44 schrieb 'Felix Moessbauer' via isar-users:
> DPKG_ARCH=all packages are always build in their -native variant.
> However, these packages still can have non-native dependencies which
> must be built for the distro arch.
For me, this doesnt fix the testcase which I posted in my set on monday.
So I'm surprised that it does for you, at least that's what i understood
from your reply there. I was afraid gss wouldn't fail crosscompiling
in trixie, but it does, at least for arm64.

Now I reread your description carefully and assume it fixes something else
than I had in mind. So short of info what the actual problem with

23a73895 ("multiarch: inject native variants of preferred providers")

was, could you state it again? Do you have a specific testcase for it?

regards,
Andreas
Andreas Naumann

emlix GmbH
Headquarters: Berliner Str. 12, 37073 Goettingen, Germany
Phone +49 (0)551 30664-0, e-mail in...@emlix.com
District Court of Goettingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com

MOESSBAUER, Felix

unread,
7:13 AM (2 hours ago) 7:13 AM
to isar-...@googlegroups.com, anau...@emlix.com, Niedermayr, BENEDIKT, Kiszka, Jan, Koch, Stefan
On Thu, 2025-11-06 at 12:07 +0100, Andreas Naumann wrote:
> Hi Felix,
>
> Am 04.11.25 um 16:44 schrieb 'Felix Moessbauer' via isar-users:
> > DPKG_ARCH=all packages are always build in their -native variant.
> > However, these packages still can have non-native dependencies which
> > must be built for the distro arch.
> For me, this doesnt fix the testcase which I posted in my set on monday.
> So I'm surprised that it does for you, at least that's what i understood
> from your reply there. I was afraid gss wouldn't fail crosscompiling
> in trixie, but it does, at least for arm64.

There are currently so many moving bits (patches, kas bookworm vs kas
trixie environments, ...) it is hard to say what exactly worked and
what didn't.


> Now I reread your description carefully and assume it fixes something else
> than I had in mind. So short of info what the actual problem with
>
> 23a73895 ("multiarch: inject native variants of preferred providers")
>
> was, could you state it again? Do you have a specific testcase for it?

This problem was spotted in isar-cip-core when applying the
DPKG_ARCH=all transitive deps patch [1]. The problem hereby is that we
can no longer prefer-provide on the non native variant of a
DPKG_ARCH=all package. An example error message looks like the
following:

ERROR: Multiple .bb files are due to be built which each provide
secure-boot-secrets:
/work/build/../../repo/recipes-devtools/secure-boot-secrets/secure-
boot-snakeoil_0.3.bb
/work/build/../../repo/recipes-devtools/secure-boot-secrets/secure-
boot-key_0.2.bb
A list of tasks depending on these providers is shown and may help
explain where the dependency comes from.


Example kas file:

diff --git a/kas-cip.yml b/kas-cip.yml
index d76d6d94..4b18856d 100644
--- a/kas-cip.yml
+++ b/kas-cip.yml
@@ -22,7 +22,7 @@ repos:
isar:
url: https://github.com/ilbers/isar.git
- commit: d63a1cbae6f737aa843d00d8812547fe7b87104a
+ commit: 5a7c2f70045a27fe4073fa987ef07fe628062708
layers:
meta:

[1]
https://github.com/ilbers/isar/commit/5a7c2f70045a27fe4073fa987ef07fe628062708


Best regards,
Felix

Felix Moessbauer

unread,
9:11 AM (21 minutes ago) 9:11 AM
to isar-...@googlegroups.com, stefa...@siemens.com, jan.k...@siemens.com, anau...@emlix.com, Felix Moessbauer
We introduce custom profiles to control which packages are build from a
custom kernel source package. To avoid collisions with upstream profile
names, we have to use BuildProfileSpec compatible profile names [1].

[1] https://wiki.debian.org/BuildProfileSpec#Registered_profile_names

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
.../linux/files/debian/control.tmpl | 16 ++++++++--------
.../linux/files/debian/isar/install.tmpl | 2 +-
meta/recipes-kernel/linux/linux-custom.inc | 17 +++++++++--------
3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index 78e95105..01b1a63f 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -1,4 +1,4 @@
-Source: linux-${KERNEL_NAME_PROVIDED}
+Source: ${BPN}
Section: kernel
Priority: optional
Maintainer: ${MAINTAINER}
@@ -7,7 +7,7 @@ Homepage: http://www.kernel.org/
Rules-Requires-Root: no

Package: linux-image-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <kernel>
+Build-Profiles: <pkg.${BPN}.kernel>
Architecture: any
Depends: ${KERNEL_DEBIAN_DEPENDS}
Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
@@ -15,7 +15,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@
files, version: @KR@.

Package: linux-headers-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <kernel>
+Build-Profiles: <pkg.${BPN}.kernel>
Architecture: any
Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlibs:Depends}
Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
@@ -24,7 +24,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@
This is useful for people who need to build external modules

Package: linux-libc-dev
-Build-Profiles: <!nolibcdev kernel>
+Build-Profiles: <!pkg.${BPN}.nolibcdev pkg.${BPN}.kernel>
Section: devel
Provides: linux-kernel-headers
Architecture: ${KERNEL_LIBC_DEV_ARCH}
@@ -33,7 +33,7 @@ Description: Linux support headers for userspace development
are used by the installed headers for GNU glibc and other system libraries.

Package: linux-libc-dev-${DISTRO_ARCH}-cross
-Build-Profiles: <!nolibcdev cross !kbuild>
+Build-Profiles: <!pkg.${BPN}.nolibcdev cross !pkg.${BPN}.kbuild>
Section: devel
Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
Architecture: all
@@ -45,7 +45,7 @@ Description: Linux Kernel Headers for development (for cross-compiling)
your kernel. Use linux-headers-* packages for that.

Package: linux-image-${KERNEL_NAME_PROVIDED}-dbg
-Build-Profiles: <kernel>
+Build-Profiles: <pkg.${BPN}.kernel>
Section: debug
Architecture: any
Description: Linux kernel debugging symbols for @KR@
@@ -53,7 +53,7 @@ Description: Linux kernel debugging symbols for @KR@
all the necessary debug symbols for the kernel and its modules.

Package: linux-kbuild-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <kbuild !cross>
+Build-Profiles: <pkg.${BPN}.kbuild !cross>
Architecture: any
Depends: ${perl:Depends}, ${shlibs:Depends}
Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
@@ -61,7 +61,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
This is useful for people who need to build external modules

Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross
-Build-Profiles: <kbuild cross>
+Build-Profiles: <pkg.${BPN}.kbuild cross>
Architecture: any
Multi-Arch: foreign
Depends: ${perl:Depends}, ${shlibs:Depends}
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
index fe0bd810..a1b00d39 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
@@ -168,7 +168,7 @@ headers_check() {
libc_headers() {
mkdir -p ${deb_libc_hdr_dir}
arches="${DISTRO_ARCH}"
- if echo "${DEB_BUILD_PROFILES}" | grep -q "libcdev-arch-all"; then
+ if echo "${DEB_BUILD_PROFILES}" | grep -q "pkg.${BPN}.libcdev-arch-all"; then
arches="amd64 armhf arm64 i386 mipsel riscv64"
fi
for distro_arch in ${arches}; do
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index f2892921..1f46bb31 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -28,7 +28,7 @@ KBUILD_DEPENDS ?= "build-essential:native, \
flex, \
git, \
kmod, \
- linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <kbuild !kernel>, \
+ linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <pkg.${BPN}.kbuild !pkg.${BPN}.kernel>, \
rsync,"

KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, \
@@ -73,6 +73,7 @@ TEMPLATE_FILES += " \
"

TEMPLATE_VARS += " \
+ BPN \
KBUILD_DEPENDS \
KERNEL_ARCH \
KERNEL_DEBIAN_DEPENDS \
@@ -114,17 +115,17 @@ python() {
}

# Default profiles and provides
-BUILD_PROFILES = "kernel kbuild"
+BUILD_PROFILES = "pkg.${BPN}.kernel pkg.${BPN}.kbuild"

# We only offer the -kbuildtarget variant when actually cross compiling
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 = "kernel"
+BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"

# -native: kbuild package for host
-BUILD_PROFILES:class-native = "kbuild"
+BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
RECIPE_PROVIDES:class-native = " \
linux-headers-${KERNEL_NAME_PROVIDED} \
linux-kbuild-${KERNEL_NAME_PROVIDED}"
@@ -135,7 +136,7 @@ RECIPE_PROVIDES:class-native = " \
DEPENDS:class-native += "${BPN}-pseudo"

# -kbuildtarget: kbuild package for target, enforcing non-cross-build
-BUILD_PROFILES:class-kbuildtarget = "kbuild"
+BUILD_PROFILES:class-kbuildtarget = "pkg.${BPN}.kbuild"
RECIPE_PROVIDES:class-kbuildtarget = " \
linux-headers-${KERNEL_NAME_PROVIDED} \
linux-kbuild-${KERNEL_NAME_PROVIDED}"
@@ -214,12 +215,12 @@ def config_fragments(d):
def get_additional_build_profiles(d):
profiles = d.getVar('BASE_DISTRO')
if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')):
- profiles += ' nolibcdev'
+ profiles += ' pkg.{}.nolibcdev'.format(d.getVar('BPN'))
elif bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_ARCH_ALL')):
- profiles += ' libcdev-arch-all'
+ profiles += ' pkg.{}.libcdev-arch-all'.format(d.getVar('BPN'))
return profiles

-KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'libcdev-arch-all', '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', 'any', d) }"
DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"

do_prepare_build:prepend() {
--
2.39.5

Felix Moessbauer

unread,
9:11 AM (21 minutes ago) 9:11 AM
to isar-...@googlegroups.com, stefa...@siemens.com, jan.k...@siemens.com, anau...@emlix.com, Felix Moessbauer
Changes since v2:

Fix root cause of linux-module build errors on cross:
The previous linux-custom recipe used the cross profile also to control
which packages are built in a cross setting, which is fundamentally wrong.
We now split this custom profile off the official one and attach it to the
cross-profile logic of linux-custom (which refers to "we are in a
HOST_ARCH != DISTRO_ARCH setting" instead of we are cross-compiling this
package). The cleanup is done in two stages: First, we properly prefix
all used custom build profiles according to the build profile spec (p1),
second we split off the cross profile (p2).

@Stefan: It would be great if you could test this series on your original
use case.

Best regards,
Felix

Felix Moessbauer (2):
linux-custom: prefix profile names according to BuildProfileSpec
linux-custom: fix name collision on cross profile
do not add cross profile when building native package
propagate distro-specific dependencies of arch all packages

meta/classes/dpkg-base.bbclass | 2 +-
meta/classes/multiarch.bbclass | 10 ++++---
.../linux/files/debian/control.tmpl | 16 +++++------
.../linux/files/debian/isar/install.tmpl | 2 +-
meta/recipes-kernel/linux/linux-custom.inc | 27 ++++++++++++-------
5 files changed, 33 insertions(+), 24 deletions(-)

--
2.39.5

Felix Moessbauer

unread,
9:11 AM (21 minutes ago) 9:11 AM
to isar-...@googlegroups.com, stefa...@siemens.com, jan.k...@siemens.com, anau...@emlix.com, Felix Moessbauer
The cross build profile is currently used to control which packages are
built in a DISTRO_ARCH != HOST_ARCH scenario. This is fundamentally
wrong, as the cross profile is one of the standard debian build profiles
which is used to control if sbuild runs in cross mode. Further, the
build profile spec [1] forbids to conditionally generate binary packages
based on this profile. We now split this profile off into a custom one
to not interfere with the standard cross profile.

Due to the split, we now also need to set our cross profile explicitly
in the desired cases, which we now control via the cross-pkgs overrides.
meta/recipes-kernel/linux/files/debian/control.tmpl | 6 +++---
meta/recipes-kernel/linux/linux-custom.inc | 10 ++++++++--
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index 01b1a63f..ee87cf92 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -33,7 +33,7 @@ Description: Linux support headers for userspace development
are used by the installed headers for GNU glibc and other system libraries.

Package: linux-libc-dev-${DISTRO_ARCH}-cross
-Build-Profiles: <!pkg.${BPN}.nolibcdev cross !pkg.${BPN}.kbuild>
+Build-Profiles: <!pkg.${BPN}.nolibcdev pkg.${BPN}.cross !pkg.${BPN}.kbuild>
Section: devel
Provides: linux-kernel-headers-${DISTRO_ARCH}-cross
Architecture: all
@@ -53,7 +53,7 @@ Description: Linux kernel debugging symbols for @KR@
all the necessary debug symbols for the kernel and its modules.

Package: linux-kbuild-${KERNEL_NAME_PROVIDED}
-Build-Profiles: <pkg.${BPN}.kbuild !cross>
+Build-Profiles: <pkg.${BPN}.kbuild !pkg.${BPN}.cross>
Architecture: any
Depends: ${perl:Depends}, ${shlibs:Depends}
Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
@@ -61,7 +61,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @KR@
This is useful for people who need to build external modules

Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross
-Build-Profiles: <pkg.${BPN}.kbuild cross>
+Build-Profiles: <pkg.${BPN}.kbuild pkg.${BPN}.cross>
Architecture: any
Multi-Arch: foreign
Depends: ${perl:Depends}, ${shlibs:Depends}
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 1f46bb31..9dd9abb5 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -110,8 +110,13 @@ KERNEL_NAME_PROVIDED ?= "${@ d.getVar('BPN').partition('linux-')[2]}"

# Determine cross-profile override
python() {
- if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")) and "class-native" not in d.getVar("OVERRIDES").split(":"):
- d.appendVar("OVERRIDES", ":cross-profile")
+ if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")):
+ 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")
}

# Default profiles and provides
@@ -126,6 +131,7 @@ BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel"

# -native: kbuild package for host
BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild"
+BUILD_PROFILES:append:cross-pkgs = " pkg.${BPN}.cross"
RECIPE_PROVIDES:class-native = " \
linux-headers-${KERNEL_NAME_PROVIDED} \
linux-kbuild-${KERNEL_NAME_PROVIDED}"
--
2.39.5

Felix Moessbauer

unread,
9:11 AM (21 minutes ago) 9:11 AM
to isar-...@googlegroups.com, stefa...@siemens.com, jan.k...@siemens.com, anau...@emlix.com, Felix Moessbauer, Benedikt Niedermayr
When building a -native package, the cross profile must not be added as
otherwise stricter apt cache checks added in trixie trigger. It anyways
makes no sense to add the cross profile when BUILD_ARCH equals
PACKAGE_ARCH. Previously this check was implemented incorrectly, as the
build arch was compared to the DISTRO_ARCH, which is always the target
arch in isar terms. This resulted in the following error message in
sbuild:

E: The package cache was built for different architectures: amd64 vs arm64
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted
E: apt-get dist-upgrade failed

On bookworm, the incorrect check remained unnoticed, as apt did not have
the stricter checks yet.

Fixes: 872ef2e3 ("dpkg-base: Fix enabling of cross build profile")
Tested-by: Benedikt Niedermayr <benedikt....@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
meta/classes/dpkg-base.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 4468a49a..d8287e8d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -146,7 +146,7 @@ dpkg_runbuild() {

def isar_deb_build_profiles(d):
deb_build_profiles = d.getVar('DEB_BUILD_PROFILES')
- if d.getVar('BUILD_ARCH') != d.getVar('DISTRO_ARCH'):
+ if d.getVar('BUILD_ARCH') != d.getVar('PACKAGE_ARCH'):
deb_build_profiles += ' cross'
return deb_build_profiles.strip()

--
2.39.5

Felix Moessbauer

unread,
9:11 AM (21 minutes ago) 9:11 AM
to isar-...@googlegroups.com, stefa...@siemens.com, jan.k...@siemens.com, anau...@emlix.com, Felix Moessbauer, Benedikt Niedermayr
DPKG_ARCH=all packages are always build in their -native variant.
However, these packages still can have non-native dependencies which
must be built for the distro arch.

Fixes: 23a73895 ("multiarch: inject native variants of preferred providers")
Tested-by: Benedikt Niedermayr <benedikt....@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
meta/classes/multiarch.bbclass | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
index c2bba21f..74b8f5b8 100644
--- a/meta/classes/multiarch.bbclass
+++ b/meta/classes/multiarch.bbclass
@@ -106,11 +106,13 @@ python multiarch_virtclass_handler() {
# Arch=all packages might build depend on other arch=all packages,
# hence we need to correctly model the dependency chain.
# We implement this by dispatching the non-native variant to the -native
- # variant by adding a dependency. We further replace the non-native
- # do_deploy_dep task with a noop to preserve the dependency chain.
+ # variant by adding a dependency. We further empty the non-native
+ # do_deploy_dep task and clear the internal dependency chain, but keep
+ # other attached variables like RDEPENDS to preserve the dependency chain.
e.data.setVar('do_deploy_deb', '')
- bb.build.deltask('deploy_deb', e.data)
- bb.build.addtask('deploy_deb', 'do_build', '', e.data)
+ # clear internal dependencies (e.g. to do_dpkg_build)
+ e.data.setVarFlag('do_deploy_deb', 'deps', [])
+ # dispatch to native variant
e.data.setVarFlag('do_deploy_deb', 'depends', f'{pn}-native:do_deploy_deb')
}
addhandler multiarch_virtclass_handler
--
2.39.5

Reply all
Reply to author
Forward
0 new messages