public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [RFC 2/2] rootfs: use host apt when installing in cross mode
Date: Mon, 20 Jul 2026 12:52:28 +0200	[thread overview]
Message-ID: <20260720105228.395364-2-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20260720105228.395364-1-felix.moessbauer@siemens.com>

Currently the apt inside the chroot is used to perform the extraction
and installation. This is really slow on non native architectures (esp.
on larger packages), as the whole operation is emulated.

We improve this by using the host apt for the dependency resolution,
unpack and configure operation. The dpkg chroots into the rootfs to run
the target maintainer scripts (emulated via qemu in cross builds),
mirroring how mmdebstrap installs. As we already have all packages in
the apt cache (since e09589d28), we don't need to mount the isar apt or
base apt - which would not work as the host apt would lookup the
absolute apt paths on the host (i.e. read /isar-apt from the host
instead of the chroot).

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/rootfs.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 6af29b40..95210f4c 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -390,9 +390,15 @@ rootfs_install_pkgs_install[network] = "${TASK_USE_SUDO}"
 rootfs_install_pkgs_install() {
     run_privileged_heredoc <<'EOF'
     set -e
+    # Unpack and configure packages using the host apt. Dependency resolution
+    # and the apt frontend run natively (-o Dir points at the rootfs), while
+    # dpkg chroots into the rootfs to run the target maintainer scripts
+    # (emulated via qemu in cross builds), mirroring how mmdebstrap installs.
     ${@insert_isar_mounts(d, d.getVar('ROOTFSDIR'), d.getVar('ROOTFS_MOUNTS')) if d.getVar('ISAR_CHROOT_MODE') == 'unshare' else ''}
-    chroot "${ROOTFSDIR}" \
-        /usr/bin/apt-get ${ROOTFS_APT_ARGS} --no-download ${ROOTFS_PACKAGES}
+    /usr/bin/apt-get -o APT::Architecture=${ROOTFS_ARCH} \
+        -o Dir="${ROOTFSDIR}" \
+        -o DPkg::Chroot-Directory="${ROOTFSDIR}" \
+        ${ROOTFS_APT_ARGS} --no-download ${ROOTFS_PACKAGES}
 EOF
 }
 
-- 
2.53.0

-- 
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 visit https://groups.google.com/d/msgid/isar-users/20260720105228.395364-2-felix.moessbauer%40siemens.com.

  reply	other threads:[~2026-07-20 10:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 10:52 [RFC 1/2] rootfs: download packages with host apt 'Felix Moessbauer' via isar-users
2026-07-20 10:52 ` 'Felix Moessbauer' via isar-users [this message]
2026-07-21 13:58   ` [RFC 2/2] rootfs: use host apt when installing in cross mode Anton Mikanovich
2026-07-21 13:56 ` [RFC 1/2] rootfs: download packages with host apt Anton Mikanovich
2026-07-21 15:02   ` 'MOESSBAUER, Felix' via isar-users

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=20260720105228.395364-2-felix.moessbauer@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=felix.moessbauer@siemens.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