* [PATCH 0/3] multiarch support
@ 2023-02-06 12:20 Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 1/3] bitbake.conf: use PACKAGE_ARCH in overrides Adriaan Schmidt
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Adriaan Schmidt @ 2023-02-06 12:20 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, Adriaan Schmidt
Hi,
this is my first working draft of multiarch support, which extends all package
recipes (inheriting dpkg-base) with *-compat and *-native variants.
My current use case/test subject is meta-iot2050, which contains a patched
openssl, needed in the SDK (as -native package), and on the target (as -compat).
[1] has this patchseries (plus pre-bitbake2 backporting), if someone would like to test.
In addition, the compat test from the testsuite works (building hello-isar-compat).
Still missing:
- not sure if -native also needs IMAGE_INSTALL logic to convert bitbake to debian names
- documentation
- test case for -native (maybe add libhello-native to the SDK?)
- probably other things...
Adriaan
[1] https://github.com/adriaan42/meta-iot2050/tree/adriaan/multiarch
Adriaan Schmidt (3):
bitbake.conf: use PACKAGE_ARCH in overrides
add multiarch support
remove obsolete compat-arch override
.../recipes-app/hello-isar/hello-isar.bb | 3 --
meta-isar/recipes-app/libhello/libhello.bb | 3 --
.../recipes-app/samefile/samefile_2.14.bb | 2 +-
meta/classes/compat.bbclass | 49 +++++++++++++++++++
meta/classes/debianize.bbclass | 2 +-
meta/classes/dpkg-base.bbclass | 1 +
meta/classes/image.bbclass | 4 +-
meta/classes/multiarch.bbclass | 44 +++++++++++++++++
meta/classes/native.bbclass | 10 ++++
meta/conf/bitbake.conf | 6 +--
.../isar-bootstrap/isar-bootstrap.inc | 2 +
.../sbuild-chroot/sbuild-chroot.inc | 14 +++---
testsuite/cibuilder.py | 2 +
13 files changed, 124 insertions(+), 18 deletions(-)
create mode 100644 meta/classes/compat.bbclass
create mode 100644 meta/classes/multiarch.bbclass
create mode 100644 meta/classes/native.bbclass
--
2.30.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] bitbake.conf: use PACKAGE_ARCH in overrides
2023-02-06 12:20 [PATCH 0/3] multiarch support Adriaan Schmidt
@ 2023-02-06 12:20 ` Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 2/3] add multiarch support Adriaan Schmidt
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: Adriaan Schmidt @ 2023-02-06 12:20 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, Adriaan Schmidt
This replaces `DISTRO_ARCH` with `PACKAGE_ARCH` in the `OVERRIDES` list.
Note that `PACKAGE_ARCH` defaults to `DISTRO_ARCH`, so this only has an
effect when `PACKAGE_ARCH` is explicitly set in a recipe.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
meta/conf/bitbake.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 522241aa..f1a9438e 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -67,8 +67,8 @@ KERNEL_FILE:mipsel ?= "vmlinux"
KERNEL_FILE:riscv64 ?= "vmlinux"
KERNEL_FILE:arm64 ?= "vmlinux"
-OVERRIDES = "${DISTRO_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
-FILESOVERRIDES = "${DISTRO_ARCH}:${MACHINE}"
+OVERRIDES = "${PACKAGE_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
+FILESOVERRIDES = "${PACKAGE_ARCH}:${MACHINE}"
COMPAT_OVERRIDE = "${@'compat-arch' if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1' else ''}"
# Setting default QEMU_ARCH variables for different DISTRO_ARCH:
--
2.30.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/3] add multiarch support
2023-02-06 12:20 [PATCH 0/3] multiarch support Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 1/3] bitbake.conf: use PACKAGE_ARCH in overrides Adriaan Schmidt
@ 2023-02-06 12:20 ` Adriaan Schmidt
2023-02-28 7:58 ` Cedric Hombourger
2023-02-06 12:20 ` [PATCH 3/3] remove obsolete compat-arch override Adriaan Schmidt
2023-02-06 13:01 ` [PATCH 0/3] multiarch support Jan Kiszka
3 siblings, 1 reply; 14+ messages in thread
From: Adriaan Schmidt @ 2023-02-06 12:20 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, Adriaan Schmidt
This adds support for building packages for native and compat architectures
to dpdk-base.bbclass.
Thus, all package recipes automatically have a *-native and *-compat target,
which can be used in DEPENDS/RDEPENDS definitions.
Additionally *-compat targets can be used in IMAGE_INSTALL, where they
are automatically converted to install package:${COMPAT_DISTRO_ARCH}.
Note that the switch ISAR_ENABLE_COMPAT_ARCH still exist and controls
addition of the compat architecture during bootstrapping.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
.../recipes-app/samefile/samefile_2.14.bb | 2 +-
meta/classes/compat.bbclass | 49 +++++++++++++++++++
meta/classes/debianize.bbclass | 2 +-
meta/classes/dpkg-base.bbclass | 1 +
meta/classes/image.bbclass | 4 +-
meta/classes/multiarch.bbclass | 44 +++++++++++++++++
meta/classes/native.bbclass | 10 ++++
meta/conf/bitbake.conf | 1 +
8 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 meta/classes/compat.bbclass
create mode 100644 meta/classes/multiarch.bbclass
create mode 100644 meta/classes/native.bbclass
diff --git a/meta-isar/recipes-app/samefile/samefile_2.14.bb b/meta-isar/recipes-app/samefile/samefile_2.14.bb
index 5e36a2ac..c53c9445 100644
--- a/meta-isar/recipes-app/samefile/samefile_2.14.bb
+++ b/meta-isar/recipes-app/samefile/samefile_2.14.bb
@@ -21,7 +21,7 @@ do_prepare_build() {
# deb_debianize. Pre-exisiting files will not be recreated, changelog
# will be prepended unless its latest entry is for CHANGELOG_V.
cat << EOF > ${WORKDIR}/changelog
-${PN} (0.1) unstable; urgency=low
+${BPN} (0.1) unstable; urgency=low
* a long long time ago there was an early version
diff --git a/meta/classes/compat.bbclass b/meta/classes/compat.bbclass
new file mode 100644
index 00000000..7142ec3a
--- /dev/null
+++ b/meta/classes/compat.bbclass
@@ -0,0 +1,49 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+# this class is "dual-use": it can be inherited (e.g., by bootstrap and image
+# classes) to access variables and functions, and it's also addedd via BBCLASSEXTEND
+# when inheriting multiconfig.bbclass.
+
+################################################################################
+# generic functions
+################################################################################
+
+# calcucate COMPAT_DISTRO_ARCH
+# we can't use simple overrides, because in case we're building a package
+# with a PACKAGE_ARCH != DISTRO_ARCH, overrides would find the wrong value.
+python() {
+ distro_arch = d.getVar('DISTRO_ARCH')
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH:' + distro_arch)
+ if compat_distro_arch is None and 'class-compat' in d.getVar('OVERRIDES').split(':'):
+ bb.fatal(f"{distro_arch} does not have a compat arch")
+ d.setVar('COMPAT_DISTRO_ARCH', compat_distro_arch)
+}
+
+# function to convert bitbake targets to installable debian packages,
+# e.g., "hello-compat" to "hello:i386".
+def isar_compat_packages(var, d):
+ bb_targets = (d.getVar(var, True) or '').split()
+ packages = []
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH', True)
+ for t in bb_targets:
+ if t.endswith('-compat'):
+ packages.append(t[:-len('-compat')] + ':' + compat_distro_arch)
+ else:
+ packages.append(t)
+ return ' '.join(packages)
+
+
+################################################################################
+# package recipe modifications when actually building *-compat:
+################################################################################
+
+# check that we can actually build compat (ISAR_ENABLE_COMPAT_ARCH is set)
+python do_fetch:prepend:class-compat() {
+ if not d.getVar('ISAR_ENABLE_COMPAT_ARCH', True) == '1':
+ bb.fatal("compat package requested, but ISAR_ENABLE_COMPAT_ARCH is not set.")
+}
+
+PACKAGE_ARCH:class-compat = "${COMPAT_DISTRO_ARCH}"
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index a6694a00..1b98c02d 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -31,7 +31,7 @@ deb_add_changelog() {
date=$(LANG=C date -R -d @${timestamp})
cat <<EOF > ${S}/debian/changelog
-${PN} (${changelog_v}) UNRELEASED; urgency=low
+${BPN} (${changelog_v}) UNRELEASED; urgency=low
* generated by Isar
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index ad28f7b3..55cc6655 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -5,6 +5,7 @@
# SPDX-License-Identifier: MIT
inherit sbuild
+inherit multiarch
inherit debianize
inherit terminal
inherit repository
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 539ec51d..8d0dda30 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -79,9 +79,11 @@ image_do_mounts() {
buildchroot_do_mounts
}
+inherit compat
+
ROOTFSDIR = "${IMAGE_ROOTFS}"
ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache"
-ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
+ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${@isar_compat_packages('IMAGE_INSTALL', d)}"
ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
ROOTFS_PACKAGE_SUFFIX ?= "${PN}-${DISTRO}-${MACHINE}"
diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
new file mode 100644
index 00000000..5b280699
--- /dev/null
+++ b/meta/classes/multiarch.bbclass
@@ -0,0 +1,44 @@
+# This software is a part of ISAR.
+# Copyright (C) 2021-2022 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+BBCLASSEXTEND += "native compat"
+BPN = "${PN}"
+
+python multiarch_virtclass_handler() {
+ def fixup_pn_in_vars(d):
+ vars = 'SRC_URI FILESPATH'.split()
+ for var in vars:
+ v = d.getVar(var, False)
+ if v is not None:
+ d.setVar(var, v.replace('${PN}', '${BPN}'))
+
+ def fixup_depends(suffix, d):
+ vars = 'PROVIDES RPROVIDES DEPENDS RDEPENDS'.split()
+ for var in vars:
+ multiarch_var = []
+ val = d.getVar(var, True)
+ if val is None:
+ continue
+ for v in val.split():
+ if v.endswith('-compat') or v.endswith('-native'):
+ multiarch_var.append(v)
+ else:
+ multiarch_var.append(v + suffix)
+ d.setVar(var, ' '.join(multiarch_var))
+
+ pn = e.data.getVar('PN')
+ if pn.endswith('-compat'):
+ e.data.setVar('BPN', pn[:-len('-compat')])
+ e.data.appendVar('OVERRIDES', ':class-compat')
+ fixup_pn_in_vars(e.data)
+ fixup_depends('-compat', e.data)
+ elif pn.endswith('-native'):
+ e.data.setVar('BPN', pn[:-len('-native')])
+ e.data.appendVar('OVERRIDES', ':class-native')
+ fixup_pn_in_vars(e.data)
+ fixup_depends('-native', e.data)
+}
+addhandler multiarch_virtclass_handler
+multiarch_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
new file mode 100644
index 00000000..ef20e8bc
--- /dev/null
+++ b/meta/classes/native.bbclass
@@ -0,0 +1,10 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+################################################################################
+# package recipe modifications when actually building *-native:
+################################################################################
+
+PACKAGE_ARCH:class-native = "${HOST_ARCH}"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f1a9438e..f38bb447 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -81,6 +81,7 @@ QEMU_ARCH:riscv64 = "riscv64"
# Codename of the repository created by the caching class
DEBDISTRONAME ?= "isar"
+NATIVELSBSTRING ?= "isarnative"
# Strings used in sstate signature files
TARGET_VENDOR = ""
--
2.30.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/3] remove obsolete compat-arch override
2023-02-06 12:20 [PATCH 0/3] multiarch support Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 1/3] bitbake.conf: use PACKAGE_ARCH in overrides Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 2/3] add multiarch support Adriaan Schmidt
@ 2023-02-06 12:20 ` Adriaan Schmidt
2023-02-06 13:00 ` Jan Kiszka
2023-02-06 13:01 ` [PATCH 0/3] multiarch support Jan Kiszka
3 siblings, 1 reply; 14+ messages in thread
From: Adriaan Schmidt @ 2023-02-06 12:20 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, Adriaan Schmidt
The compat-arch override is no longer needed, as PACKAGE_ARCH is controlled
by DEPENDing on <package>-compat.
Also change the compat test: adding the compat package now happens via
IMAGE_INSTALL in the config.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
meta-isar/recipes-app/hello-isar/hello-isar.bb | 3 ---
meta-isar/recipes-app/libhello/libhello.bb | 3 ---
meta/conf/bitbake.conf | 3 +--
.../recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 ++
.../sbuild-chroot/sbuild-chroot.inc | 14 ++++++++------
testsuite/cibuilder.py | 2 ++
6 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb b/meta-isar/recipes-app/hello-isar/hello-isar.bb
index 39ddecb9..7d9f8322 100644
--- a/meta-isar/recipes-app/hello-isar/hello-isar.bb
+++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
@@ -20,7 +20,4 @@ SRC_URI = " \
file://yet-another-change.txt;apply=yes;striplevel=0"
SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
-# NOTE: This is just to test 32-bit building on 64-bit archs.
-PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
-
inherit dpkg
diff --git a/meta-isar/recipes-app/libhello/libhello.bb b/meta-isar/recipes-app/libhello/libhello.bb
index 3770fdb4..8b10842f 100644
--- a/meta-isar/recipes-app/libhello/libhello.bb
+++ b/meta-isar/recipes-app/libhello/libhello.bb
@@ -13,7 +13,4 @@ PV = "0.1-98f2e41"
SRC_URI = "git://github.com/ilbers/libhello.git;protocol=https;branch=master;destsuffix=${P}"
SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"
-# NOTE: This is just to test 32-bit building on 64-bit archs.
-PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
-
inherit dpkg
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f38bb447..1f010f4b 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -67,9 +67,8 @@ KERNEL_FILE:mipsel ?= "vmlinux"
KERNEL_FILE:riscv64 ?= "vmlinux"
KERNEL_FILE:arm64 ?= "vmlinux"
-OVERRIDES = "${PACKAGE_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
+OVERRIDES = "${PACKAGE_ARCH}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
FILESOVERRIDES = "${PACKAGE_ARCH}:${MACHINE}"
-COMPAT_OVERRIDE = "${@'compat-arch' if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1' else ''}"
# Setting default QEMU_ARCH variables for different DISTRO_ARCH:
QEMU_ARCH:amd64 = "x86_64"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 99d75e21..21a2d92f 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -274,6 +274,8 @@ do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config"
do_bootstrap[network] = "${TASK_USE_NETWORK_AND_SUDO}"
+inherit compat
+
do_bootstrap() {
if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
if [ -z "${COMPAT_DISTRO_ARCH}" ]; then
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
index fb061dac..fd8bb648 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
PV = "1.0"
inherit rootfs
+inherit compat
python() {
distro_gcc = d.getVar('DISTRO_GCC')
@@ -20,18 +21,19 @@ python() {
d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
' libstdc++-{}-dev:{}'.format(distro_gcc, distro_arch))
- if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
- compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
+ if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
+ compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
+ d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
+ ' libc6-dev:{}'.format(compat_arch))
+ d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
+ ' crossbuild-essential-{}'.format(compat_arch))
+ if d.getVar('DISTRO_GCC'):
d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
' libgcc-{}-dev:{}'.format(distro_gcc, compat_arch))
d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
' libstdc++-{}-dev:{}'.format(distro_gcc, compat_arch))
}
-SBUILD_CHROOT_COMPAT_PREINSTALL:compat-arch = " \
- libc6-dev:${COMPAT_DISTRO_ARCH} \
- crossbuild-essential-${COMPAT_DISTRO_ARCH}"
-
SBUILD_CHROOT_PREINSTALL_COMMON = " \
${SBUILD_CHROOT_COMPAT_PREINSTALL} \
libc6-dev:${DISTRO_ARCH} \
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 9d1b80f7..0b68e87d 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -92,7 +92,9 @@ class CIBuilder(Test):
with open(self.build_dir + '/conf/ci_build.conf', 'w') as f:
if compat_arch:
f.write('ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n')
+ f.write('IMAGE_INSTALL:append:amd64 = " hello-isar-compat"\n')
f.write('ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n')
+ f.write('IMAGE_INSTALL:append:arm64 = " hello-isar-compat"\n')
f.write('IMAGE_INSTALL += "kselftest"\n')
if cross:
f.write('ISAR_CROSS_COMPILE = "1"\n')
--
2.30.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] remove obsolete compat-arch override
2023-02-06 12:20 ` [PATCH 3/3] remove obsolete compat-arch override Adriaan Schmidt
@ 2023-02-06 13:00 ` Jan Kiszka
2023-02-06 13:34 ` Schmidt, Adriaan
0 siblings, 1 reply; 14+ messages in thread
From: Jan Kiszka @ 2023-02-06 13:00 UTC (permalink / raw)
To: Adriaan Schmidt, isar-users
On 06.02.23 13:20, Adriaan Schmidt wrote:
> The compat-arch override is no longer needed, as PACKAGE_ARCH is controlled
> by DEPENDing on <package>-compat.
>
> Also change the compat test: adding the compat package now happens via
> IMAGE_INSTALL in the config.
>
> Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> ---
> meta-isar/recipes-app/hello-isar/hello-isar.bb | 3 ---
> meta-isar/recipes-app/libhello/libhello.bb | 3 ---
> meta/conf/bitbake.conf | 3 +--
> .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 ++
> .../sbuild-chroot/sbuild-chroot.inc | 14 ++++++++------
> testsuite/cibuilder.py | 2 ++
> 6 files changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> index 39ddecb9..7d9f8322 100644
> --- a/meta-isar/recipes-app/hello-isar/hello-isar.bb
> +++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> @@ -20,7 +20,4 @@ SRC_URI = " \
> file://yet-another-change.txt;apply=yes;striplevel=0"
> SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
>
> -# NOTE: This is just to test 32-bit building on 64-bit archs.
> -PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
> -
> inherit dpkg
> diff --git a/meta-isar/recipes-app/libhello/libhello.bb b/meta-isar/recipes-app/libhello/libhello.bb
> index 3770fdb4..8b10842f 100644
> --- a/meta-isar/recipes-app/libhello/libhello.bb
> +++ b/meta-isar/recipes-app/libhello/libhello.bb
> @@ -13,7 +13,4 @@ PV = "0.1-98f2e41"
> SRC_URI = "git://github.com/ilbers/libhello.git;protocol=https;branch=master;destsuffix=${P}"
> SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"
>
> -# NOTE: This is just to test 32-bit building on 64-bit archs.
> -PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
> -
> inherit dpkg
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index f38bb447..1f010f4b 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -67,9 +67,8 @@ KERNEL_FILE:mipsel ?= "vmlinux"
> KERNEL_FILE:riscv64 ?= "vmlinux"
> KERNEL_FILE:arm64 ?= "vmlinux"
>
> -OVERRIDES = "${PACKAGE_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
> +OVERRIDES = "${PACKAGE_ARCH}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
> FILESOVERRIDES = "${PACKAGE_ARCH}:${MACHINE}"
> -COMPAT_OVERRIDE = "${@'compat-arch' if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1' else ''}"
>
> # Setting default QEMU_ARCH variables for different DISTRO_ARCH:
> QEMU_ARCH:amd64 = "x86_64"
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> index 99d75e21..21a2d92f 100644
> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> @@ -274,6 +274,8 @@ do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
> do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config"
> do_bootstrap[network] = "${TASK_USE_NETWORK_AND_SUDO}"
>
> +inherit compat
> +
> do_bootstrap() {
> if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
> if [ -z "${COMPAT_DISTRO_ARCH}" ]; then
> diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> index fb061dac..fd8bb648 100644
> --- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> +++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> @@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
> PV = "1.0"
>
> inherit rootfs
> +inherit compat
>
> python() {
> distro_gcc = d.getVar('DISTRO_GCC')
> @@ -20,18 +21,19 @@ python() {
> d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
> ' libstdc++-{}-dev:{}'.format(distro_gcc, distro_arch))
>
> - if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
> - compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
> + if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
> + compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
> + d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> + ' libc6-dev:{}'.format(compat_arch))
> + d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> + ' crossbuild-essential-{}'.format(compat_arch))
> + if d.getVar('DISTRO_GCC'):
> d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> ' libgcc-{}-dev:{}'.format(distro_gcc, compat_arch))
> d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> ' libstdc++-{}-dev:{}'.format(distro_gcc, compat_arch))
> }
>
> -SBUILD_CHROOT_COMPAT_PREINSTALL:compat-arch = " \
> - libc6-dev:${COMPAT_DISTRO_ARCH} \
> - crossbuild-essential-${COMPAT_DISTRO_ARCH}"
> -
> SBUILD_CHROOT_PREINSTALL_COMMON = " \
> ${SBUILD_CHROOT_COMPAT_PREINSTALL} \
> libc6-dev:${DISTRO_ARCH} \
> diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
> index 9d1b80f7..0b68e87d 100755
> --- a/testsuite/cibuilder.py
> +++ b/testsuite/cibuilder.py
> @@ -92,7 +92,9 @@ class CIBuilder(Test):
> with open(self.build_dir + '/conf/ci_build.conf', 'w') as f:
> if compat_arch:
> f.write('ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n')
> + f.write('IMAGE_INSTALL:append:amd64 = " hello-isar-compat"\n')
> f.write('ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n')
> + f.write('IMAGE_INSTALL:append:arm64 = " hello-isar-compat"\n')
> f.write('IMAGE_INSTALL += "kselftest"\n')
> if cross:
> f.write('ISAR_CROSS_COMPILE = "1"\n')
This does not oull hello-isar-compat when doing a local build. We likely
need something in meta-isar/conf/local.conf.sample now.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] multiarch support
2023-02-06 12:20 [PATCH 0/3] multiarch support Adriaan Schmidt
` (2 preceding siblings ...)
2023-02-06 12:20 ` [PATCH 3/3] remove obsolete compat-arch override Adriaan Schmidt
@ 2023-02-06 13:01 ` Jan Kiszka
2023-02-06 13:36 ` Schmidt, Adriaan
3 siblings, 1 reply; 14+ messages in thread
From: Jan Kiszka @ 2023-02-06 13:01 UTC (permalink / raw)
To: Adriaan Schmidt, isar-users
On 06.02.23 13:20, Adriaan Schmidt wrote:
> Hi,
>
> this is my first working draft of multiarch support, which extends all package
> recipes (inheriting dpkg-base) with *-compat and *-native variants.
>
> My current use case/test subject is meta-iot2050, which contains a patched
> openssl, needed in the SDK (as -native package), and on the target (as -compat).
> [1] has this patchseries (plus pre-bitbake2 backporting), if someone would like to test.
> In addition, the compat test from the testsuite works (building hello-isar-compat).
>
> Still missing:
> - not sure if -native also needs IMAGE_INSTALL logic to convert bitbake to debian names
You mean foo-{compat,native} -> foo:<{compat-arch,host-arch}>? Would be
sweet.
> - documentation
Specifically a RECIPES-API-CHANGELOG entry.
> - test case for -native (maybe add libhello-native to the SDK?)
> - probably other things...
>
Nice start!
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 3/3] remove obsolete compat-arch override
2023-02-06 13:00 ` Jan Kiszka
@ 2023-02-06 13:34 ` Schmidt, Adriaan
2023-02-06 14:22 ` Schmidt, Adriaan
0 siblings, 1 reply; 14+ messages in thread
From: Schmidt, Adriaan @ 2023-02-06 13:34 UTC (permalink / raw)
To: Kiszka, Jan, isar-users
Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, 6. Februar 2023 14:01:
> On 06.02.23 13:20, Adriaan Schmidt wrote:
> > The compat-arch override is no longer needed, as PACKAGE_ARCH is controlled
> > by DEPENDing on <package>-compat.
> >
> > Also change the compat test: adding the compat package now happens via
> > IMAGE_INSTALL in the config.
> >
> > Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> > ---
> > meta-isar/recipes-app/hello-isar/hello-isar.bb | 3 ---
> > meta-isar/recipes-app/libhello/libhello.bb | 3 ---
> > meta/conf/bitbake.conf | 3 +--
> > .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 ++
> > .../sbuild-chroot/sbuild-chroot.inc | 14 ++++++++------
> > testsuite/cibuilder.py | 2 ++
> > 6 files changed, 13 insertions(+), 14 deletions(-)
> >
> > diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb b/meta-
> isar/recipes-app/hello-isar/hello-isar.bb
> > index 39ddecb9..7d9f8322 100644
> > --- a/meta-isar/recipes-app/hello-isar/hello-isar.bb
> > +++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> > @@ -20,7 +20,4 @@ SRC_URI = " \
> > file://yet-another-change.txt;apply=yes;striplevel=0"
> > SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
> >
> > -# NOTE: This is just to test 32-bit building on 64-bit archs.
> > -PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
> > -
> > inherit dpkg
> > diff --git a/meta-isar/recipes-app/libhello/libhello.bb b/meta-
> isar/recipes-app/libhello/libhello.bb
> > index 3770fdb4..8b10842f 100644
> > --- a/meta-isar/recipes-app/libhello/libhello.bb
> > +++ b/meta-isar/recipes-app/libhello/libhello.bb
> > @@ -13,7 +13,4 @@ PV = "0.1-98f2e41"
> > SRC_URI =
> "git://github.com/ilbers/libhello.git;protocol=https;branch=master;destsuffix
> =${P}"
> > SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"
> >
> > -# NOTE: This is just to test 32-bit building on 64-bit archs.
> > -PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
> > -
> > inherit dpkg
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index f38bb447..1f010f4b 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -67,9 +67,8 @@ KERNEL_FILE:mipsel ?= "vmlinux"
> > KERNEL_FILE:riscv64 ?= "vmlinux"
> > KERNEL_FILE:arm64 ?= "vmlinux"
> >
> > -OVERRIDES =
> "${PACKAGE_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENA
> ME}:forcevariable"
> > +OVERRIDES =
> "${PACKAGE_ARCH}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
> > FILESOVERRIDES = "${PACKAGE_ARCH}:${MACHINE}"
> > -COMPAT_OVERRIDE = "${@'compat-arch' if d.getVar('ISAR_ENABLE_COMPAT_ARCH')
> == '1' else ''}"
> >
> > # Setting default QEMU_ARCH variables for different DISTRO_ARCH:
> > QEMU_ARCH:amd64 = "x86_64"
> > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > index 99d75e21..21a2d92f 100644
> > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > @@ -274,6 +274,8 @@ do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
> > do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config"
> > do_bootstrap[network] = "${TASK_USE_NETWORK_AND_SUDO}"
> >
> > +inherit compat
> > +
> > do_bootstrap() {
> > if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
> > if [ -z "${COMPAT_DISTRO_ARCH}" ]; then
> > diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > index fb061dac..fd8bb648 100644
> > --- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > +++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > @@ -9,6 +9,7 @@ LIC_FILES_CHKSUM =
> "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
> > PV = "1.0"
> >
> > inherit rootfs
> > +inherit compat
> >
> > python() {
> > distro_gcc = d.getVar('DISTRO_GCC')
> > @@ -20,18 +21,19 @@ python() {
> > d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
> > ' libstdc++-{}-dev:{}'.format(distro_gcc,
> distro_arch))
> >
> > - if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
> > - compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
> > + if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
> > + compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
> > + d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > + ' libc6-dev:{}'.format(compat_arch))
> > + d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > + ' crossbuild-essential-{}'.format(compat_arch))
> > + if d.getVar('DISTRO_GCC'):
> > d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > ' libgcc-{}-dev:{}'.format(distro_gcc,
> compat_arch))
> > d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > ' libstdc++-{}-dev:{}'.format(distro_gcc,
> compat_arch))
> > }
> >
> > -SBUILD_CHROOT_COMPAT_PREINSTALL:compat-arch = " \
> > - libc6-dev:${COMPAT_DISTRO_ARCH} \
> > - crossbuild-essential-${COMPAT_DISTRO_ARCH}"
> > -
> > SBUILD_CHROOT_PREINSTALL_COMMON = " \
> > ${SBUILD_CHROOT_COMPAT_PREINSTALL} \
> > libc6-dev:${DISTRO_ARCH} \
> > diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
> > index 9d1b80f7..0b68e87d 100755
> > --- a/testsuite/cibuilder.py
> > +++ b/testsuite/cibuilder.py
> > @@ -92,7 +92,9 @@ class CIBuilder(Test):
> > with open(self.build_dir + '/conf/ci_build.conf', 'w') as f:
> > if compat_arch:
> > f.write('ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n')
> > + f.write('IMAGE_INSTALL:append:amd64 = " hello-isar-
> compat"\n')
> > f.write('ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n')
> > + f.write('IMAGE_INSTALL:append:arm64 = " hello-isar-
> compat"\n')
> > f.write('IMAGE_INSTALL += "kselftest"\n')
> > if cross:
> > f.write('ISAR_CROSS_COMPILE = "1"\n')
>
> This does not oull hello-isar-compat when doing a local build. We likely
> need something in meta-isar/conf/local.conf.sample now.
Ah, it works fine with ISAR_ENABLE_COMPAT_ARCH = "1", but not with
ISAR_ENABLE_COMPAT_ARCH:amd64 = "1". Will have a look.
Currently, that switch is still needed, otherwise the bootstrap
and (s)buildchroot don't get "dpkg --add-architecture <compat-arch>".
I added a check, to report and fail as early as possible if that is missing.
Alternatively we could try to remove ISAR_ENABLE_COMPAT_ARCH completely
and make everything implicit, e.g.:
- have -compat targets depend on a (new) buildchroot-compat
(or always have compat support in the buildchroot)
- auto-detect (at rootfs creation, when we know which packages we want to
install) if we need to add the compat arch to the image.
But that would probably mean some bigger changes.
Adriaan
> Jan
>
> --
> Siemens AG, Technology
> Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 0/3] multiarch support
2023-02-06 13:01 ` [PATCH 0/3] multiarch support Jan Kiszka
@ 2023-02-06 13:36 ` Schmidt, Adriaan
2023-02-07 13:50 ` Jan Kiszka
0 siblings, 1 reply; 14+ messages in thread
From: Schmidt, Adriaan @ 2023-02-06 13:36 UTC (permalink / raw)
To: Kiszka, Jan, isar-users
Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, Montag, 6. Februar 2023 14:01:
> On 06.02.23 13:20, Adriaan Schmidt wrote:
> > Hi,
> >
> > this is my first working draft of multiarch support, which extends all
> package
> > recipes (inheriting dpkg-base) with *-compat and *-native variants.
> >
> > My current use case/test subject is meta-iot2050, which contains a patched
> > openssl, needed in the SDK (as -native package), and on the target (as -
> compat).
> > [1] has this patchseries (plus pre-bitbake2 backporting), if someone would
> like to test.
> > In addition, the compat test from the testsuite works (building hello-isar-
> compat).
> >
> > Still missing:
> > - not sure if -native also needs IMAGE_INSTALL logic to convert bitbake to
> debian names
>
> You mean foo-{compat,native} -> foo:<{compat-arch,host-arch}>? Would be
> sweet.
I'm already doing it for -compat.
With -native, my current use case is the SDK, which is completely in host-arch,
so we don't *need* to pass it with the individual packages. Also there is currently
no way of getting "dpkg --add-architecture <host-arch>" in a target image, so the
only place we can install -native packages is the SDK and the buildchroot if we're
doing cross builds.
So a conversion foo-native -> foo might be convenient (and consistent, so foo-native
is accepted as part of IMAGE_INSTALL, just as foo-compat), or we make it an
explicit foo-native -> foo:<host-arch>.
Adriaan
> > - documentation
>
> Specifically a RECIPES-API-CHANGELOG entry.
>
> > - test case for -native (maybe add libhello-native to the SDK?)
> > - probably other things...
> >
>
> Nice start!
>
> Jan
>
> --
> Siemens AG, Technology
> Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 3/3] remove obsolete compat-arch override
2023-02-06 13:34 ` Schmidt, Adriaan
@ 2023-02-06 14:22 ` Schmidt, Adriaan
0 siblings, 0 replies; 14+ messages in thread
From: Schmidt, Adriaan @ 2023-02-06 14:22 UTC (permalink / raw)
To: Kiszka, Jan, isar-users
Schmidt, Adriaan, Montag, 6. Februar 2023 14:35:
> Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, 6. Februar 2023 14:01:
> > On 06.02.23 13:20, Adriaan Schmidt wrote:
> > > The compat-arch override is no longer needed, as PACKAGE_ARCH is
> controlled
> > > by DEPENDing on <package>-compat.
> > >
> > > Also change the compat test: adding the compat package now happens via
> > > IMAGE_INSTALL in the config.
> > >
> > > Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> > > ---
> > > meta-isar/recipes-app/hello-isar/hello-isar.bb | 3 ---
> > > meta-isar/recipes-app/libhello/libhello.bb | 3 ---
> > > meta/conf/bitbake.conf | 3 +--
> > > .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 ++
> > > .../sbuild-chroot/sbuild-chroot.inc | 14 ++++++++------
> > > testsuite/cibuilder.py | 2 ++
> > > 6 files changed, 13 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb b/meta-
> > isar/recipes-app/hello-isar/hello-isar.bb
> > > index 39ddecb9..7d9f8322 100644
> > > --- a/meta-isar/recipes-app/hello-isar/hello-isar.bb
> > > +++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
> > > @@ -20,7 +20,4 @@ SRC_URI = " \
> > > file://yet-another-change.txt;apply=yes;striplevel=0"
> > > SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
> > >
> > > -# NOTE: This is just to test 32-bit building on 64-bit archs.
> > > -PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
> > > -
> > > inherit dpkg
> > > diff --git a/meta-isar/recipes-app/libhello/libhello.bb b/meta-
> > isar/recipes-app/libhello/libhello.bb
> > > index 3770fdb4..8b10842f 100644
> > > --- a/meta-isar/recipes-app/libhello/libhello.bb
> > > +++ b/meta-isar/recipes-app/libhello/libhello.bb
> > > @@ -13,7 +13,4 @@ PV = "0.1-98f2e41"
> > > SRC_URI =
> >
> "git://github.com/ilbers/libhello.git;protocol=https;branch=master;destsuffix
> > =${P}"
> > > SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"
> > >
> > > -# NOTE: This is just to test 32-bit building on 64-bit archs.
> > > -PACKAGE_ARCH:compat-arch = "${COMPAT_DISTRO_ARCH}"
> > > -
> > > inherit dpkg
> > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > > index f38bb447..1f010f4b 100644
> > > --- a/meta/conf/bitbake.conf
> > > +++ b/meta/conf/bitbake.conf
> > > @@ -67,9 +67,8 @@ KERNEL_FILE:mipsel ?= "vmlinux"
> > > KERNEL_FILE:riscv64 ?= "vmlinux"
> > > KERNEL_FILE:arm64 ?= "vmlinux"
> > >
> > > -OVERRIDES =
> >
> "${PACKAGE_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENA
> > ME}:forcevariable"
> > > +OVERRIDES =
> >
> "${PACKAGE_ARCH}:${MACHINE}:${DISTRO}:${BASE_DISTRO_CODENAME}:forcevariable"
> > > FILESOVERRIDES = "${PACKAGE_ARCH}:${MACHINE}"
> > > -COMPAT_OVERRIDE = "${@'compat-arch' if
> d.getVar('ISAR_ENABLE_COMPAT_ARCH')
> > == '1' else ''}"
> > >
> > > # Setting default QEMU_ARCH variables for different DISTRO_ARCH:
> > > QEMU_ARCH:amd64 = "x86_64"
> > > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > > index 99d75e21..21a2d92f 100644
> > > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > > @@ -274,6 +274,8 @@ do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
> > > do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config"
> > > do_bootstrap[network] = "${TASK_USE_NETWORK_AND_SUDO}"
> > >
> > > +inherit compat
> > > +
> > > do_bootstrap() {
> > > if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
> > > if [ -z "${COMPAT_DISTRO_ARCH}" ]; then
> > > diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > > index fb061dac..fd8bb648 100644
> > > --- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > > +++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> > > @@ -9,6 +9,7 @@ LIC_FILES_CHKSUM =
> > "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
> > > PV = "1.0"
> > >
> > > inherit rootfs
> > > +inherit compat
> > >
> > > python() {
> > > distro_gcc = d.getVar('DISTRO_GCC')
> > > @@ -20,18 +21,19 @@ python() {
> > > d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
> > > ' libstdc++-{}-dev:{}'.format(distro_gcc,
> > distro_arch))
> > >
> > > - if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
> > > - compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
> > > + if d.getVar('ISAR_ENABLE_COMPAT_ARCH') == '1':
> > > + compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
> > > + d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > > + ' libc6-dev:{}'.format(compat_arch))
> > > + d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > > + ' crossbuild-essential-{}'.format(compat_arch))
> > > + if d.getVar('DISTRO_GCC'):
> > > d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > > ' libgcc-{}-dev:{}'.format(distro_gcc,
> > compat_arch))
> > > d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
> > > ' libstdc++-{}-dev:{}'.format(distro_gcc,
> > compat_arch))
> > > }
> > >
> > > -SBUILD_CHROOT_COMPAT_PREINSTALL:compat-arch = " \
> > > - libc6-dev:${COMPAT_DISTRO_ARCH} \
> > > - crossbuild-essential-${COMPAT_DISTRO_ARCH}"
> > > -
> > > SBUILD_CHROOT_PREINSTALL_COMMON = " \
> > > ${SBUILD_CHROOT_COMPAT_PREINSTALL} \
> > > libc6-dev:${DISTRO_ARCH} \
> > > diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
> > > index 9d1b80f7..0b68e87d 100755
> > > --- a/testsuite/cibuilder.py
> > > +++ b/testsuite/cibuilder.py
> > > @@ -92,7 +92,9 @@ class CIBuilder(Test):
> > > with open(self.build_dir + '/conf/ci_build.conf', 'w') as f:
> > > if compat_arch:
> > > f.write('ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n')
> > > + f.write('IMAGE_INSTALL:append:amd64 = " hello-isar-
> > compat"\n')
> > > f.write('ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n')
> > > + f.write('IMAGE_INSTALL:append:arm64 = " hello-isar-
> > compat"\n')
> > > f.write('IMAGE_INSTALL += "kselftest"\n')
> > > if cross:
> > > f.write('ISAR_CROSS_COMPILE = "1"\n')
> >
> > This does not oull hello-isar-compat when doing a local build. We likely
> > need something in meta-isar/conf/local.conf.sample now.
>
> Ah, it works fine with ISAR_ENABLE_COMPAT_ARCH = "1", but not with
> ISAR_ENABLE_COMPAT_ARCH:amd64 = "1". Will have a look.
Found it! Next iteration will fix this.
Until then, for manual testing, please set ISAR_ENABLE_COMPAT_ARCH without
any overrides.
Adriaan
> Currently, that switch is still needed, otherwise the bootstrap
> and (s)buildchroot don't get "dpkg --add-architecture <compat-arch>".
> I added a check, to report and fail as early as possible if that is missing.
>
> Alternatively we could try to remove ISAR_ENABLE_COMPAT_ARCH completely
> and make everything implicit, e.g.:
> - have -compat targets depend on a (new) buildchroot-compat
> (or always have compat support in the buildchroot)
> - auto-detect (at rootfs creation, when we know which packages we want to
> install) if we need to add the compat arch to the image.
> But that would probably mean some bigger changes.
>
> Adriaan
>
> > Jan
> >
> > --
> > Siemens AG, Technology
> > Competence Center Embedded Linux
>
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to isar-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-
> users/AS4PR10MB53186E063C75CC2428C3C1CAEDDA9%40AS4PR10MB5318.EURPRD10.PROD.OU
> TLOOK.COM.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] multiarch support
2023-02-06 13:36 ` Schmidt, Adriaan
@ 2023-02-07 13:50 ` Jan Kiszka
2023-02-07 14:44 ` Schmidt, Adriaan
0 siblings, 1 reply; 14+ messages in thread
From: Jan Kiszka @ 2023-02-07 13:50 UTC (permalink / raw)
To: Schmidt, Adriaan (T CED SES-DE), isar-users
On 06.02.23 14:36, Schmidt, Adriaan (T CED SES-DE) wrote:
> Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, Montag, 6. Februar 2023 14:01:
>> On 06.02.23 13:20, Adriaan Schmidt wrote:
>>> Hi,
>>>
>>> this is my first working draft of multiarch support, which extends all
>> package
>>> recipes (inheriting dpkg-base) with *-compat and *-native variants.
>>>
>>> My current use case/test subject is meta-iot2050, which contains a patched
>>> openssl, needed in the SDK (as -native package), and on the target (as -
>> compat).
>>> [1] has this patchseries (plus pre-bitbake2 backporting), if someone would
>> like to test.
>>> In addition, the compat test from the testsuite works (building hello-isar-
>> compat).
>>>
>>> Still missing:
>>> - not sure if -native also needs IMAGE_INSTALL logic to convert bitbake to
>> debian names
>>
>> You mean foo-{compat,native} -> foo:<{compat-arch,host-arch}>? Would be
>> sweet.
>
> I'm already doing it for -compat.
> With -native, my current use case is the SDK, which is completely in host-arch,
> so we don't *need* to pass it with the individual packages. Also there is currently
> no way of getting "dpkg --add-architecture <host-arch>" in a target image, so the
> only place we can install -native packages is the SDK and the buildchroot if we're
> doing cross builds.
> So a conversion foo-native -> foo might be convenient (and consistent, so foo-native
> is accepted as part of IMAGE_INSTALL, just as foo-compat), or we make it an
> explicit foo-native -> foo:<host-arch>.
>
What now comes to my mind: What will happen if there are real Debian
packages that carry any of those suffixes in their name? There is e.g.
libgdbm-compat4 - that would be only close.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 0/3] multiarch support
2023-02-07 13:50 ` Jan Kiszka
@ 2023-02-07 14:44 ` Schmidt, Adriaan
2023-02-20 8:54 ` Schmidt, Adriaan
0 siblings, 1 reply; 14+ messages in thread
From: Schmidt, Adriaan @ 2023-02-07 14:44 UTC (permalink / raw)
To: Kiszka, Jan, isar-users
Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, Dienstag, 7. Februar 2023 14:51:
> On 06.02.23 14:36, Schmidt, Adriaan (T CED SES-DE) wrote:
> > Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, Montag, 6. Februar 2023
> 14:01:
> >> On 06.02.23 13:20, Adriaan Schmidt wrote:
> >>> Hi,
> >>>
> >>> this is my first working draft of multiarch support, which extends all
> >> package
> >>> recipes (inheriting dpkg-base) with *-compat and *-native variants.
> >>>
> >>> My current use case/test subject is meta-iot2050, which contains a
> patched
> >>> openssl, needed in the SDK (as -native package), and on the target (as -
> >> compat).
> >>> [1] has this patchseries (plus pre-bitbake2 backporting), if someone
> would
> >> like to test.
> >>> In addition, the compat test from the testsuite works (building hello-
> isar-
> >> compat).
> >>>
> >>> Still missing:
> >>> - not sure if -native also needs IMAGE_INSTALL logic to convert bitbake
> to
> >> debian names
> >>
> >> You mean foo-{compat,native} -> foo:<{compat-arch,host-arch}>? Would be
> >> sweet.
> >
> > I'm already doing it for -compat.
> > With -native, my current use case is the SDK, which is completely in host-
> arch,
> > so we don't *need* to pass it with the individual packages. Also there is
> currently
> > no way of getting "dpkg --add-architecture <host-arch>" in a target image,
> so the
> > only place we can install -native packages is the SDK and the buildchroot
> if we're
> > doing cross builds.
> > So a conversion foo-native -> foo might be convenient (and consistent, so
> foo-native
> > is accepted as part of IMAGE_INSTALL, just as foo-compat), or we make it an
> > explicit foo-native -> foo:<host-arch>.
> >
>
> What now comes to my mind: What will happen if there are real Debian
> packages that carry any of those suffixes in their name? There is e.g.
> libgdbm-compat4 - that would be only close.
Yes, quick check on my development machin: "dpkg -l *-compat" returns
debhelper-compat, iptables-nftables-compat, oss-compat, and x2goserver-compat.
But that's only a problem if someone wants to rebuild one of those packages,
otherwise they would go into IMAGE_PREINSTALL, which is not modified, and
has packages in "Debian syntax".
In general, with the proposed extension, it could be that bitbake recipes with
names ending in -compat or -native would no longer be allowed.
I'd have to verify the details, and can check if some kind of workaround is possible.
Adriaan
> Jan
>
> --
> Siemens AG, Technology
> Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 0/3] multiarch support
2023-02-07 14:44 ` Schmidt, Adriaan
@ 2023-02-20 8:54 ` Schmidt, Adriaan
0 siblings, 0 replies; 14+ messages in thread
From: Schmidt, Adriaan @ 2023-02-20 8:54 UTC (permalink / raw)
To: Kiszka, Jan, isar-users
Schmidt, Adriaan, Dienstag, 7. Februar 2023 15:45:
> Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, Dienstag, 7. Februar 2023
> 14:51:
> > On 06.02.23 14:36, Schmidt, Adriaan (T CED SES-DE) wrote:
> > > Kiszka, Jan (T CED) <jan.kiszka@siemens.com>, Montag, 6. Februar 2023
> > 14:01:
> > >> On 06.02.23 13:20, Adriaan Schmidt wrote:
> > >>> Hi,
> > >>>
> > >>> this is my first working draft of multiarch support, which extends all
> > >> package
> > >>> recipes (inheriting dpkg-base) with *-compat and *-native variants.
> > >>>
> > >>> My current use case/test subject is meta-iot2050, which contains a
> > patched
> > >>> openssl, needed in the SDK (as -native package), and on the target (as
> -
> > >> compat).
> > >>> [1] has this patchseries (plus pre-bitbake2 backporting), if someone
> > would
> > >> like to test.
> > >>> In addition, the compat test from the testsuite works (building hello-
> > isar-
> > >> compat).
> > >>>
> > >>> Still missing:
> > >>> - not sure if -native also needs IMAGE_INSTALL logic to convert bitbake
> > to
> > >> debian names
> > >>
> > >> You mean foo-{compat,native} -> foo:<{compat-arch,host-arch}>? Would be
> > >> sweet.
> > >
> > > I'm already doing it for -compat.
> > > With -native, my current use case is the SDK, which is completely in
> host-
> > arch,
> > > so we don't *need* to pass it with the individual packages. Also there is
> > currently
> > > no way of getting "dpkg --add-architecture <host-arch>" in a target
> image,
> > so the
> > > only place we can install -native packages is the SDK and the buildchroot
> > if we're
> > > doing cross builds.
> > > So a conversion foo-native -> foo might be convenient (and consistent, so
> > foo-native
> > > is accepted as part of IMAGE_INSTALL, just as foo-compat), or we make it
> an
> > > explicit foo-native -> foo:<host-arch>.
v2 will also convert foo-native to foo:<host-arch>.
> >
> > What now comes to my mind: What will happen if there are real Debian
> > packages that carry any of those suffixes in their name? There is e.g.
> > libgdbm-compat4 - that would be only close.
>
> Yes, quick check on my development machin: "dpkg -l *-compat" returns
> debhelper-compat, iptables-nftables-compat, oss-compat, and x2goserver-
> compat.
>
> But that's only a problem if someone wants to rebuild one of those packages,
> otherwise they would go into IMAGE_PREINSTALL, which is not modified, and
> has packages in "Debian syntax".
>
> In general, with the proposed extension, it could be that bitbake recipes
> with
> names ending in -compat or -native would no longer be allowed.
> I'd have to verify the details, and can check if some kind of workaround is
> possible.
Indeed, bitbake recipes can't have names ending in -compat or -native, and there
seems to be no simple way around it.
But since recipe names are independent of the Debian packages they produce,
we can still re-compile (or generate) Debian packages with those endings,
just need use a different name for the recipe and be careful with the
DEPENDS and IMAGE_INSTALL...
Adriaan
>
> Adriaan
>
> > Jan
> >
> > --
> > Siemens AG, Technology
> > Competence Center Embedded Linux
>
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to isar-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-
> users/AS4PR10MB5318B9ACBAF27FA2470FFA93EDDB9%40AS4PR10MB5318.EURPRD10.PROD.OU
> TLOOK.COM.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] add multiarch support
2023-02-06 12:20 ` [PATCH 2/3] add multiarch support Adriaan Schmidt
@ 2023-02-28 7:58 ` Cedric Hombourger
2023-02-28 8:24 ` Schmidt, Adriaan
0 siblings, 1 reply; 14+ messages in thread
From: Cedric Hombourger @ 2023-02-28 7:58 UTC (permalink / raw)
To: isar-users
[-- Attachment #1.1: Type: text/plain, Size: 8351 bytes --]
On Monday, February 6, 2023 at 1:21:27 PM UTC+1 Adriaan Schmidt wrote:
This adds support for building packages for native and compat architectures
to dpdk-base.bbclass.
Thus, all package recipes automatically have a *-native and *-compat
target,
which can be used in DEPENDS/RDEPENDS definitions.
Additionally *-compat targets can be used in IMAGE_INSTALL, where they
are automatically converted to install package:${COMPAT_DISTRO_ARCH}.
Note that the switch ISAR_ENABLE_COMPAT_ARCH still exist and controls
addition of the compat architecture during bootstrapping.
Signed-off-by: Adriaan Schmidt <adriaan...@siemens.com>
---
.../recipes-app/samefile/samefile_2.14.bb | 2 +-
meta/classes/compat.bbclass | 49 +++++++++++++++++++
meta/classes/debianize.bbclass | 2 +-
meta/classes/dpkg-base.bbclass | 1 +
meta/classes/image.bbclass | 4 +-
meta/classes/multiarch.bbclass | 44 +++++++++++++++++
meta/classes/native.bbclass | 10 ++++
meta/conf/bitbake.conf | 1 +
8 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 meta/classes/compat.bbclass
create mode 100644 meta/classes/multiarch.bbclass
create mode 100644 meta/classes/native.bbclass
diff --git a/meta-isar/recipes-app/samefile/samefile_2.14.bb
b/meta-isar/recipes-app/samefile/samefile_2.14.bb
index 5e36a2ac..c53c9445 100644
--- a/meta-isar/recipes-app/samefile/samefile_2.14.bb
+++ b/meta-isar/recipes-app/samefile/samefile_2.14.bb
@@ -21,7 +21,7 @@ do_prepare_build() {
# deb_debianize. Pre-exisiting files will not be recreated, changelog
# will be prepended unless its latest entry is for CHANGELOG_V.
cat << EOF > ${WORKDIR}/changelog
-${PN} (0.1) unstable; urgency=low
+${BPN} (0.1) unstable; urgency=low
* a long long time ago there was an early version
diff --git a/meta/classes/compat.bbclass b/meta/classes/compat.bbclass
new file mode 100644
index 00000000..7142ec3a
--- /dev/null
+++ b/meta/classes/compat.bbclass
@@ -0,0 +1,49 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+# this class is "dual-use": it can be inherited (e.g., by bootstrap and
image
+# classes) to access variables and functions, and it's also addedd via
BBCLASSEXTEND
+# when inheriting multiconfig.bbclass.
+
+################################################################################
+# generic functions
+################################################################################
+
+# calcucate COMPAT_DISTRO_ARCH
typo: calculate (but since it's not really a computation per se, I would
just say determine)
+# we can't use simple overrides, because in case we're building a package
+# with a PACKAGE_ARCH != DISTRO_ARCH, overrides would find the wrong
value.
+python() {
+ distro_arch = d.getVar('DISTRO_ARCH')
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH:' + distro_arch)
+ if compat_distro_arch is None and 'class-compat' in
d.getVar('OVERRIDES').split(':'):
+ bb.fatal(f"{distro_arch} does not have a compat arch")
+ d.setVar('COMPAT_DISTRO_ARCH', compat_distro_arch)
+}
+
+# function to convert bitbake targets to installable debian packages,
+# e.g., "hello-compat" to "hello:i386".
+def isar_compat_packages(var, d):
+ bb_targets = (d.getVar(var, True) or '').split()
+ packages = []
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH', True)
+ for t in bb_targets:
+ if t.endswith('-compat'):
+ packages.append(t[:-len('-compat')] + ':' + compat_distro_arch)
+ else:
+ packages.append(t)
+ return ' '.join(packages)
+
+
+################################################################################
+# package recipe modifications when actually building *-compat:
+################################################################################
+
+# check that we can actually build compat (ISAR_ENABLE_COMPAT_ARCH is set)
+python do_fetch:prepend:class-compat() {
+ if not d.getVar('ISAR_ENABLE_COMPAT_ARCH', True) == '1':
+ bb.fatal("compat package requested, but ISAR_ENABLE_COMPAT_ARCH is not
set.")
+}
+
+PACKAGE_ARCH:class-compat = "${COMPAT_DISTRO_ARCH}"
diff --git a/meta/classes/debianize.bbclass
b/meta/classes/debianize.bbclass
index a6694a00..1b98c02d 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -31,7 +31,7 @@ deb_add_changelog() {
date=$(LANG=C date -R -d @${timestamp})
cat <<EOF > ${S}/debian/changelog
-${PN} (${changelog_v}) UNRELEASED; urgency=low
+${BPN} (${changelog_v}) UNRELEASED; urgency=low
* generated by Isar
diff --git a/meta/classes/dpkg-base.bbclass
b/meta/classes/dpkg-base.bbclass
index ad28f7b3..55cc6655 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -5,6 +5,7 @@
# SPDX-License-Identifier: MIT
inherit sbuild
+inherit multiarch
inherit debianize
inherit terminal
inherit repository
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 539ec51d..8d0dda30 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -79,9 +79,11 @@ image_do_mounts() {
buildchroot_do_mounts
}
+inherit compat
+
ROOTFSDIR = "${IMAGE_ROOTFS}"
ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest
export-dpkg-status clean-log-files clean-debconf-cache"
-ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
+ROOTFS_PACKAGES += "${IMAGE_PREINSTALL}
${@isar_compat_packages('IMAGE_INSTALL', d)}"
ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
ROOTFS_PACKAGE_SUFFIX ?= "${PN}-${DISTRO}-${MACHINE}"
diff --git a/meta/classes/multiarch.bbclass
b/meta/classes/multiarch.bbclass
new file mode 100644
index 00000000..5b280699
--- /dev/null
+++ b/meta/classes/multiarch.bbclass
@@ -0,0 +1,44 @@
+# This software is a part of ISAR.
+# Copyright (C) 2021-2022 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+BBCLASSEXTEND += "native compat"
+BPN = "${PN}"
+
+python multiarch_virtclass_handler() {
+ def fixup_pn_in_vars(d):
+ vars = 'SRC_URI FILESPATH'.split()
+ for var in vars:
+ v = d.getVar(var, False)
+ if v is not None:
+ d.setVar(var, v.replace('${PN}', '${BPN}'))
+
+ def fixup_depends(suffix, d):
+ vars = 'PROVIDES RPROVIDES DEPENDS RDEPENDS'.split()
+ for var in vars:
+ multiarch_var = []
+ val = d.getVar(var, True)
+ if val is None:
+ continue
+ for v in val.split():
+ if v.endswith('-compat') or v.endswith('-native'):
+ multiarch_var.append(v)
+ else:
+ multiarch_var.append(v + suffix)
+ d.setVar(var, ' '.join(multiarch_var))
+
+ pn = e.data.getVar('PN')
+ if pn.endswith('-compat'):
+ e.data.setVar('BPN', pn[:-len('-compat')])
+ e.data.appendVar('OVERRIDES', ':class-compat')
+ fixup_pn_in_vars(e.data)
+ fixup_depends('-compat', e.data)
+ elif pn.endswith('-native'):
+ e.data.setVar('BPN', pn[:-len('-native')])
+ e.data.appendVar('OVERRIDES', ':class-native')
+ fixup_pn_in_vars(e.data)
+ fixup_depends('-native', e.data)
+}
+addhandler multiarch_virtclass_handler
+multiarch_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
new file mode 100644
index 00000000..ef20e8bc
--- /dev/null
+++ b/meta/classes/native.bbclass
@@ -0,0 +1,10 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+################################################################################
+# package recipe modifications when actually building *-native:
+################################################################################
+
+PACKAGE_ARCH:class-native = "${HOST_ARCH}"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f1a9438e..f38bb447 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -81,6 +81,7 @@ QEMU_ARCH:riscv64 = "riscv64"
# Codename of the repository created by the caching class
DEBDISTRONAME ?= "isar"
+NATIVELSBSTRING ?= "isarnative"
# Strings used in sstate signature files
TARGET_VENDOR = ""
--
2.30.2
[-- Attachment #1.2: Type: text/html, Size: 10674 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 2/3] add multiarch support
2023-02-28 7:58 ` Cedric Hombourger
@ 2023-02-28 8:24 ` Schmidt, Adriaan
0 siblings, 0 replies; 14+ messages in thread
From: Schmidt, Adriaan @ 2023-02-28 8:24 UTC (permalink / raw)
To: Cedric Hombourger, isar-users
Hi Cedric,
Sorry for top-posting, but I didn't manage to inline-format nicely with your HTML mail and Outlook...
Please note that you're reviewing v1 of this series, and I'm currently at v3 (from Feb 24). So that typo is no longer there, but I'm happy to change "calculate" -> "determine" in that comment.
(And also the getVar(xx, True) thing will be changed for the next iteration).
Thanks,
Adriaan
From: isar-users@googlegroups.com <isar-users@googlegroups.com> On Behalf Of Cedric Hombourger
Sent: Dienstag, 28. Februar 2023 08:58
To: isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH 2/3] add multiarch support
On Monday, February 6, 2023 at 1:21:27 PM UTC+1 Adriaan Schmidt wrote:
This adds support for building packages for native and compat architectures
to dpdk-base.bbclass.
Thus, all package recipes automatically have a *-native and *-compat target,
which can be used in DEPENDS/RDEPENDS definitions.
Additionally *-compat targets can be used in IMAGE_INSTALL, where they
are automatically converted to install package:${COMPAT_DISTRO_ARCH}.
Note that the switch ISAR_ENABLE_COMPAT_ARCH still exist and controls
addition of the compat architecture during bootstrapping.
Signed-off-by: Adriaan Schmidt <adriaan...@siemens.com>
---
.../recipes-app/samefile/http://samefile_2.14.bb | 2 +-
meta/classes/compat.bbclass | 49 +++++++++++++++++++
meta/classes/debianize.bbclass | 2 +-
meta/classes/dpkg-base.bbclass | 1 +
meta/classes/image.bbclass | 4 +-
meta/classes/multiarch.bbclass | 44 +++++++++++++++++
meta/classes/native.bbclass | 10 ++++
meta/conf/bitbake.conf | 1 +
8 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 meta/classes/compat.bbclass
create mode 100644 meta/classes/multiarch.bbclass
create mode 100644 meta/classes/native.bbclass
diff --git a/meta-isar/recipes-app/samefile/http://samefile_2.14.bb b/meta-isar/recipes-app/samefile/http://samefile_2.14.bb
index 5e36a2ac..c53c9445 100644
--- a/meta-isar/recipes-app/samefile/http://samefile_2.14.bb
+++ b/meta-isar/recipes-app/samefile/http://samefile_2.14.bb
@@ -21,7 +21,7 @@ do_prepare_build() {
# deb_debianize. Pre-exisiting files will not be recreated, changelog
# will be prepended unless its latest entry is for CHANGELOG_V.
cat << EOF > ${WORKDIR}/changelog
-${PN} (0.1) unstable; urgency=low
+${BPN} (0.1) unstable; urgency=low
* a long long time ago there was an early version
diff --git a/meta/classes/compat.bbclass b/meta/classes/compat.bbclass
new file mode 100644
index 00000000..7142ec3a
--- /dev/null
+++ b/meta/classes/compat.bbclass
@@ -0,0 +1,49 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+# this class is "dual-use": it can be inherited (e.g., by bootstrap and image
+# classes) to access variables and functions, and it's also addedd via BBCLASSEXTEND
+# when inheriting multiconfig.bbclass.
+
+################################################################################
+# generic functions
+################################################################################
+
+# calcucate COMPAT_DISTRO_ARCH
typo: calculate (but since it's not really a computation per se, I would just say determine)
+# we can't use simple overrides, because in case we're building a package
+# with a PACKAGE_ARCH != DISTRO_ARCH, overrides would find the wrong value.
+python() {
+ distro_arch = d.getVar('DISTRO_ARCH')
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH:' + distro_arch)
+ if compat_distro_arch is None and 'class-compat' in d.getVar('OVERRIDES').split(':'):
+ bb.fatal(f"{distro_arch} does not have a compat arch")
+ d.setVar('COMPAT_DISTRO_ARCH', compat_distro_arch)
+}
+
+# function to convert bitbake targets to installable debian packages,
+# e.g., "hello-compat" to "hello:i386".
+def isar_compat_packages(var, d):
+ bb_targets = (d.getVar(var, True) or '').split()
+ packages = []
+ compat_distro_arch = d.getVar('COMPAT_DISTRO_ARCH', True)
+ for t in bb_targets:
+ if t.endswith('-compat'):
+ packages.append(t[:-len('-compat')] + ':' + compat_distro_arch)
+ else:
+ packages.append(t)
+ return ' '.join(packages)
+
+
+################################################################################
+# package recipe modifications when actually building *-compat:
+################################################################################
+
+# check that we can actually build compat (ISAR_ENABLE_COMPAT_ARCH is set)
+python do_fetch:prepend:class-compat() {
+ if not d.getVar('ISAR_ENABLE_COMPAT_ARCH', True) == '1':
+ bb.fatal("compat package requested, but ISAR_ENABLE_COMPAT_ARCH is not set.")
+}
+
+PACKAGE_ARCH:class-compat = "${COMPAT_DISTRO_ARCH}"
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index a6694a00..1b98c02d 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -31,7 +31,7 @@ deb_add_changelog() {
date=$(LANG=C date -R -d @${timestamp})
cat <<EOF > ${S}/debian/changelog
-${PN} (${changelog_v}) UNRELEASED; urgency=low
+${BPN} (${changelog_v}) UNRELEASED; urgency=low
* generated by Isar
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index ad28f7b3..55cc6655 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -5,6 +5,7 @@
# SPDX-License-Identifier: MIT
inherit sbuild
+inherit multiarch
inherit debianize
inherit terminal
inherit repository
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 539ec51d..8d0dda30 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -79,9 +79,11 @@ image_do_mounts() {
buildchroot_do_mounts
}
+inherit compat
+
ROOTFSDIR = "${IMAGE_ROOTFS}"
ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache"
-ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
+ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${@isar_compat_packages('IMAGE_INSTALL', d)}"
ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
ROOTFS_PACKAGE_SUFFIX ?= "${PN}-${DISTRO}-${MACHINE}"
diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
new file mode 100644
index 00000000..5b280699
--- /dev/null
+++ b/meta/classes/multiarch.bbclass
@@ -0,0 +1,44 @@
+# This software is a part of ISAR.
+# Copyright (C) 2021-2022 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+BBCLASSEXTEND += "native compat"
+BPN = "${PN}"
+
+python multiarch_virtclass_handler() {
+ def fixup_pn_in_vars(d):
+ vars = 'SRC_URI FILESPATH'.split()
+ for var in vars:
+ v = d.getVar(var, False)
+ if v is not None:
+ d.setVar(var, v.replace('${PN}', '${BPN}'))
+
+ def fixup_depends(suffix, d):
+ vars = 'PROVIDES RPROVIDES DEPENDS RDEPENDS'.split()
+ for var in vars:
+ multiarch_var = []
+ val = d.getVar(var, True)
+ if val is None:
+ continue
+ for v in val.split():
+ if v.endswith('-compat') or v.endswith('-native'):
+ multiarch_var.append(v)
+ else:
+ multiarch_var.append(v + suffix)
+ d.setVar(var, ' '.join(multiarch_var))
+
+ pn = e.data.getVar('PN')
+ if pn.endswith('-compat'):
+ e.data.setVar('BPN', pn[:-len('-compat')])
+ e.data.appendVar('OVERRIDES', ':class-compat')
+ fixup_pn_in_vars(e.data)
+ fixup_depends('-compat', e.data)
+ elif pn.endswith('-native'):
+ e.data.setVar('BPN', pn[:-len('-native')])
+ e.data.appendVar('OVERRIDES', ':class-native')
+ fixup_pn_in_vars(e.data)
+ fixup_depends('-native', e.data)
+}
+addhandler multiarch_virtclass_handler
+multiarch_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
new file mode 100644
index 00000000..ef20e8bc
--- /dev/null
+++ b/meta/classes/native.bbclass
@@ -0,0 +1,10 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+################################################################################
+# package recipe modifications when actually building *-native:
+################################################################################
+
+PACKAGE_ARCH:class-native = "${HOST_ARCH}"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f1a9438e..f38bb447 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -81,6 +81,7 @@ QEMU_ARCH:riscv64 = "riscv64"
# Codename of the repository created by the caching class
DEBDISTRONAME ?= "isar"
+NATIVELSBSTRING ?= "isarnative"
# Strings used in sstate signature files
TARGET_VENDOR = ""
--
2.30.2
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mailto:isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/b158435c-ec29-48f2-afa8-61bc513144f4n%40googlegroups.com?utm_medium=email&utm_source=footer.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-02-28 8:24 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 12:20 [PATCH 0/3] multiarch support Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 1/3] bitbake.conf: use PACKAGE_ARCH in overrides Adriaan Schmidt
2023-02-06 12:20 ` [PATCH 2/3] add multiarch support Adriaan Schmidt
2023-02-28 7:58 ` Cedric Hombourger
2023-02-28 8:24 ` Schmidt, Adriaan
2023-02-06 12:20 ` [PATCH 3/3] remove obsolete compat-arch override Adriaan Schmidt
2023-02-06 13:00 ` Jan Kiszka
2023-02-06 13:34 ` Schmidt, Adriaan
2023-02-06 14:22 ` Schmidt, Adriaan
2023-02-06 13:01 ` [PATCH 0/3] multiarch support Jan Kiszka
2023-02-06 13:36 ` Schmidt, Adriaan
2023-02-07 13:50 ` Jan Kiszka
2023-02-07 14:44 ` Schmidt, Adriaan
2023-02-20 8:54 ` Schmidt, Adriaan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox