[PATCH 1/7] Revert "base: Fix HOST_ARCH for native builds"

21 views
Skip to first unread message

Jan Kiszka

unread,
Oct 5, 2023, 2:32:07 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

This reverts commit 7bc68bb27f562257977bb5f701564ab08d4c5b3a.

It was the wrong assumption that HOST_ARCH should depend on
ISAR_CROSS_COMPILE - too much code assumes that it is statically bound
to the builder machine. Instead, code that needs effective builder
arch should use BUILD_HOST_ARCH.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/base.bbclass | 6 ++----
meta/classes/imagetypes.bbclass | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index f315a9d5..88004120 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -49,15 +49,13 @@ def oe_import(d):
# We need the oe module name space early (before INHERITs get added)
OE_IMPORTED := "${@oe_import(d)}"

-def get_deb_host_arch(d):
+def get_deb_host_arch():
import subprocess
- if d.getVar("ISAR_CROSS_COMPILE") != "1":
- return d.getVar("DISTRO_ARCH")
host_arch = subprocess.check_output(
["dpkg", "--print-architecture"]
).decode('utf-8').strip()
return host_arch
-HOST_ARCH ??= "${@get_deb_host_arch(d)}"
+HOST_ARCH ??= "${@get_deb_host_arch()}"
HOST_DISTRO ??= "${DISTRO}"

