From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2 1/4] Add compat architecture support via multiarch
Date: Fri, 11 Sep 2020 14:13:06 +0200 [thread overview]
Message-ID: <f0c1beb47c6382e1ec538b5c3b2b20af5c33ae75.1599826389.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1599826389.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Allow building and installing 32-bit packages an 64-bit architectures
that support this. Namely, these are amd64 and arm64 for us so far,
minus stretch-amd64 which lacks crossbuild-essential-i386 in that
version.
Control the target architecture of a package is added via the
PACKAGE_ARCH variable that defaults to DISTRO_ARCH. When set to
COMPAT_DISTRO_ARCH, the package is built for i386 on amd64 and armhf on
arm64.
If the build environment and the target image should contain the compat
arch is controlled via setting ISAR_ENABLE_COMPAT_ARCH to 1.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/conf/local.conf.sample | 5 +++++
meta/classes/dpkg.bbclass | 8 +++++---
meta/conf/bitbake.conf | 3 ++-
meta/conf/distro/debian-common.conf | 3 +++
.../recipes-core/isar-bootstrap/isar-bootstrap.inc | 14 +++++++++++++-
meta/recipes-devtools/buildchroot/buildchroot.inc | 5 +++++
meta/recipes-devtools/sdkchroot/sdkchroot.bb | 1 +
7 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index e842c129..2f82020d 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -175,6 +175,11 @@ IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsc
# Enable cross-compilation support
ISAR_CROSS_COMPILE ?= "0"
+#
+# Uncomment to enable 32-bit compat architecture support
+# NOTE: this works for amd64 and arm64 targets so far
+#ISAR_ENABLE_COMPAT_ARCH ?= "1"
+
#
# Uncomment this to enable use of cached base repository
#ISAR_USE_CACHED_BASE_REPO ?= "1"
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index acccc1f2..a24386df 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -3,16 +3,18 @@
inherit dpkg-base
+PACKAGE_ARCH ?= "${DISTRO_ARCH}"
+
# Install build dependencies for package
do_install_builddeps() {
dpkg_do_mounts
E="${@ isar_export_proxies(d)}"
deb_dl_dir_import "${BUILDCHROOT_DIR}"
sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \
- ${PP}/${PPS} ${DISTRO_ARCH} --download-only
+ ${PP}/${PPS} ${PACKAGE_ARCH} --download-only
deb_dl_dir_export "${BUILDCHROOT_DIR}"
sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \
- ${PP}/${PPS} ${DISTRO_ARCH}
+ ${PP}/${PPS} ${PACKAGE_ARCH}
dpkg_undo_mounts
}
@@ -27,5 +29,5 @@ dpkg_runbuild() {
E="${@ isar_export_proxies(d)}"
export PARALLEL_MAKE="${PARALLEL_MAKE}"
sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
- /isar/build.sh ${PP}/${PPS} ${DISTRO_ARCH}
+ /isar/build.sh ${PP}/${PPS} ${PACKAGE_ARCH}
}
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index d2834f53..3f136ca1 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -62,8 +62,9 @@ KERNEL_FILE ?= "vmlinuz"
KERNEL_FILE_mipsel ?= "vmlinux"
KERNEL_FILE_riscv64 ?= "vmlinux"
-OVERRIDES = "${DISTRO_ARCH}:${MACHINE}:${DISTRO}:forcevariable"
+OVERRIDES = "${DISTRO_ARCH}:${COMPAT_OVERRIDE}:${MACHINE}:${DISTRO}:forcevariable"
FILESOVERRIDES = "${DISTRO_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/conf/distro/debian-common.conf b/meta/conf/distro/debian-common.conf
index 7d681c49..582678f6 100644
--- a/meta/conf/distro/debian-common.conf
+++ b/meta/conf/distro/debian-common.conf
@@ -22,3 +22,6 @@ GRUB_BOOTLOADER_INSTALL_armhf = "grub-efi-arm-bin"
GRUB_BOOTLOADER_INSTALL_arm64 = "grub-efi-arm64-bin"
SYSLINUX_BOOTLOADER_INSTALL = "syslinux syslinux-common"
+
+COMPAT_DISTRO_ARCH_amd64 = "i386"
+COMPAT_DISTRO_ARCH_arm64 = "armhf"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index da0d436b..fbfe669d 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -222,7 +222,7 @@ def get_host_release():
rel = platform.release()
return rel
-do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS"
+do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS ISAR_ENABLE_COMPAT_ARCH"
do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
do_bootstrap[depends] = "base-apt:do_cache"
@@ -236,6 +236,14 @@ isar_bootstrap() {
esac
shift
done
+ if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
+ if [ -z "${COMPAT_DISTRO_ARCH}" ]; then
+ bbfatal "${DISTRO_ARCH} does not have a compat arch"
+ fi
+ if [ "${@get_distro_suite(d, True)}-${COMPAT_DISTRO_ARCH}" = "stretch-i386" ]; then
+ bbfatal "compat arch build for stretch-i386 not supported"
+ fi
+ fi
debootstrap_args="--verbose --variant=minbase --include=${DISTRO_BOOTSTRAP_BASE_PACKAGES}"
if [ -f "${DISTRO_BOOTSTRAP_KEYRING}" ]; then
debootstrap_args="$debootstrap_args --keyring=${DISTRO_BOOTSTRAP_KEYRING}"
@@ -330,6 +338,10 @@ isar_bootstrap() {
chroot "${ROOTFSDIR}" /usr/bin/dpkg --add-architecture ${DISTRO_ARCH}
fi
+ if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ]; then
+ chroot "${ROOTFSDIR}" /usr/bin/dpkg --add-architecture ${COMPAT_DISTRO_ARCH}
+ fi
+
chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y
chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y -f
chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc b/meta/recipes-devtools/buildchroot/buildchroot.inc
index b4d7b764..835968de 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.inc
+++ b/meta/recipes-devtools/buildchroot/buildchroot.inc
@@ -22,7 +22,12 @@ ROOTFS_CLEAN_FILES = ""
ROOTFS_MANIFEST_DEPLOY_DIR = "${DEPLOY_DIR_BUILDCHROOT}"
ROOTFS_FEATURES += "generate-manifest"
+BUILDCHROOT_COMPAT_PREINSTALL_compat-arch = " \
+ libc6:${COMPAT_DISTRO_ARCH} \
+ crossbuild-essential-${COMPAT_DISTRO_ARCH}"
+
BUILDCHROOT_PREINSTALL_COMMON = " \
+ ${BUILDCHROOT_COMPAT_PREINSTALL} \
make \
debhelper \
autotools-dev \
diff --git a/meta/recipes-devtools/sdkchroot/sdkchroot.bb b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
index bf3f6fb4..2bf3f5bc 100644
--- a/meta/recipes-devtools/sdkchroot/sdkchroot.bb
+++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
@@ -22,6 +22,7 @@ DEPENDS += "${SDK_INSTALL}"
TOOLCHAIN = "crossbuild-essential-${DISTRO_ARCH}"
TOOLCHAIN_${HOST_ARCH} = "build-essential"
TOOLCHAIN_i386 = "build-essential"
+TOOLCHAIN_append_compat-arch = " crossbuild-essential-${COMPAT_DISTRO_ARCH}"
inherit rootfs
ROOTFS_ARCH = "${HOST_ARCH}"
--
2.26.2
next prev parent reply other threads:[~2020-09-11 12:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-11 12:13 [PATCH v2 0/4] 32-bit compat arch support Jan Kiszka
2020-09-11 12:13 ` Jan Kiszka [this message]
2020-09-11 12:13 ` [PATCH v2 2/4] ci: Add " Jan Kiszka
2020-09-11 12:13 ` [PATCH v2 3/4] doc: Enhance list of supported cross-archs, drop QEMU reference Jan Kiszka
2020-09-11 12:13 ` [PATCH v2 4/4] doc: Describe new compat arch support Jan Kiszka
2020-09-21 9:24 ` [PATCH v2 0/4] 32-bit " Jan Kiszka
2020-09-21 9:41 ` Baurzhan Ismagulov
2020-09-21 12:06 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0c1beb47c6382e1ec538b5c3b2b20af5c33ae75.1599826389.git.jan.kiszka@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox