public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 3/4] rootfs: Avoid unneeded commands inside chroot
Date: Mon, 15 Sep 2025 12:07:12 +0200	[thread overview]
Message-ID: <f547f9c01860fe224a3531b74d10db1d946cbcf5.1757930833.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1757930833.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

As the chroot implies emulation in case of cross-installation, any call
into it that can be avoided saves a few seconds.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/rootfs.bbclass | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index de8077e6..f02397b8 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -245,8 +245,11 @@ rootfs_export_package_cache() {
 ROOTFS_INSTALL_COMMAND += "${@ 'rootfs_install_clean_files' if (d.getVar('ROOTFS_CLEAN_FILES') or '').strip() else ''}"
 rootfs_install_clean_files[weight] = "2"
 rootfs_install_clean_files() {
-    sudo -E chroot '${ROOTFSDIR}' \
-        /bin/rm -f ${ROOTFS_CLEAN_FILES}
+    sudo -s <<'EOSUDO'
+    for clean_file in ${ROOTFS_CLEAN_FILES}; do
+        rm -f "${ROOTFSDIR}/$clean_file"
+    done
+EOSUDO
 }
 
 ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_install"
@@ -490,10 +493,10 @@ python do_generate_initramfs_setscene () {
 rootfs_generate_initramfs[progress] = "custom:rootfs_progress.InitrdProgressHandler"
 rootfs_generate_initramfs() {
     if [ -n "$(sudo find '${ROOTFSDIR}/boot' -type f -name 'vmlinu[xz]*')" ]; then
+        mods_total="$(sudo find '${ROOTFSDIR}/usr/lib/modules' -type f -name '*.ko*' | wc -l)"
+        echo "Total number of modules: $mods_total"
         sudo -E chroot "${ROOTFSDIR}" sh -c '\
-            mods_total="$(find /usr/lib/modules -type f -name '*.ko*' | wc -l)"; \
             export kernel_version=$(basename /boot/vmlinu[xz]-* | cut -d'-' -f2-); \
-            echo "Total number of modules: $mods_total"; \
             echo "Generating initrd for kernel version: $kernel_version"; \
             update-initramfs -u -v -k "$kernel_version";'
         if [ -n "${INITRD_DEPLOY_FILE}" ]; then
-- 
2.51.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/f547f9c01860fe224a3531b74d10db1d946cbcf5.1757930833.git.jan.kiszka%40siemens.com.

  parent reply	other threads:[~2025-09-15 10:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 10:07 [PATCH 0/4] Several micro-optimizations 'Jan Kiszka' via isar-users
2025-09-15 10:07 ` [PATCH 1/4] rootfs: Implement update-initramfs stubs via symlink 'Jan Kiszka' via isar-users
2025-09-15 10:32   ` 'MOESSBAUER, Felix' via isar-users
2025-09-15 10:07 ` [PATCH 2/4] sbuild-chroot: Skip initramfs generation while installing build dependencies 'Jan Kiszka' via isar-users
2025-09-15 10:33   ` 'MOESSBAUER, Felix' via isar-users
2025-09-15 10:07 ` 'Jan Kiszka' via isar-users [this message]
2025-09-15 10:07 ` [PATCH 4/4] image-locales-extension: Optimize package removal 'Jan Kiszka' 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=f547f9c01860fe224a3531b74d10db1d946cbcf5.1757930833.git.jan.kiszka@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=jan.kiszka@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