die() {
diff --git a/meta/classes/imagetypes.bbclass b/meta/classes/imagetypes.bbclass
index 205377b1..a3be0a1d 100644
--- a/meta/classes/imagetypes.bbclass
+++ b/meta/classes/imagetypes.bbclass
@@ -65,10 +65,8 @@ UBIFS_IMG ?= "${PP_DEPLOY}/${IMAGE_FULLNAME}.ubifs"

# glibc bug 23960 https://sourceware.org/bugzilla/show_bug.cgi?id=23960
# should not use QEMU on armhf target with mkfs.ubifs < v2.1.3
-python() {
- if d.getVar('DISTRO_ARCH') == 'armhf' and bb.utils.contains('IMAGE_BASETYPES', 'ubifs', True, False, d):
- d.setVar('ISAR_CROSS_COMPILE', '1')
-}
+THIS_ISAR_CROSS_COMPILE := "${ISAR_CROSS_COMPILE}"
+ISAR_CROSS_COMPILE:armhf = "${@bb.utils.contains('IMAGE_BASETYPES', 'ubifs', '1', '${THIS_ISAR_CROSS_COMPILE}', d)}"

IMAGE_CMD:ubifs() {
${SUDO_CHROOT} /usr/sbin/mkfs.ubifs ${MKUBIFS_ARGS} \
--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:07 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

When a package that has -native build dependencies is forced into
non-cross building using qemu-user (ie. build arch != distro arch), its
dependency installation will generally fail. That is because
somedep-native will build somedep for the builder arch, not for the
distro arch that is needed during native builds.

Address that automatically by downgrading any such recipe dependency by
stripping for '-native'.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/multiarch.bbclass | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
index c1846ab0..48cec9ab 100644
--- a/meta/classes/multiarch.bbclass
+++ b/meta/classes/multiarch.bbclass
@@ -21,6 +21,18 @@ python() {
d.appendVar('PROVIDES', f' {pn}-native')
else:
d.appendVar('BBCLASSEXTEND', ' native')
+
+ # drop own -native build dependencies at recipe level if building natively
+ # and not for the builder architecture
+ depends = d.getVar('DEPENDS')
+ if depends is not None and d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH') \
+ and d.getVar('ISAR_CROSS_COMPILE') != '1':
+ new_deps = []
+ for dep in depends.split():
+ if dep.endswith('-native'):
+ dep = dep[:-7]
+ new_deps.append(dep)
+ d.setVar('DEPENDS', ' '.join(new_deps))
}

python multiarch_virtclass_handler() {
--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:07 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

Avoids the need to fiddle with the PACKAGE_ARCH in this recipe.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb | 4 ++--
.../jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb | 3 ---
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
index a3258e42..dbce7c28 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
@@ -8,8 +8,8 @@ inherit dpkg
SRC_URI = "file://rules file://install"

DESCRIPTION = "StarFive VisionFive 2 u-boot SPL"
-DEPENDS = "jh7110-u-boot-spl-tool u-boot-starfive-visionfive2"
-DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool, u-boot-starfive-visionfive2:${DISTRO_ARCH}"
+DEPENDS = "jh7110-u-boot-spl-tool-native u-boot-starfive-visionfive2"
+DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool:native, u-boot-starfive-visionfive2:${DISTRO_ARCH}"

# this is a host tool
PACKAGE_ARCH = "${HOST_ARCH}"
diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
index fefcbf66..292334f6 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
@@ -13,9 +13,6 @@ SRCREV = "8c5acc4e5eb7e4ad012463b05a5e3dbbfed1c38d"

S = "${WORKDIR}/tools/spl_tool"

-# This is a host tool
-PACKAGE_ARCH = "${HOST_ARCH}"
-
do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build(){
deb_debianize
--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:07 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

In general, recipes must not use HOST_ARCH because it does not account
for ISAR_CROSS_COMPILE being enabled or disabled. This is encoded into
BUILD_HOST_ARCH, though.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
index dbce7c28..cd31c9ca 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
@@ -12,7 +12,7 @@ DEPENDS = "jh7110-u-boot-spl-tool-native u-boot-starfive-visionfive2"
DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool:native, u-boot-starfive-visionfive2:${DISTRO_ARCH}"

# this is a host tool
-PACKAGE_ARCH = "${HOST_ARCH}"
+PACKAGE_ARCH = "${BUILD_HOST_ARCH}"

do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build(){
--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:07 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
This first of all reverts my incorrect changes to HOST_ARCH. It then
tries to resolve the native build issues of the visionfive2, fixing some
remaining corner case of -native usage:

If package A has B-native as build dependency but is then compiled
without cross-building, using qemu-user instead, it will incorrectly
request the build of B:, rather than B:. This
is resolved automatically now, and the solution is used for the
visionfive2.

For that board to build again, we also need to switch from sid-ports to
sid, for riscv64 in general.

Jan

Jan Kiszka (7):
Revert "base: Fix HOST_ARCH for native builds"
multiarch: Downgrade native dependencies when building in emulated
environment
meta-isar: jh7110-u-boot-spl-tool: Rely on native annotation
meta-isar: jh7110-u-boot-spl-image: Fix native build
meta-isar: u-boot-starfive-visionfive2: Simplify build dependencies
linux-custom: Drop unused template variable
Move riscv64 from sid-ports to regular sid

kas/distro/Kconfig | 6 +++---
.../{debian-sid-ports.yaml => debian-sid.yaml} | 2 +-
kas/machine/Kconfig | 6 +++---
meta-isar/conf/mc.conf | 6 +++---
...muriscv64-sid-ports.conf => qemuriscv64-sid.conf} | 2 +-
...ve-fu540-sid-ports.conf => sifive-fu540-sid.conf} | 2 +-
...-sid-ports.conf => starfive-visionfive2-sid.conf} | 2 +-
.../jh7110-u-boot-spl-image_0.1.bb | 6 +++---
.../jh7110-u-boot-spl-tool_0.1.bb | 3 ---
.../u-boot-starfive-visionfive2_2021.10+VF2-3.0.4.bb | 4 +---
meta/classes/base.bbclass | 6 ++----
meta/classes/imagetypes.bbclass | 6 ++----
meta/classes/multiarch.bbclass | 12 ++++++++++++
meta/recipes-kernel/linux/linux-custom.inc | 1 -
testsuite/citest.py | 6 +++---
15 files changed, 36 insertions(+), 34 deletions(-)
rename kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} (78%)
rename meta-isar/conf/multiconfig/{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} (85%)
rename meta-isar/conf/multiconfig/{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} (76%)
rename meta-isar/conf/multiconfig/{starfive-visionfive2-sid-ports.conf => starfive-visionfive2-sid.conf} (78%)

--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:08 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

This was never used, in fact.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/recipes-kernel/linux/linux-custom.inc | 1 -
1 file changed, 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 1897116c..09fb5c85 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -70,7 +70,6 @@ TEMPLATE_FILES += " \
"

TEMPLATE_VARS += " \
- HOST_ARCH \
KBUILD_DEPENDS \
KERNEL_ARCH \
KERNEL_DEBIAN_DEPENDS \
--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:08 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

At the risk of adding the same package twice, but apt will be resolve
that, just follow the pattern of others: :native for the build env,
without any suffix for the target.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../u-boot/u-boot-starfive-visionfive2_2021.10+VF2-3.0.4.bb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2021.10+VF2-3.0.4.bb b/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2021.10+VF2-3.0.4.bb
index 455bee4a..9e1b7251 100644
--- a/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2021.10+VF2-3.0.4.bb
+++ b/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2021.10+VF2-3.0.4.bb
@@ -8,9 +8,7 @@ require recipes-bsp/u-boot/u-boot-custom.inc
SRC_URI += "git://github.com/starfive-tech/u-boot.git;nobranch=1;protocol=https;destsuffix=u-boot-${PV}"
SRCREV = "b6e2b0e85c774a18ae668223a6e5f7d335895243"

-DEBIAN_BUILD_DEPENDS .= ", libssl-dev:${DISTRO_ARCH}"
-# when cross compiling, we need the library on the host as well, as the signature computation is done locally
-DEBIAN_BUILD_DEPENDS .= "${@ ', libssl-dev:${HOST_ARCH}' if d.getVar('ISAR_CROSS_COMPILE') == '1' else '' }"
+DEBIAN_BUILD_DEPENDS .= ", libssl-dev, libssl-dev:native"

U_BOOT_CONFIG = "starfive_visionfive2_defconfig"
U_BOOT_BIN = "u-boot.bin"
--
2.35.3

Jan Kiszka

unread,
Oct 5, 2023, 2:32:08 PM10/5/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely
From: Jan Kiszka <jan.k...@siemens.com>

Now that riscv64 is an official Debian arch, sid-ports runs out of sync
with sid. It seems that sid is generally building riscv64 fine, but
cross-compilation will remain broken for a longer while.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
kas/distro/Kconfig | 6 +++---
kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} | 2 +-
kas/machine/Kconfig | 6 +++---
meta-isar/conf/mc.conf | 6 +++---
.../{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} | 2 +-
.../{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} | 2 +-
...onfive2-sid-ports.conf => starfive-visionfive2-sid.conf} | 2 +-
testsuite/citest.py | 6 +++---
8 files changed, 16 insertions(+), 16 deletions(-)
rename kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} (78%)
rename meta-isar/conf/multiconfig/{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} (85%)
rename meta-isar/conf/multiconfig/{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} (76%)
rename meta-isar/conf/multiconfig/{starfive-visionfive2-sid-ports.conf => starfive-visionfive2-sid.conf} (78%)

diff --git a/kas/distro/Kconfig b/kas/distro/Kconfig
index bd762a98..5118dff4 100644
--- a/kas/distro/Kconfig
+++ b/kas/distro/Kconfig
@@ -19,8 +19,8 @@ config DEBIAN_BULLSEYE
config DEBIAN_BOOKWORM
bool "Debian Bookworm (12)"

-config DEBIAN_SID_PORTS
- bool "Debian Sid (unstable) with unofficial ports"
+config DEBIAN_SID
+ bool "Debian Sid (unstable)"

config RASPIOS_BULLSEYE
bool "Raspi OS Bullseye (11)"
@@ -38,7 +38,7 @@ config KAS_INCLUDE_DISTRO
default "kas/distro/debian-buster.yaml" if DEBIAN_BUSTER
default "kas/distro/debian-bullseye.yaml" if DEBIAN_BULLSEYE
default "kas/distro/debian-bookworm.yaml" if DEBIAN_BOOKWORM
- default "kas/distro/debian-sid-ports.yaml" if DEBIAN_SID_PORTS
+ default "kas/distro/debian-sid.yaml" if DEBIAN_SID
default "kas/distro/raspios-bullseye.yaml" if RASPIOS_BULLSEYE
default "kas/distro/ubuntu-focal.yaml" if UBUNTU_FOCAL
default "kas/distro/ubuntu-jammy.yaml" if UBUNTU_JAMMY
diff --git a/kas/distro/debian-sid-ports.yaml b/kas/distro/debian-sid.yaml
similarity index 78%
rename from kas/distro/debian-sid-ports.yaml
rename to kas/distro/debian-sid.yaml
index 52993646..43f1c696 100644
--- a/kas/distro/debian-sid-ports.yaml
+++ b/kas/distro/debian-sid.yaml
@@ -4,4 +4,4 @@
header:
version: 14

-distro: debian-sid-ports
+distro: debian-sid
diff --git a/kas/machine/Kconfig b/kas/machine/Kconfig
index 66debfe5..d0e3963a 100644
--- a/kas/machine/Kconfig
+++ b/kas/machine/Kconfig
@@ -68,7 +68,7 @@ config MACHINE_QEMU_MIPSEL

config MACHINE_QEMU_RISCV64
bool "qemuriscv64"
- depends on DEBIAN_SID_PORTS
+ depends on DEBIAN_SID

config MACHINE_RPI_ARM_V7
bool "rpi-arm-v7"
@@ -88,11 +88,11 @@ config MACHINE_RPI_ARM64_V8

config MACHINE_SIFIVE_FU540
bool "sifive-fu540"
- depends on DEBIAN_SID_PORTS
+ depends on DEBIAN_SID

config MACHINE_STARFIVE_VISIONFIVE2
bool "starfive-visionfive2"
- depends on DEBIAN_SID_PORTS
+ depends on DEBIAN_SID

config MACHINE_STM32MP15X
bool "stm32mp15x"
diff --git a/meta-isar/conf/mc.conf b/meta-isar/conf/mc.conf
index 9637bcb1..d16f54b5 100644
--- a/meta-isar/conf/mc.conf
+++ b/meta-isar/conf/mc.conf
@@ -25,7 +25,7 @@ BBMULTICONFIG = " \
qemumipsel-buster \
qemumipsel-bullseye \
qemumipsel-bookworm \
- qemuriscv64-sid-ports \
+ qemuriscv64-sid \
bananapi-buster \
bananapi-bullseye \
de0-nano-soc-buster \
@@ -45,8 +45,8 @@ BBMULTICONFIG = " \
rpi-arm-v7-bullseye \
rpi-arm-v7l-bullseye \
rpi-arm64-v8-bullseye \
- sifive-fu540-sid-ports \
- starfive-visionfive2-sid-ports \
+ sifive-fu540-sid \
+ starfive-visionfive2-sid \
qemuarm64-focal \
qemuarm64-jammy \
qemuamd64-focal \
diff --git a/meta-isar/conf/multiconfig/qemuriscv64-sid-ports.conf b/meta-isar/conf/multiconfig/qemuriscv64-sid.conf
similarity index 85%
rename from meta-isar/conf/multiconfig/qemuriscv64-sid-ports.conf
rename to meta-isar/conf/multiconfig/qemuriscv64-sid.conf
index 2556cf7f..bc691b5b 100644
--- a/meta-isar/conf/multiconfig/qemuriscv64-sid-ports.conf
+++ b/meta-isar/conf/multiconfig/qemuriscv64-sid.conf
@@ -5,4 +5,4 @@
# SPDX-License-Identifier: MIT

MACHINE ?= "qemuriscv64"
-DISTRO ?= "debian-sid-ports"
+DISTRO ?= "debian-sid"
diff --git a/meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf b/meta-isar/conf/multiconfig/sifive-fu540-sid.conf
similarity index 76%
rename from meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf
rename to meta-isar/conf/multiconfig/sifive-fu540-sid.conf
index 313032ef..99bb7f3e 100644
--- a/meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf
+++ b/meta-isar/conf/multiconfig/sifive-fu540-sid.conf
@@ -4,4 +4,4 @@
# SPDX-License-Identifier: MIT

MACHINE ?= "sifive-fu540"
-DISTRO ?= "debian-sid-ports"
+DISTRO ?= "debian-sid"
diff --git a/meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf b/meta-isar/conf/multiconfig/starfive-visionfive2-sid.conf
similarity index 78%
rename from meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf
rename to meta-isar/conf/multiconfig/starfive-visionfive2-sid.conf
index ee42ab4d..603e891f 100644
--- a/meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf
+++ b/meta-isar/conf/multiconfig/starfive-visionfive2-sid.conf
@@ -4,4 +4,4 @@
# SPDX-License-Identifier: MIT

MACHINE ?= "starfive-visionfive2"
-DISTRO ?= "debian-sid-ports"
+DISTRO ?= "debian-sid"
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 7304efe6..81bdeba5 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -227,10 +227,10 @@ class NoCrossTest(CIBaseTest):
except:
self.cancel('KFAIL')

- def test_nocross_sidports(self):
+ def test_nocross_sid(self):
targets = [
- 'mc:qemuriscv64-sid-ports:isar-image-base',
- 'mc:sifive-fu540-sid-ports:isar-image-base',
+ 'mc:qemuriscv64-sid:isar-image-base',
+ 'mc:sifive-fu540-sid:isar-image-base',
]

self.init()
--
2.35.3

Uladzimir Bely

unread,
Oct 6, 2023, 1:44:34 AM10/6/23
to Jan Kiszka, isar-users
To bring CI to working state again, we tend to apply this revert today.
(as soon as possible). Is it OK?

Uladzimir Bely

unread,
Oct 6, 2023, 1:52:28 AM10/6/23
to Jan Kiszka, isar-users
What do you think about renaming variable BUILD_HOST_ARCH to BUILD_ARCH
in Isar? While it's not yet widely used in the recipes, it would better
to do it earlier.

It is an internal Isar variable and renaming should not affect any
downstreams. Renaming should make us a bit closer to OE, where
BUILD_ARCH has the same meaning.

Additionally, it would fix the issue with sstate-cache and "-native"
packages ( https://groups.google.com/g/isar-users/c/2TNQPOb0IXY ).

Jan Kiszka

unread,
Oct 6, 2023, 1:59:22 AM10/6/23
to Uladzimir Bely, isar-users
Sure!

Jan

--
Siemens AG, Technology
Linux Expert Center

Jan Kiszka

unread,
Oct 6, 2023, 2:00:54 AM10/6/23
to Uladzimir Bely, isar-users
I was also thinking about this, yes. Should I include such a patch in my
series?

Jan

> Additionally, it would fix the issue with sstate-cache and "-native"
> packages ( https://groups.google.com/g/isar-users/c/2TNQPOb0IXY ).
>
>>  do_prepare_build[cleandirs] += "${S}/debian"
>>  do_prepare_build(){
>

Uladzimir Bely

unread,
Oct 6, 2023, 2:04:21 AM10/6/23
to Jan Kiszka, isar-users, Adriaan Schmidt, Felix Moessbauer
On Thu, 2023-10-05 at 20:31 +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.k...@siemens.com>
>
> This reverts commit 7bc68bb27f562257977bb5f701564ab08d4c5b3a.
>
> It was the wrong assumption that HOST_ARCH should depend on
> ISAR_CROSS_COMPILE - too much code assumes that it is statically
> bound
> to the builder machine. Instead, code that needs effective builder
> arch should use BUILD_HOST_ARCH.
>
> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
> ---
>  meta/classes/base.bbclass       | 6 ++----
>  meta/classes/imagetypes.bbclass | 6 ++----
>  2 files changed, 4 insertions(+), 8 deletions(-)
>

Revert applied to next, thanks.

Uladzimir Bely

unread,
Oct 6, 2023, 2:06:34 AM10/6/23
to Jan Kiszka, isar-users
Yes, please.
Actually, I've just applied patch1 from the series to 'next', so the
new patch could be first in series v2, so other patches would keep
their numbers.

Jan Kiszka

unread,
Oct 6, 2023, 11:35:05 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
Changes in v2:
- drop merged revert
- rename BUILD_HOST_ARCH to BUILD_ARCH
- add fix for explicit -native build in non-cross setups
- add missing debian-sid.conf

This tries to resolve the native build issues of the visionfive2, fixing
some remaining corner case of -native usage:

If package A has B-native as build dependency but is then compiled
without cross-building, using qemu-user instead, it will incorrectly
request the build of B:, rather than B:. This
is resolved automatically now, and the solution is used for the
visionfive2.

For that board to build again, we also need to switch from sid-ports to
sid, for riscv64 in general.

Furthermore, this reworks the crossvars logic to also account for the
corner case that a package is still requested as native although
ISAR_CROSS_COMPILE is off. While this is likely irrelvant in practice,
the result is a more consistent logic of the crossvars class.

Jan

Jan Kiszka (9):
Rename BUILD_HOST_ARCH to BUILD_ARCH
dpkg: Drop redundant PACKAGE_ARCH initialization
crossvars: Adjust logic to account for -native package builds in
non-cross setups
multiarch: Downgrade native dependencies when building in emulated
environment
meta-isar: jh7110-u-boot-spl-tool: Rely on native annotation
meta-isar: jh7110-u-boot-spl-image: Fix native build
meta-isar: u-boot-starfive-visionfive2: Simplify build dependencies
linux-custom: Drop unused template variable
Move riscv64 from sid-ports to regular sid

doc/user_manual.md | 4 ++--
kas/distro/Kconfig | 6 +++---
...{debian-sid-ports.yaml => debian-sid.yaml} | 2 +-
kas/machine/Kconfig | 6 +++---
meta-isar/conf/mc.conf | 6 +++---
...64-sid-ports.conf => qemuriscv64-sid.conf} | 2 +-
...0-sid-ports.conf => sifive-fu540-sid.conf} | 2 +-
...rts.conf => starfive-visionfive2-sid.conf} | 2 +-
...-starfive-visionfive2_2021.10+VF2-3.0.4.bb | 4 +---
meta/classes/crossvars.bbclass | 19 ++++++++++-------
meta/classes/dpkg-base.bbclass | 2 +-
meta/classes/dpkg.bbclass | 4 +---
meta/classes/multiarch.bbclass | 12 +++++++++++
meta/conf/bitbake.conf | 2 +-
meta/conf/distro/debian-sid.conf | 21 +++++++++++++++++++
meta/recipes-kernel/linux/linux-custom.inc | 1 -
testsuite/citest.py | 6 +++---
19 files changed, 70 insertions(+), 40 deletions(-)
rename kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} (78%)
rename meta-isar/conf/multiconfig/{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} (85%)
rename meta-isar/conf/multiconfig/{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} (76%)
rename meta-isar/conf/multiconfig/{starfive-visionfive2-sid-ports.conf => starfive-visionfive2-sid.conf} (78%)
create mode 100644 meta/conf/distro/debian-sid.conf

--
2.35.3

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

This is done in bitbake.conf already since 0a18d4c199a4.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/dpkg.bbclass | 2 --
1 file changed, 2 deletions(-)

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 7bcb4367..d89b0fd9 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -4,8 +4,6 @@
inherit dpkg-base
inherit dpkg-source

-PACKAGE_ARCH ?= "${DISTRO_ARCH}"
-
DPKG_PREBUILD_ENV_FILE="${WORKDIR}/dpkg_prebuild.env"

# bitbake variables that should be passed into sbuild env
--
2.35.3

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

