@@ -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"
@@ -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}
}
@@ -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"
@@ -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"
@@ -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 \
@@ -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 \
@@ -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}"