Aligns us also with OE/Yocto and prepares for a potential future
renaming of HOST_ARCH as well.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
doc/user_manual.md | 4 ++--
meta/classes/crossvars.bbclass | 4 ++--
meta/classes/dpkg-base.bbclass | 2 +-
meta/classes/dpkg.bbclass | 2 +-
meta/conf/bitbake.conf | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index be47fdcc..ecb987f4 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1080,8 +1080,8 @@ to `local.conf`. If some package requires ccache to be always disabled,
By default, ccache directory is created inside `TMPDIR`, but it can be
adjusted by `CCACHE_TOP_DIR` variable in `local.conf`. Ccache directory
`CCACHE_DIR` default value is
-`"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_HOST_ARCH}"`,
-that means caches for different distros and architectures are not overlapped.
+`"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"`, that means
+caches for different distros and architectures are not overlapped.

The ccache debug mode can be enabled by setting `CCACHE_DEBUG = "1"`
in the `local.conf`.
diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index df26f47f..22bc4714 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -17,12 +17,12 @@ python __anonymous() {

distro_arch = d.getVar('DISTRO_ARCH')
if mode == "0" or d.getVar('HOST_ARCH') == distro_arch or distro_arch == None:
- d.setVar('BUILD_HOST_ARCH', distro_arch)
+ d.setVar('BUILD_ARCH', distro_arch)
schroot_dir = d.getVar('SCHROOT_TARGET_DIR', False)
sbuild_dep = "sbuild-chroot-target" + flavor_suffix + ":do_build"
sdk_toolchain = "build-essential"
else:
- d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
+ d.setVar('BUILD_ARCH', d.getVar('HOST_ARCH'))
schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"
sdk_toolchain = "crossbuild-essential-" + distro_arch
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index f223fc16..7b054d3f 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -299,7 +299,7 @@ python do_devshell() {
schroot = d.getVar('SBUILD_CHROOT')
isar_apt = d.getVar('ISAR_APT_REPO')
pkg_arch = d.getVar('PACKAGE_ARCH')
- build_arch = d.getVar('BUILD_HOST_ARCH')
+ build_arch = d.getVar('BUILD_ARCH')
pp_pps = os.path.join(d.getVar('PP'), d.getVar('PPS'))
debdistroname = d.getVar('DEBDISTRONAME')

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index d896fc91..7bcb4367 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -101,7 +101,7 @@ dpkg_runbuild() {
DSC_FILE=$(find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -maxdepth 1 -print)

sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository="${ISAR_APT_REPO}" \
- --host=${PACKAGE_ARCH} --build=${BUILD_HOST_ARCH} ${profiles} \
+ --host=${PACKAGE_ARCH} --build=${BUILD_ARCH} ${profiles} \
--no-run-lintian --no-run-piuparts --no-run-autopkgtest --resolve-alternatives \
--bd-uninstallable-explainer=apt \
--no-apt-update \
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 9eb93e2b..80dc01c7 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -163,7 +163,7 @@ INHERIT += "${@'buildstats' if d.getVar('USE_BUILDSTATS') == '1' else ''}"
# Default values for ccache
USE_CCACHE ??= "0"
CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
-CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_HOST_ARCH}"
+CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"
CCACHE_DEBUG ?= "0"

# Variables for tasks marking
--
2.35.3

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

When selecting a -native version of a package while cross-building is
disabled for it, we will use the target build env instead. That may
work, just slowly, or even fail miserably.

Extend the build env selection logic to take PACKAGE_ARCH into account
as well. It defaults to DISTRO_ARCH for non-package recipe, thus should
works fine for those as well.

Reported-by: Cedric Hombourger <cedric.h...@siemens.com>
Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/crossvars.bbclass | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index 22bc4714..87e45417 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -16,16 +16,21 @@ python __anonymous() {
flavor_suffix = ('-' + flavor) if flavor else ''

distro_arch = d.getVar('DISTRO_ARCH')
- if mode == "0" or d.getVar('HOST_ARCH') == distro_arch or distro_arch == None:
+ host_arch = d.getVar('HOST_ARCH')
+ package_arch = d.getVar('PACKAGE_ARCH')
+
+ if distro_arch != host_arch and \
+ (package_arch == host_arch or \
+ (package_arch == distro_arch and mode == "1")):
+ d.setVar('BUILD_ARCH', host_arch)
+ schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
+ sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"
+ sdk_toolchain = "crossbuild-essential-" + distro_arch
+ else:
d.setVar('BUILD_ARCH', distro_arch)
schroot_dir = d.getVar('SCHROOT_TARGET_DIR', False)
sbuild_dep = "sbuild-chroot-target" + flavor_suffix + ":do_build"
sdk_toolchain = "build-essential"
- else:
- d.setVar('BUILD_ARCH', d.getVar('HOST_ARCH'))
- schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
- sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"
- sdk_toolchain = "crossbuild-essential-" + distro_arch
d.setVar('SCHROOT_DIR', schroot_dir + flavor_suffix)
d.setVar('SCHROOT_DEP', sbuild_dep)
if isar_can_build_compat(d):
--
2.35.3

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

When a package that has -native build dependencies is forced into
non-cross building using qemu-user (ie. build arch != distro arch), its
dependency installation will generally fail. That is because
somedep-native will build somedep for the builder arch, not for the
distro arch that is needed during native builds.

Address that automatically by downgrading any such recipe dependency by
stripping for '-native'.

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

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

In general, recipes must not use HOST_ARCH because it does not account
for ISAR_CROSS_COMPILE being enabled or disabled. This is encoded into
BUILD_ARCH, though.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
index dbce7c28..c004c86c 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
@@ -12,7 +12,7 @@ DEPENDS = "jh7110-u-boot-spl-tool-native u-boot-starfive-visionfive2"
DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool:native, u-boot-starfive-visionfive2:${DISTRO_ARCH}"

# this is a host tool
-PACKAGE_ARCH = "${HOST_ARCH}"
+PACKAGE_ARCH = "${BUILD_ARCH}"

do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build(){
--
2.35.3

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

At the risk of adding the same package twice, but apt will be resolve
that, just follow the pattern of others: :native for the build env,
without any suffix for the target.

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

Jan Kiszka

unread,
Oct 6, 2023, 11:35:06 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

Avoids the need to fiddle with the PACKAGE_ARCH in this recipe.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb | 4 ++--
.../jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb | 3 ---
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
index a3258e42..dbce7c28 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
@@ -8,8 +8,8 @@ inherit dpkg
SRC_URI = "file://rules file://install"

DESCRIPTION = "StarFive VisionFive 2 u-boot SPL"
-DEPENDS = "jh7110-u-boot-spl-tool u-boot-starfive-visionfive2"
-DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool, u-boot-starfive-visionfive2:${DISTRO_ARCH}"
+DEPENDS = "jh7110-u-boot-spl-tool-native u-boot-starfive-visionfive2"
+DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool:native, u-boot-starfive-visionfive2:${DISTRO_ARCH}"

# this is a host tool
PACKAGE_ARCH = "${HOST_ARCH}"
diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
index fefcbf66..292334f6 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
@@ -13,9 +13,6 @@ SRCREV = "8c5acc4e5eb7e4ad012463b05a5e3dbbfed1c38d"

S = "${WORKDIR}/tools/spl_tool"

-# This is a host tool
-PACKAGE_ARCH = "${HOST_ARCH}"
-
do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build(){
deb_debianize
--
2.35.3

Jan Kiszka

unread,
Oct 6, 2023, 11:35:07 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

Now that riscv64 is an official Debian arch, sid-ports runs out of sync
with sid. It seems that sid is generally building riscv64 fine, but
cross-compilation will remain broken for a longer while.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
kas/distro/Kconfig | 6 +++---
...{debian-sid-ports.yaml => debian-sid.yaml} | 2 +-
kas/machine/Kconfig | 6 +++---
meta-isar/conf/mc.conf | 6 +++---
...64-sid-ports.conf => qemuriscv64-sid.conf} | 2 +-
...0-sid-ports.conf => sifive-fu540-sid.conf} | 2 +-
...rts.conf => starfive-visionfive2-sid.conf} | 2 +-
meta/conf/distro/debian-sid.conf | 21 +++++++++++++++++++
testsuite/citest.py | 6 +++---
9 files changed, 37 insertions(+), 16 deletions(-)
rename kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} (78%)
rename meta-isar/conf/multiconfig/{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} (85%)
rename meta-isar/conf/multiconfig/{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} (76%)
rename meta-isar/conf/multiconfig/{starfive-visionfive2-sid-ports.conf => starfive-visionfive2-sid.conf} (78%)
create mode 100644 meta/conf/distro/debian-sid.conf

diff --git a/meta/conf/distro/debian-sid.conf b/meta/conf/distro/debian-sid.conf
new file mode 100644
index 00000000..631f9b5a
--- /dev/null
+++ b/meta/conf/distro/debian-sid.conf
@@ -0,0 +1,21 @@
+# This software is a part of ISAR.
+#
+# Copyright (c) Siemens AG, 2020-2023
+#
+# SPDX-License-Identifier: MIT
+
+require debian-common.conf
+
+BASE_DISTRO_CODENAME = "sid"
+
+HOST_DISTRO ?= "debian-${BASE_DISTRO_CODENAME}"
+
+DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
+DISTRO_KERNELS ?= "4kc-malta 5kc-malta 686-pae 686 alpha-generic alpha-smp \
+ amd64 arm64 armmp-lpae armmp cloud-amd64 cloud-arm64 itanium \
+ loongson-3 m68k marvell mckinley mips32r6 mips32r6el mips64r6 \
+ mips64r6el octeon parisc parisc64 powerpc-smp powerpc powerpc64 \
+ powerpc64le riscv64 rpi rt-686-pae rt-amd64 rt-arm64 rt-armmp \
+ s390x sh7751r sh7785lcr sparc64-smp sparc64"
+
+DISTRO_GCC = "13"

Jan Kiszka

unread,
Oct 6, 2023, 11:35:07 AM10/6/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

This was never used, in fact.

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

Uladzimir Bely

unread,
Oct 11, 2023, 6:50:00 AM10/11/23
to Jan Kiszka, isar-users
While testing the patchset, I noticed that packages with "-compat"
suffix now pull and use "sbuild-chroot-target" instead of "sbuild-
chroot-host".

Conditions:
ISAR_CROSS_COMPILE = "1"
ISAR_ENABLE_COMPAT_ARCH = "1"

Build command: `bitbake -v mc:qemuarm64-bookworm:hello-compat`

On 'next':

```
build$ ls -1 tmp/work/debian-bookworm-arm64/
base-apt
hello-compat
isar-apt
isar-bootstrap-host
sbuild-chroot-host
```

With patchset:

```
build$ ls -1 tmp/work/debian-bookworm-arm64/
base-apt
hello-compat
isar-apt
isar-bootstrap-target
sbuild-chroot-target
```

If talking about CI, it passes except repro tests.

Due to this issue, some 'deb' files from raspios repositories go to
"debian" download subdirectory, and during the second (base-apt cached)
build they go to Debian's `base-apt` and it leads to the conflict when
resolving dependencies.

I'm stil debugging this, but this part of information may be useful.

Jan Kiszka

unread,
Oct 11, 2023, 6:51:48 AM10/11/23
to Uladzimir Bely, isar-users
Likely an issue of patch 3. The rest should still work when pulling this
out, though.

Jan

Jan Kiszka

unread,
Oct 12, 2023, 12:52:00 AM10/12/23
to Uladzimir Bely, isar-users
Yep, patch 3, and this should fix it:

diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index 87e45417..a7834b99 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -16,12 +16,13 @@ python __anonymous() {
flavor_suffix = ('-' + flavor) if flavor else ''

distro_arch = d.getVar('DISTRO_ARCH')
+ compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
host_arch = d.getVar('HOST_ARCH')
package_arch = d.getVar('PACKAGE_ARCH')

if distro_arch != host_arch and \
(package_arch == host_arch or \
- (package_arch == distro_arch and mode == "1")):
+ (package_arch in [distro_arch, compat_arch] and mode == "1")):
d.setVar('BUILD_ARCH', host_arch)
schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"

Should I resent the whole series with this update?

Uladzimir Bely

unread,
Oct 12, 2023, 1:06:58 AM10/12/23
to Jan Kiszka, isar-users
Yes, please.

In my internal experiments I came up to something similar:

diff --git a/meta/classes/crossvars.bbclass
b/meta/classes/crossvars.bbclass
index 87e45417..501dfef2 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -18,9 +18,11 @@ python __anonymous() {
distro_arch = d.getVar('DISTRO_ARCH')
host_arch = d.getVar('HOST_ARCH')
package_arch = d.getVar('PACKAGE_ARCH')
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH')

if distro_arch != host_arch and \
(package_arch == host_arch or \
+ (package_arch == compat_distro_arch and mode == "1") or \
(package_arch == distro_arch and mode == "1")):
d.setVar('BUILD_ARCH', host_arch)
schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)

.. and now testing if it fixes the issue.

> Jan
>

Jan Kiszka

unread,
Oct 12, 2023, 1:16:49 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
Change in v3:
- fix compat arch cross build regression

Changes in v2:
- drop merged revert
- rename BUILD_HOST_ARCH to BUILD_ARCH
- add fix for explicit -native build in non-cross setups
- add missing debian-sid.conf

This tries to resolve the native build issues of the visionfive2, fixing
some remaining corner case of -native usage:

If package A has B-native as build dependency but is then compiled
without cross-building, using qemu-user instead, it will incorrectly
request the build of B:, rather than B:. This
is resolved automatically now, and the solution is used for the
visionfive2.

For that board to build again, we also need to switch from sid-ports to
meta/classes/crossvars.bbclass | 20 +++++++++++-------
meta/classes/dpkg-base.bbclass | 2 +-
meta/classes/dpkg.bbclass | 4 +---
meta/classes/multiarch.bbclass | 12 +++++++++++
meta/conf/bitbake.conf | 2 +-
meta/conf/distro/debian-sid.conf | 21 +++++++++++++++++++
meta/recipes-kernel/linux/linux-custom.inc | 1 -
testsuite/citest.py | 6 +++---
19 files changed, 71 insertions(+), 40 deletions(-)
rename kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} (78%)
rename meta-isar/conf/multiconfig/{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} (85%)
rename meta-isar/conf/multiconfig/{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} (76%)
rename meta-isar/conf/multiconfig/{starfive-visionfive2-sid-ports.conf => starfive-visionfive2-sid.conf} (78%)
create mode 100644 meta/conf/distro/debian-sid.conf

--
2.35.3

Jan Kiszka

unread,
Oct 12, 2023, 1:16:50 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

When a package that has -native build dependencies is forced into
non-cross building using qemu-user (ie. build arch != distro arch), its
dependency installation will generally fail. That is because
somedep-native will build somedep for the builder arch, not for the
distro arch that is needed during native builds.

Address that automatically by downgrading any such recipe dependency by
stripping for '-native'.

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

Jan Kiszka

unread,
Oct 12, 2023, 1:16:50 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

In general, recipes must not use HOST_ARCH because it does not account
for ISAR_CROSS_COMPILE being enabled or disabled. This is encoded into
BUILD_ARCH, though.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
index dbce7c28..c004c86c 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
@@ -12,7 +12,7 @@ DEPENDS = "jh7110-u-boot-spl-tool-native u-boot-starfive-visionfive2"
DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool:native, u-boot-starfive-visionfive2:${DISTRO_ARCH}"

# this is a host tool
-PACKAGE_ARCH = "${HOST_ARCH}"
+PACKAGE_ARCH = "${BUILD_ARCH}"

do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build(){
--
2.35.3

Jan Kiszka

unread,
Oct 12, 2023, 1:16:50 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

When selecting a -native version of a package while cross-building is
disabled for it, we will use the target build env instead. That may
work, just slowly, or even fail miserably.

Extend the build env selection logic to take PACKAGE_ARCH into account
as well. It defaults to DISTRO_ARCH for non-package recipe, thus should
works fine for those as well.

Reported-by: Cedric Hombourger <cedric.h...@siemens.com>
Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/crossvars.bbclass | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index 22bc4714..a7834b99 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -16,16 +16,22 @@ python __anonymous() {
flavor_suffix = ('-' + flavor) if flavor else ''

distro_arch = d.getVar('DISTRO_ARCH')
- if mode == "0" or d.getVar('HOST_ARCH') == distro_arch or distro_arch == None:
+ compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
+ host_arch = d.getVar('HOST_ARCH')
+ package_arch = d.getVar('PACKAGE_ARCH')
+
+ if distro_arch != host_arch and \
+ (package_arch == host_arch or \
+ (package_arch in [distro_arch, compat_arch] and mode == "1")):

Jan Kiszka

unread,
Oct 12, 2023, 1:16:50 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

This is done in bitbake.conf already since 0a18d4c199a4.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/dpkg.bbclass | 2 --
1 file changed, 2 deletions(-)

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 7bcb4367..d89b0fd9 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass

Jan Kiszka

unread,
Oct 12, 2023, 1:16:50 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

Aligns us also with OE/Yocto and prepares for a potential future
renaming of HOST_ARCH as well.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
doc/user_manual.md | 4 ++--
meta/classes/crossvars.bbclass | 4 ++--
meta/classes/dpkg-base.bbclass | 2 +-
meta/classes/dpkg.bbclass | 2 +-
meta/conf/bitbake.conf | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index be47fdcc..ecb987f4 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1080,8 +1080,8 @@ to `local.conf`. If some package requires ccache to be always disabled,
By default, ccache directory is created inside `TMPDIR`, but it can be
adjusted by `CCACHE_TOP_DIR` variable in `local.conf`. Ccache directory
`CCACHE_DIR` default value is
-`"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_HOST_ARCH}"`,
-that means caches for different distros and architectures are not overlapped.
+`"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"`, that means
+caches for different distros and architectures are not overlapped.

The ccache debug mode can be enabled by setting `CCACHE_DEBUG = "1"`
in the `local.conf`.
diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index df26f47f..22bc4714 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -17,12 +17,12 @@ python __anonymous() {

distro_arch = d.getVar('DISTRO_ARCH')
if mode == "0" or d.getVar('HOST_ARCH') == distro_arch or distro_arch == None:
- d.setVar('BUILD_HOST_ARCH', distro_arch)
+ d.setVar('BUILD_ARCH', distro_arch)
schroot_dir = d.getVar('SCHROOT_TARGET_DIR', False)
sbuild_dep = "sbuild-chroot-target" + flavor_suffix + ":do_build"
sdk_toolchain = "build-essential"
else:
- d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
+ d.setVar('BUILD_ARCH', d.getVar('HOST_ARCH'))
schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"
sdk_toolchain = "crossbuild-essential-" + distro_arch
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index f223fc16..7b054d3f 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -299,7 +299,7 @@ python do_devshell() {
schroot = d.getVar('SBUILD_CHROOT')
isar_apt = d.getVar('ISAR_APT_REPO')
pkg_arch = d.getVar('PACKAGE_ARCH')
- build_arch = d.getVar('BUILD_HOST_ARCH')
+ build_arch = d.getVar('BUILD_ARCH')
pp_pps = os.path.join(d.getVar('PP'), d.getVar('PPS'))
debdistroname = d.getVar('DEBDISTRONAME')

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index d896fc91..7bcb4367 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass

Jan Kiszka

unread,
Oct 12, 2023, 1:16:51 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

This was never used, in fact.

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

Jan Kiszka

unread,
Oct 12, 2023, 1:16:51 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

Avoids the need to fiddle with the PACKAGE_ARCH in this recipe.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb | 4 ++--
.../jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb | 3 ---
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
index a3258e42..dbce7c28 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-image/jh7110-u-boot-spl-image_0.1.bb
@@ -8,8 +8,8 @@ inherit dpkg
SRC_URI = "file://rules file://install"

DESCRIPTION = "StarFive VisionFive 2 u-boot SPL"
-DEPENDS = "jh7110-u-boot-spl-tool u-boot-starfive-visionfive2"
-DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool, u-boot-starfive-visionfive2:${DISTRO_ARCH}"
+DEPENDS = "jh7110-u-boot-spl-tool-native u-boot-starfive-visionfive2"
+DEBIAN_BUILD_DEPENDS = "jh7110-u-boot-spl-tool:native, u-boot-starfive-visionfive2:${DISTRO_ARCH}"

# this is a host tool
PACKAGE_ARCH = "${HOST_ARCH}"
diff --git a/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb b/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
index fefcbf66..292334f6 100644
--- a/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
+++ b/meta-isar/recipes-bsp/jh7110-u-boot-spl-tool/jh7110-u-boot-spl-tool_0.1.bb
@@ -13,9 +13,6 @@ SRCREV = "8c5acc4e5eb7e4ad012463b05a5e3dbbfed1c38d"

S = "${WORKDIR}/tools/spl_tool"

-# This is a host tool
-PACKAGE_ARCH = "${HOST_ARCH}"
-
do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build(){
deb_debianize
--
2.35.3

Jan Kiszka

unread,
Oct 12, 2023, 1:16:51 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

At the risk of adding the same package twice, but apt will be resolve
that, just follow the pattern of others: :native for the build env,
without any suffix for the target.

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

Jan Kiszka

unread,
Oct 12, 2023, 1:16:51 AM10/12/23
to isar-users, Adriaan Schmidt, Felix Moessbauer, Uladzimir Bely, Cedric Hombourger
From: Jan Kiszka <jan.k...@siemens.com>

Now that riscv64 is an official Debian arch, sid-ports runs out of sync
with sid. It seems that sid is generally building riscv64 fine, but
cross-compilation will remain broken for a longer while.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
kas/distro/Kconfig | 6 +++---
...{debian-sid-ports.yaml => debian-sid.yaml} | 2 +-
kas/machine/Kconfig | 6 +++---
meta-isar/conf/mc.conf | 6 +++---
...64-sid-ports.conf => qemuriscv64-sid.conf} | 2 +-
...0-sid-ports.conf => sifive-fu540-sid.conf} | 2 +-
...rts.conf => starfive-visionfive2-sid.conf} | 2 +-
meta/conf/distro/debian-sid.conf | 21 +++++++++++++++++++
testsuite/citest.py | 6 +++---
9 files changed, 37 insertions(+), 16 deletions(-)
rename kas/distro/{debian-sid-ports.yaml => debian-sid.yaml} (78%)
rename meta-isar/conf/multiconfig/{qemuriscv64-sid-ports.conf => qemuriscv64-sid.conf} (85%)
rename meta-isar/conf/multiconfig/{sifive-fu540-sid-ports.conf => sifive-fu540-sid.conf} (76%)
rename meta-isar/conf/multiconfig/{starfive-visionfive2-sid-ports.conf => starfive-visionfive2-sid.conf} (78%)
create mode 100644 meta/conf/distro/debian-sid.conf

Uladzimir Bely

unread,
Oct 13, 2023, 3:59:38 AM10/13/23
to Jan Kiszka, isar-users, Adriaan Schmidt, Felix Moessbauer, Cedric Hombourger
Well, this now completely passes CI, so we will merge it after the
weekend if there are no objections.

Jan Kiszka

unread,
Oct 13, 2023, 4:36:10 AM10/13/23
to Uladzimir Bely, isar-users, Adriaan Schmidt, Felix Moessbauer, Cedric Hombourger
\o/ :). Yeah, sorry, this really became much more tricky than I
originally thought. And thanks a lot for finding all my bugs along the way!

Uladzimir Bely

unread,
Oct 16, 2023, 3:15:34 AM10/16/23
to Jan Kiszka, isar-users, Adriaan Schmidt, Felix Moessbauer, Cedric Hombourger
On Thu, 2023-10-12 at 07:16 +0200, Jan Kiszka wrote:

Applied to next, thanks.

Reply all
Reply to author
Forward
0 new messages