* [PATCH 0/8] Add support to cross-compile a dracut initramfs
@ 2026-09-15 10:01 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 1/8] rootfs: generalize deployment of rootfs artifact 'Felix Moessbauer' via isar-users
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
Not a trivial change, but one that really pays off: On some real-world
(non native) use cases the initrd generation takes more than 10 minutes.
This is due to emulating the ldd, as well as the cpio and compression
stages. With initramfs tools or the initramfs-tools wrapped dracut, we
don't see any possibility to significantly speed up the process (and
cross-building is also not supported). However, with direct invocation
of dracut, cross-compiling the initramfs becomes feasible and significantly
faster (on some cases more than 5x). This is especially relevant for
initrd-only images, where the slow build times are already a blocker as
of today.
In combination with host-apt based package installation (not part of this
series), this can cut the overall buildtime by a factor of 3x or more.
Note, that isar-cip-core will soon profit from this change as well, as
they plan to switch all initrd scripts to dracut.
Best regards,
Felix Moessbauer
Felix Moessbauer (8):
rootfs: generalize deployment of rootfs artifact
dracut-module: make module-setup compatible with sysroot
initramfs: move dracut logic to initrd-dracut class
dracut: use fixed log level on generation for progress reporting
dracut: enforce build of reproducible initrd
add host-tooling chroot for generic host tooling
dracut: add support for cross initrd generation
rootfs: stub both dracut and update-initramfs on dracut
.../dracut-example-lighttpd/files/install.sh | 12 ++--
.../recipes-initramfs/images/isar-dracut.bb | 4 +-
meta/classes-recipe/host-tooling.bbclass | 14 ++++
meta/classes-recipe/imagetypes_wic.bbclass | 2 +-
meta/classes-recipe/initramfs.bbclass | 2 +
meta/classes-recipe/initrd-dracut.bbclass | 41 +++++++++++-
meta/classes-recipe/rootfs-deploy.bbclass | 30 +++++++++
meta/classes-recipe/rootfs.bbclass | 39 +++++++----
meta/classes/sbom.bbclass | 2 +-
meta/lib/rootfs_progress.py | 3 +-
.../dracut-cross-ldd/dracut-cross-ldd.bb | 16 +++++
.../dracut-cross-ldd/files/dracut-cross-ldd | 65 +++++++++++++++++++
.../host-tooling-chroot.bb | 28 ++++++++
.../sbom-chroot/sbom-chroot.bb | 19 ++----
.../sbuild-chroot/sbuild-chroot.inc | 30 ++-------
.../dracut-module/files/module-setup.sh.tmpl | 2 +-
16 files changed, 249 insertions(+), 60 deletions(-)
create mode 100644 meta/classes-recipe/host-tooling.bbclass
create mode 100644 meta/classes-recipe/rootfs-deploy.bbclass
create mode 100644 meta/recipes-devtools/dracut-cross-ldd/dracut-cross-ldd.bb
create mode 100644 meta/recipes-devtools/dracut-cross-ldd/files/dracut-cross-ldd
create mode 100644 meta/recipes-devtools/host-tooling-chroot/host-tooling-chroot.bb
--
2.55.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/20260915100125.1991311-1-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8] rootfs: generalize deployment of rootfs artifact
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 2/8] dracut-module: make module-setup compatible with sysroot 'Felix Moessbauer' via isar-users
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
We already have two locations where the generated rootfs is deployed as
an artifact. We now generalize the logic and hide it behind an
interface. We further register a function to remove the generated
artifact on clean.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/imagetypes_wic.bbclass | 2 +-
meta/classes-recipe/rootfs-deploy.bbclass | 30 +++++++++++++++++++
meta/classes/sbom.bbclass | 2 +-
.../sbom-chroot/sbom-chroot.bb | 19 ++++--------
.../sbuild-chroot/sbuild-chroot.inc | 30 +++++--------------
5 files changed, 44 insertions(+), 39 deletions(-)
create mode 100644 meta/classes-recipe/rootfs-deploy.bbclass
diff --git a/meta/classes-recipe/imagetypes_wic.bbclass b/meta/classes-recipe/imagetypes_wic.bbclass
index c1647081..6cf7bd8e 100644
--- a/meta/classes-recipe/imagetypes_wic.bbclass
+++ b/meta/classes-recipe/imagetypes_wic.bbclass
@@ -143,7 +143,7 @@ check_for_wic_warnings() {
fi
}
-do_image_wic[depends] += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-sbom', 'sbom-chroot:do_sbomchroot_deploy', '', d)}"
+do_image_wic[depends] += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-sbom', 'sbom-chroot:do_build', '', d)}"
do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
IMAGE_CMD:wic() {
generate_wic_image
diff --git a/meta/classes-recipe/rootfs-deploy.bbclass b/meta/classes-recipe/rootfs-deploy.bbclass
new file mode 100644
index 00000000..35b1a5cc
--- /dev/null
+++ b/meta/classes-recipe/rootfs-deploy.bbclass
@@ -0,0 +1,30 @@
+# This software is a part of Isar.
+# Copyright (c) Siemens AG, 2026
+#
+# Inherit this class to deploy the rootfs as a compressed tarball
+# and remove the (local) extracted rootfs after deployment.
+
+ROOTFS_TAR_FLAGS ?= ""
+ROOTFS_ZSTD_CLEVEL ?= "8"
+ROOTFS_DEPLOY_DIR ?= "${DEPLOY_DIR}/chroot-${PN}"
+ROOTFS_DEPLOY_FILE ?= "${ROOTFS_DEPLOY_DIR}/${HOST_DISTRO}-${HOST_ARCH}_${DISTRO}-${DISTRO_ARCH}.tar.zst"
+
+do_rootfs_deploy[dirs] = "${ROOTFS_DEPLOY_DIR}"
+do_rootfs_deploy[network] = "${TASK_USE_SUDO}"
+do_rootfs_deploy() {
+ # deploy with empty var to make it smaller
+ lopts="--one-file-system"
+ ZSTD="zstd -${ROOTFS_ZSTD_CLEVEL} -T${ZSTD_THREADS}"
+
+ run_privileged \
+ tar -C ${ROOTFSDIR} -cpS $lopts ${ROOTFS_TAR_FLAGS} . \
+ | $ZSTD > ${ROOTFS_DEPLOY_FILE}
+ # cleanup extracted rootfs
+ run_privileged rm -rf ${ROOTFSDIR}
+}
+addtask do_rootfs_deploy before do_build after do_rootfs
+
+CLEANFUNCS += "rootfs_deploy_clean"
+rootfs_deploy_clean() {
+ rm -rf ${ROOTFS_DEPLOY_FILE}
+}
diff --git a/meta/classes/sbom.bbclass b/meta/classes/sbom.bbclass
index dad8e8f6..f7adde36 100644
--- a/meta/classes/sbom.bbclass
+++ b/meta/classes/sbom.bbclass
@@ -79,7 +79,7 @@ do_generate_sbom[cleandirs] += "${SBOM_LOCAL_DEPLOYDIR}"
do_generate_sbom[sstate-inputdirs] = "${SBOM_LOCAL_DEPLOYDIR}"
do_generate_sbom[sstate-outputdirs] = "${DEPLOY_DIR_SBOM}"
do_generate_sbom[network] = "${TASK_USE_SUDO}"
-do_generate_sbom[depends] += "sbom-chroot:do_sbomchroot_deploy"
+do_generate_sbom[depends] += "sbom-chroot:do_build"
python do_generate_sbom() {
sbom_doc_uuid(d)
try:
diff --git a/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb b/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
index f347327b..4727efe4 100644
--- a/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
+++ b/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
@@ -26,17 +26,8 @@ SBOM_IMAGE_INSTALL = "python3-debsbom python3-spdx-tools python3-cyclonedx-lib"
ROOTFSDIR = "${WORKDIR}/rootfs"
ROOTFS_PACKAGES = "${SBOM_IMAGE_INSTALL}"
-do_sbomchroot_deploy[dirs] = "${SBOM_DIR}"
-do_sbomchroot_deploy[network] = "${TASK_USE_SUDO}"
-do_sbomchroot_deploy() {
- # deploy with empty var to make it smaller
- lopts="--one-file-system --exclude=var/*"
- ZSTD="zstd -${SSTATE_ZSTD_CLEVEL} -T${ZSTD_THREADS}"
-
- run_privileged \
- tar -C ${ROOTFSDIR} -cpS $lopts ${ROOTFS_TAR_ATTR_FLAGS} . \
- | $ZSTD > ${SBOM_CHROOT}
- # cleanup extracted rootfs
- run_privileged rm -rf ${ROOTFSDIR}
-}
-addtask do_sbomchroot_deploy before do_build after do_rootfs
+inherit rootfs-deploy
+
+ROOTFS_DEPLOY_DIR = "${SBOM_DIR}"
+ROOTFS_DEPLOY_FILE = "${SBOM_CHROOT}"
+ROOTFS_TAR_FLAGS += "--exclude=var/*"
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
index 80c43d20..ae9e0e76 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -70,28 +70,12 @@ ROOTFS_POSTPROCESS_COMMAND:remove = "rootfs_cleanup_base_apt"
DEPLOY_SCHROOT = "${@d.getVar('SCHROOT_' + d.getVar('SBUILD_VARIANT').upper() + '_DIR')}${SBUILD_SCHROOT_SUFFIX}"
-sbuildchroot_deploy_tree() {
- ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_SCHROOT}"
-}
-sbuildchroot_deploy_tar() {
- lopts="--one-file-system --exclude=var/cache/apt/archives --exclude=isar-apt"
- # we cannot use pzstd, as this results in a different magic
- # (zstd skippable frame) which is not detected by sbuild
- # https://salsa.debian.org/debian/sbuild/-/blob/d975d388a98627a0d7d112791e441c27a6d529df/lib/Sbuild/ChrootUnshare.pm#L608
- ZSTD="zstd -${SSTATE_ZSTD_CLEVEL} -T${ZSTD_THREADS}"
- run_privileged \
- tar -C ${ROOTFSDIR} -cpS $lopts ${ROOTFS_TAR_ATTR_FLAGS} . \
- | $ZSTD > ${DEPLOY_SCHROOT}.tar.zst
- # cleanup extracted rootfs
- run_privileged rm -rf ${ROOTFSDIR}
-}
+inherit rootfs-deploy
+
+ROOTFS_DEPLOY_DIR = "${DEPLOY_DIR}/schroot-${SBUILD_VARIANT}"
+ROOTFS_DEPLOY_FILE = "${DEPLOY_SCHROOT}"
+ROOTFS_DEPLOY_FILE:unshare = "${DEPLOY_SCHROOT}.tar.zst"
-do_sbuildchroot_deploy[network] = "${TASK_USE_SUDO}"
-do_sbuildchroot_deploy[dirs] += "${DEPLOY_DIR}/schroot-${SBUILD_VARIANT}"
-python do_sbuildchroot_deploy() {
- if d.getVar('ISAR_CHROOT_MODE') == 'unshare':
- bb.build.exec_func('sbuildchroot_deploy_tar', d)
- else:
- bb.build.exec_func('sbuildchroot_deploy_tree', d)
+do_rootfs_deploy:schroot() {
+ ln -Tfsr "${ROOTFSDIR}" "${ROOTFS_DEPLOY_FILE}"
}
-addtask sbuildchroot_deploy before do_build after do_rootfs
--
2.55.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/20260915100125.1991311-2-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/8] dracut-module: make module-setup compatible with sysroot
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 1/8] rootfs: generalize deployment of rootfs artifact 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 3/8] initramfs: move dracut logic to initrd-dracut class 'Felix Moessbauer' via isar-users
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
As a preparation for cross-building dracut initrds, we need to ensure
the module setup does not call external tooling (which would have to be
emulated). Further, all tool output must be consumable under sysroot as
well (e.g. paths must be resolved in the target chroot). We fix this by
replacing calls to tooling with the corresponding dracut helpers.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
.../dracut-example-lighttpd/files/install.sh | 12 ++++++++----
.../dracut-module/files/module-setup.sh.tmpl | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
index b7295b94..66b54a43 100644
--- a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
@@ -1,5 +1,9 @@
-inst_multiple -o /usr/lib/lighttpd/*.so
-inst_multiple -o /usr/share/lighttpd/*
+# Copy optional lighttpd modules and assets from the target sysroot.
+for source in "${dracutsysrootdir}"/usr/lib/*/lighttpd/*.so \
+ "${dracutsysrootdir}"/usr/share/lighttpd/*; do
+ [[ -e "$source" ]] || continue
+ inst_simple "$source" "${source#"$dracutsysrootdir"}"
+done
inst_simple "${moddir}/lighttpd.service" "$systemdsystemunitdir/lighttpd.service"
inst_simple "${moddir}/lighttpd.conf" /etc/lighttpd/lighttpd.conf
@@ -13,8 +17,8 @@ mkdir -p -m 0700 "$initdir/var/cache/lighttpd/uploads"
mkdir -p -m 0700 "$initdir/var/log/lighttpd/"
mkdir -p -m 0755 "$initdir/var/www/html"
-/usr/bin/install -m 0644 /usr/share/lighttpd/index.html "$initdir/var/www/html/index.html"
+inst_simple "${dracutsysrootdir}"/usr/share/lighttpd/index.html /var/www/html/index.html
touch "$moddir"/error.log
-/usr/bin/install -m 0644 "$moddir"/error.log "$initdir/var/log/lighttpd/error.log"
+inst_simple "$moddir"/error.log /var/log/lighttpd/error.log
chown -R www-data:www-data "$initdir/var/log/lighttpd/"
systemctl -q --root "$initdir" enable lighttpd
diff --git a/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
index be0f4c54..b38ae50c 100644
--- a/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
+++ b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
@@ -31,7 +31,7 @@ cmdline() {
install() {
for executable in ${DRACUT_REQUIRED_BINARIES}; do
- if exec_path=$(command -v $executable 2>/dev/null); then
+ if exec_path=$(find_binary "$executable"); then
inst_binary "$exec_path"
else
echo "(ERROR): Unable to copy $executable" >&2
--
2.55.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/20260915100125.1991311-3-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/8] initramfs: move dracut logic to initrd-dracut class
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 1/8] rootfs: generalize deployment of rootfs artifact 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 2/8] dracut-module: make module-setup compatible with sysroot 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 4/8] dracut: use fixed log level on generation for progress reporting 'Felix Moessbauer' via isar-users
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
As a preparation to extend the dracut logic for cross, we move it to the
initrd-dracut class. This also gives a cleaner interface for initrd
generation, as both mkinitramfs and dracut can now be generated by
inheriting the initramfs.bbclass.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
.../recipes-initramfs/images/isar-dracut.bb | 4 ++-
meta/classes-recipe/initramfs.bbclass | 2 ++
meta/classes-recipe/initrd-dracut.bbclass | 7 ++++-
meta/classes-recipe/rootfs.bbclass | 28 ++++++++++++-------
4 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/meta-isar/recipes-initramfs/images/isar-dracut.bb b/meta-isar/recipes-initramfs/images/isar-dracut.bb
index c75b69e3..efd6d1ec 100644
--- a/meta-isar/recipes-initramfs/images/isar-dracut.bb
+++ b/meta-isar/recipes-initramfs/images/isar-dracut.bb
@@ -4,7 +4,9 @@
#
# This software is a part of Isar.
-inherit initrd-dracut
+INITRAMFS_USE_DRACUT = "1"
+
+inherit initramfs
# Debian packages that should be installed into the system for building the
# initramfs. E.g. the cryptsetup package which contains initramfs scripts for
diff --git a/meta/classes-recipe/initramfs.bbclass b/meta/classes-recipe/initramfs.bbclass
index 45626319..41828487 100644
--- a/meta/classes-recipe/initramfs.bbclass
+++ b/meta/classes-recipe/initramfs.bbclass
@@ -10,6 +10,7 @@ INITRAMFS_PREINSTALL ?= ""
INITRAMFS_ROOTFS ?= "${WORKDIR}/rootfs"
INITRAMFS_IMAGE_NAME = "${INITRAMFS_FULLNAME}-initrd.img"
INITRAMFS_GENERATOR_PKG ??= "initramfs-tools"
+INITRAMFS_USE_DRACUT ??= "0"
INITRD_DEPLOY_FILE = "${INITRAMFS_IMAGE_NAME}"
# Install proper kernel
@@ -28,6 +29,7 @@ DEPENDS += "${INITRAMFS_INSTALL}"
ROOTFSDIR = "${INITRAMFS_ROOTFS}"
ROOTFS_FEATURES += "generate-manifest generate-sbom generate-initrd"
ROOTFS_PACKAGES = "${INITRAMFS_GENERATOR_PKG} ${INITRAMFS_PREINSTALL} ${INITRAMFS_INSTALL}"
+ROOTFS_USE_DRACUT ?= "${INITRAMFS_USE_DRACUT}"
# validate whether there are incompatible packages in the installation list
python do_validate_rootfs_packages () {
diff --git a/meta/classes-recipe/initrd-dracut.bbclass b/meta/classes-recipe/initrd-dracut.bbclass
index 542b1fbe..c2018f03 100644
--- a/meta/classes-recipe/initrd-dracut.bbclass
+++ b/meta/classes-recipe/initrd-dracut.bbclass
@@ -53,6 +53,11 @@ def extend_dracut_cmdline(d):
cmdline.append(f'--add "{extra_modules}"')
return ' '.join(cmdline)
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "dracut --force --kver $kernel_version"
ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"
-inherit initramfs
+run_initrd_generator() {
+ mods_total="$(find ${ROOTFSDIR}/usr/lib/modules/$kernel_version -type f -name '*.ko*' | wc -l)"
+ echo "Total number of modules: $mods_total (dracut)"
+ run_in_chroot "${ROOTFSDIR}" sh -c "${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}"
+}
diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index d3b0d471..1de27d7b 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -13,18 +13,20 @@ DEPLOYDIR = "${WORKDIR}/deploy"
# This variable is intended to be set if dracut is
# the default initramfs generator and it is not
# possible to derive the value in another way
-ROOTFS_USE_DRACUT ??= ""
+ROOTFS_USE_DRACUT ??= "${@ '1' if 'dracut' in (d.getVar('ROOTFS_PACKAGES') or '').split() else '0' }"
-def initramfs_generator_cmdline(d):
- rootfs_packages = d.getVar('ROOTFS_PACKAGES') or ''
- if 'dracut' in rootfs_packages or bb.utils.to_boolean(d.getVar('ROOTFS_USE_DRACUT')):
- return "dracut --force --kver \"$kernel_version\""
- return "update-initramfs -u -v -k \"$kernel_version\""
+# In case no initrd is generated, force dracut off to not let bitbake hashes
+# depend on the dracut config which anyways is not used.
+python () {
+ rootfs_features = d.getVar('ROOTFS_FEATURES') or ''
+ if 'generate-initrd' not in rootfs_features.split():
+ d.setVar('ROOTFS_USE_DRACUT', '0')
+}
ROOTFS_PACKAGES ?= ""
ROOTFS_VARDEPS ?= ""
ROOTFS_INITRAMFS_GENERATOR_CMD = "${@ d.getVar('ROOTFS_INITRAMFS_GENERATOR_CMDLINE').split()[0]}"
-ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "${@ initramfs_generator_cmdline(d)}"
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "update-initramfs -u -v -k $kernel_version"
ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
# Features of the rootfs creation:
@@ -650,6 +652,14 @@ rootfs_set_timestamps() {
-exec touch '{}' -h -d@${SOURCE_DATE_EPOCH} ';'
}
+run_initrd_generator() {
+ mods_total="$(find ${ROOTFSDIR}/usr/lib/modules/$kernel_version -type f -name '*.ko*' | wc -l)"
+ echo "Total number of modules: $mods_total (mkinitramfs)"
+ run_in_chroot "${ROOTFSDIR}" sh -ec '${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}'
+}
+
+inherit_defer ${@'initrd-dracut' if bb.utils.to_boolean(d.getVar('ROOTFS_USE_DRACUT')) else ''}
+
ROOTFS_INSTALL_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-initrd', 'rootfs_generate_initramfs', '', d)}"
rootfs_generate_initramfs[weight] = "1000"
rootfs_generate_initramfs[progress] = "custom:rootfs_progress.InitrdProgressHandler"
@@ -657,10 +667,8 @@ rootfs_generate_initramfs() {
if [ -n "$(find '${ROOTFSDIR}/boot' -type f -name 'vmlinu[xz]*')" ]; then
for kernel in ${ROOTFSDIR}/boot/vmlinu[xz]-*; do
export kernel_version=$(basename $kernel | cut -d'-' -f2-)
- mods_total="$(find ${ROOTFSDIR}/usr/lib/modules/$kernel_version -type f -name '*.ko*' | wc -l)"
- echo "Total number of modules: $mods_total"
echo "Generating initrd for kernel version: $kernel_version"
- run_in_chroot "${ROOTFSDIR}" sh -ec '${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}'
+ run_initrd_generator
# on dracut, the initrd is not world-readable
run_privileged find ${ROOTFSDIR}/boot -name "initrd.img-$kernel_version*" -exec cat {} \; \
> ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
--
2.55.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/20260915100125.1991311-4-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] dracut: use fixed log level on generation for progress reporting
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
` (2 preceding siblings ...)
2026-09-15 10:01 ` [PATCH 3/8] initramfs: move dracut logic to initrd-dracut class 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 5/8] dracut: enforce build of reproducible initrd 'Felix Moessbauer' via isar-users
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
The log level of dracut controls which logs are generated on stdout
during initrd building. Previously, we needed debug options to interface
with the parser, but these options were not set in all config files.
As the config files are part of the rootfs, they are out of our control
anyways. By that, progress reporting was broken on configs (like the
trixie default config) were the level was set too low.
We fix this by passing the log level on dracut invocation and also count
the number of dracut modules instead of copy operations, which gives a
better progress indication.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/initrd-dracut.bbclass | 4 ++--
meta/lib/rootfs_progress.py | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/meta/classes-recipe/initrd-dracut.bbclass b/meta/classes-recipe/initrd-dracut.bbclass
index c2018f03..cf8bf937 100644
--- a/meta/classes-recipe/initrd-dracut.bbclass
+++ b/meta/classes-recipe/initrd-dracut.bbclass
@@ -53,11 +53,11 @@ def extend_dracut_cmdline(d):
cmdline.append(f'--add "{extra_modules}"')
return ' '.join(cmdline)
-ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "dracut --force --kver $kernel_version"
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "dracut --force --kver $kernel_version -L 5"
ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"
run_initrd_generator() {
- mods_total="$(find ${ROOTFSDIR}/usr/lib/modules/$kernel_version -type f -name '*.ko*' | wc -l)"
+ mods_total="$(find ${ROOTFSDIR}/usr/lib/dracut/modules.d/ -maxdepth 1 -type d | wc -l)"
echo "Total number of modules: $mods_total (dracut)"
run_in_chroot "${ROOTFSDIR}" sh -c "${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}"
}
diff --git a/meta/lib/rootfs_progress.py b/meta/lib/rootfs_progress.py
index 58d16574..67f44ede 100644
--- a/meta/lib/rootfs_progress.py
+++ b/meta/lib/rootfs_progress.py
@@ -83,8 +83,9 @@ class InitrdProgressHandler(PkgsProgressHandler):
def process_line(self, line):
if (
line.startswith("Adding module")
- or line.startswith("dracut-install: cp")
+ or line.startswith("dracut-install: cp") # dracut-install output (Ubuntu)
or line.startswith("dracut-install: Failed to find module")
+ or "Including module:" in line # dracut output (debian)
):
self._pkg += 1
elif line.startswith('(excluding'):
--
2.55.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/20260915100125.1991311-5-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/8] dracut: enforce build of reproducible initrd
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
` (3 preceding siblings ...)
2026-09-15 10:01 ` [PATCH 4/8] dracut: use fixed log level on generation for progress reporting 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 6/8] add host-tooling chroot for generic host tooling 'Felix Moessbauer' via isar-users
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
Previously this depended on the rootfs dracut configuration, but in isar
we have to avoid non-reproducible elements, as they result in cache
trashing. By that, we just enforce that the initrd is build in
reproducible mode.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/initrd-dracut.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes-recipe/initrd-dracut.bbclass b/meta/classes-recipe/initrd-dracut.bbclass
index cf8bf937..00999b91 100644
--- a/meta/classes-recipe/initrd-dracut.bbclass
+++ b/meta/classes-recipe/initrd-dracut.bbclass
@@ -53,7 +53,7 @@ def extend_dracut_cmdline(d):
cmdline.append(f'--add "{extra_modules}"')
return ' '.join(cmdline)
-ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "dracut --force --kver $kernel_version -L 5"
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "dracut --force --kver $kernel_version -L 5 --reproducible"
ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"
run_initrd_generator() {
--
2.55.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/20260915100125.1991311-6-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6/8] add host-tooling chroot for generic host tooling
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
` (4 preceding siblings ...)
2026-09-15 10:01 ` [PATCH 5/8] dracut: enforce build of reproducible initrd 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 7/8] dracut: add support for cross initrd generation 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 8/8] rootfs: stub both dracut and update-initramfs on dracut 'Felix Moessbauer' via isar-users
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
As a preparation to provide needed cross tooling for initrd generation,
we provide a host-tooling-chroot and a corresponding class. This can be
used to install debian packages in the native version in a chroot, which
then can be used to perform cross-chroot tool execution.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/host-tooling.bbclass | 14 ++++++++++
.../host-tooling-chroot.bb | 28 +++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 meta/classes-recipe/host-tooling.bbclass
create mode 100644 meta/recipes-devtools/host-tooling-chroot/host-tooling-chroot.bb
diff --git a/meta/classes-recipe/host-tooling.bbclass b/meta/classes-recipe/host-tooling.bbclass
new file mode 100644
index 00000000..b76f8898
--- /dev/null
+++ b/meta/classes-recipe/host-tooling.bbclass
@@ -0,0 +1,14 @@
+# This software is a part of Isar.
+#
+# Copyright (C) 2026 Siemens
+
+LICENSE = "gpl-2.0"
+LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
+
+HOST_TOOLING_PACKAGES ?= ""
+HOST_TOOLING_DEPENDS ?= ""
+
+# dependency to build the host-tooling-chroot
+HOST_TOOLING_DEP ?= "host-tooling-chroot:do_build"
+HOST_TOOLING_DEPLOY_DIR ?= "${DEPLOY_DIR}/chroot-host-tooling"
+HOST_TOOLING_CHROOT ?= "${HOST_TOOLING_DEPLOY_DIR}/${HOST_DISTRO}-${HOST_ARCH}_${DISTRO}-${DISTRO_ARCH}.tar.zst"
diff --git a/meta/recipes-devtools/host-tooling-chroot/host-tooling-chroot.bb b/meta/recipes-devtools/host-tooling-chroot/host-tooling-chroot.bb
new file mode 100644
index 00000000..0ee2a7c5
--- /dev/null
+++ b/meta/recipes-devtools/host-tooling-chroot/host-tooling-chroot.bb
@@ -0,0 +1,28 @@
+# This software is a part of Isar.
+#
+# Copyright (C) 2026 Siemens
+
+LICENSE = "gpl-2.0"
+LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
+
+PV = "1.0"
+
+inherit rootfs
+inherit host-tooling
+
+ROOTFS_ARCH = "${HOST_ARCH}"
+ROOTFS_DISTRO = "${@get_rootfs_distro(d)}"
+ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
+
+ROOTFS_FEATURES:remove = "generate-initrd"
+ROOTFS_INSTALL_COMMAND:remove = "rootfs_restore_initrd_tooling"
+
+DEPENDS += "${HOST_TOOLING_DEPENDS}"
+ROOTFSDIR = "${WORKDIR}/rootfs"
+ROOTFS_PACKAGES += "${HOST_TOOLING_PACKAGES}"
+
+inherit rootfs-deploy
+
+ROOTFS_TAR_FLAGS = "--exclude=var/*"
+ROOTFS_DEPLOY_DIR = "${HOST_TOOLING_DEPLOY_DIR}"
+ROOTFS_DEPLOY_FILE = "${HOST_TOOLING_CHROOT}"
--
2.55.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/20260915100125.1991311-7-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 7/8] dracut: add support for cross initrd generation
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
` (5 preceding siblings ...)
2026-09-15 10:01 ` [PATCH 6/8] add host-tooling chroot for generic host tooling 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 8/8] rootfs: stub both dracut and update-initramfs on dracut 'Felix Moessbauer' via isar-users
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
For cross-initrd generation, a cross variant of the ldd tool needs to
be provided. As there is no such tool, but this is THE performance
critical part (it needs to scan each binary and all transitive dependencies),
we provide a custom one which uses readelf to determine the shared library
dependencies.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/host-tooling.bbclass | 4 +-
meta/classes-recipe/initrd-dracut.bbclass | 36 +++++++++-
meta/classes-recipe/rootfs.bbclass | 4 +-
.../dracut-cross-ldd/dracut-cross-ldd.bb | 16 +++++
.../dracut-cross-ldd/files/dracut-cross-ldd | 65 +++++++++++++++++++
5 files changed, 121 insertions(+), 4 deletions(-)
create mode 100644 meta/recipes-devtools/dracut-cross-ldd/dracut-cross-ldd.bb
create mode 100644 meta/recipes-devtools/dracut-cross-ldd/files/dracut-cross-ldd
diff --git a/meta/classes-recipe/host-tooling.bbclass b/meta/classes-recipe/host-tooling.bbclass
index b76f8898..5e81dfda 100644
--- a/meta/classes-recipe/host-tooling.bbclass
+++ b/meta/classes-recipe/host-tooling.bbclass
@@ -5,8 +5,8 @@
LICENSE = "gpl-2.0"
LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
-HOST_TOOLING_PACKAGES ?= ""
-HOST_TOOLING_DEPENDS ?= ""
+HOST_TOOLING_PACKAGES ?= "dracut-core binutils zstd dracut-cross-ldd"
+HOST_TOOLING_DEPENDS ?= "dracut-cross-ldd"
# dependency to build the host-tooling-chroot
HOST_TOOLING_DEP ?= "host-tooling-chroot:do_build"
diff --git a/meta/classes-recipe/initrd-dracut.bbclass b/meta/classes-recipe/initrd-dracut.bbclass
index 00999b91..ffc71db6 100644
--- a/meta/classes-recipe/initrd-dracut.bbclass
+++ b/meta/classes-recipe/initrd-dracut.bbclass
@@ -56,8 +56,42 @@ def extend_dracut_cmdline(d):
ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "dracut --force --kver $kernel_version -L 5 --reproducible"
ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"
+# Cross-assemble the initramfs, requires preparation of dracut module definitions
+def dracut_cross_default(d):
+ return bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) \
+ and bb.utils.to_boolean(d.getVar('ROOTFS_USE_DRACUT')) \
+ and d.getVar('ROOTFS_ARCH') != d.getVar('HOST_ARCH')
+
+ROOTFS_DRACUT_CROSS ??= "${@ '1' if dracut_cross_default(d) else '0' }"
+ROOTFS_DRACUT_CROSS:bookworm = "0"
+OVERRIDES:append = "${@':dracut-cross' if bb.utils.to_boolean(d.getVar('ROOTFS_DRACUT_CROSS')) else ''}"
+
+ROOTFS_INSTALL_DEPENDS:append:dracut-cross = " ${HOST_TOOLING_DEP}"
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append:dracut-cross = " --sysroot /mnt/rootfs"
+DRACUT_MOUNTS = ""
+DRACUT_MOUNTS:append:dracut-cross = " ${ROOTFSDIR}:/mnt/rootfs"
+DRACUT_ROOTFS = "${ROOTFSDIR}"
+DRACUT_ROOTFS:dracut-cross = "${WORKDIR}/host-tooling"
+DRACUT_ENV = "DRACUT_ARCH=${QEMU_ARCH}"
+DRACUT_ENV:append:dracut-cross = " \
+ DRACUT_INSTALL=/usr/lib/dracut/dracut-install \
+ DRACUT_LDD=/usr/libexec/dracut-cross-ldd \
+"
+
run_initrd_generator() {
mods_total="$(find ${ROOTFSDIR}/usr/lib/dracut/modules.d/ -maxdepth 1 -type d | wc -l)"
echo "Total number of modules: $mods_total (dracut)"
- run_in_chroot "${ROOTFSDIR}" sh -c "${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}"
+ if [ "${ROOTFS_DRACUT_CROSS}" = "1" ]; then
+ mkdir -p ${DRACUT_ROOTFS}
+ run_privileged tar -xf ${HOST_TOOLING_CHROOT} -C ${DRACUT_ROOTFS}
+ trap 'run_privileged rm -rf ${DRACUT_ROOTFS}' EXIT
+ fi
+ ${@ insert_isar_umounts(d, d.getVar('DRACUT_ROOTFS'), d.getVar('DRACUT_MOUNTS')) }
+ run_privileged_heredoc <<'EOF'
+ ${@ insert_isar_mounts(d, d.getVar('DRACUT_ROOTFS'), d.getVar('DRACUT_MOUNTS')) }
+ export ${DRACUT_ENV}
+ chroot ${DRACUT_ROOTFS} ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}
+EOF
}
+
+inherit_defer ${@'host-tooling' if bb.utils.to_boolean(d.getVar('ROOTFS_DRACUT_CROSS')) else ''}
diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 1de27d7b..cea85626 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -452,6 +452,8 @@ rootfs_capture_apt_state() {
var/lib/dpkg/status
}
+ROOTFS_INSTALL_DEPENDS ?= ""
+
do_rootfs_install[root_cleandirs] = "${ROOTFSDIR}"
do_rootfs_install[cleandirs] += "${DEPLOYDIR}"
do_rootfs_install[sstate-inputdirs] = "${DEPLOYDIR}"
@@ -459,7 +461,7 @@ do_rootfs_install[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
do_rootfs_install[vardeps] += "${ROOTFS_CONFIGURE_COMMAND} ${ROOTFS_INSTALL_COMMAND} ${ROOTFS_POSTPROCESS_COMMAND} ${ROOTFS_VARDEPS}"
do_rootfs_install[vardepsexclude] += "IMAGE_ROOTFS"
do_rootfs_install[depends] = "bootstrap-${@'target' if d.getVar('ROOTFS_ARCH') == d.getVar('DISTRO_ARCH') else 'host'}:do_build"
-do_rootfs_install[depends] += "base-apt:do_cache isar-apt:do_cache_config"
+do_rootfs_install[depends] += "base-apt:do_cache isar-apt:do_cache_config ${ROOTFS_INSTALL_DEPENDS}"
do_rootfs_install[deptask] = "do_deploy_deb"
do_rootfs_install[rdeptask] = "do_deploy_deb"
do_rootfs_install[network] = "${TASK_USE_SUDO}"
diff --git a/meta/recipes-devtools/dracut-cross-ldd/dracut-cross-ldd.bb b/meta/recipes-devtools/dracut-cross-ldd/dracut-cross-ldd.bb
new file mode 100644
index 00000000..327a5c82
--- /dev/null
+++ b/meta/recipes-devtools/dracut-cross-ldd/dracut-cross-ldd.bb
@@ -0,0 +1,16 @@
+# This software is a part of Isar.
+# Copyright (C) 2026 Siemens AG
+
+inherit dpkg-raw
+
+MAINTAINER = "isar-users <isar-users@googlegroups.com>"
+DESCRIPTION = "Minimal ldd replacement for dracut cross builds"
+
+SRC_URI = "file://${BPN}"
+
+DEBIAN_DEPENDS .= ",python3, binutils"
+
+do_install[cleandirs] += "${D}/usr/libexec"
+do_install() {
+ install -v -m 755 "${WORKDIR}/${BPN}" "${D}/usr/libexec/${BPN}"
+}
diff --git a/meta/recipes-devtools/dracut-cross-ldd/files/dracut-cross-ldd b/meta/recipes-devtools/dracut-cross-ldd/files/dracut-cross-ldd
new file mode 100644
index 00000000..ef60b3fa
--- /dev/null
+++ b/meta/recipes-devtools/dracut-cross-ldd/files/dracut-cross-ldd
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+# This software is a part of Isar.
+# Copyright (C) 2026 Siemens AG
+import re
+import subprocess
+import sys
+from pathlib import Path
+
+# glob patterns relative to the sysroot, including multiarch directories
+LIB_DIRS = ["lib", "lib/*", "usr/lib", "usr/lib/*"]
+
+
+def find_sysroot(binary):
+ for parent in binary.parents:
+ if (parent / "usr/lib").is_dir():
+ return parent
+ return Path("/")
+
+
+def find_library(name, search_dirs, sysroot):
+ for directory in search_dirs:
+ for path in sysroot.glob(f"{directory.strip('/')}/{name}"):
+ return "/" + str(path.relative_to(sysroot))
+ return None
+
+
+def read_dynamic_section(path):
+ return subprocess.check_output(["readelf", "-d", path], text=True)
+
+
+def get_needed(dynamic):
+ runpaths = re.findall(r'\((?:RUNPATH|RPATH)\).*?\[(.*?)\]', dynamic)
+ search_dirs = [d for paths in runpaths for d in paths.split(":")]
+ needed = re.findall(r'\(NEEDED\).*?\[(.*?)\]', dynamic)
+ return search_dirs + LIB_DIRS, needed
+
+
+binary = Path(sys.argv[-1]).absolute()
+try:
+ dynamic = read_dynamic_section(binary)
+except subprocess.SubprocessError:
+ sys.exit(1)
+
+sysroot = find_sysroot(binary)
+resolved = {}
+pending = [get_needed(dynamic)]
+
+# ldd reports the whole dependency tree, so resolve it transitively
+while pending:
+ search_dirs, needed = pending.pop()
+ for library in needed:
+ if library in resolved:
+ continue
+ path = find_library(library, search_dirs, sysroot)
+ resolved[library] = path
+ if path:
+ try:
+ pending.append(get_needed(
+ read_dynamic_section(sysroot / path.strip("/"))))
+ except subprocess.SubprocessError:
+ pass
+
+for library, path in resolved.items():
+ print(f"\t{library} => {path} (0x0000000000000000)" if path
+ else f"\t{library} => not found")
--
2.55.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/20260915100125.1991311-8-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 8/8] rootfs: stub both dracut and update-initramfs on dracut
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
` (6 preceding siblings ...)
2026-09-15 10:01 ` [PATCH 7/8] dracut: add support for cross initrd generation 'Felix Moessbauer' via isar-users
@ 2026-09-15 10:01 ` 'Felix Moessbauer' via isar-users
7 siblings, 0 replies; 9+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-09-15 10:01 UTC (permalink / raw)
To: isar-users; +Cc: quirin.gylstorff, jan.kiszka, Felix Moessbauer
The former one can be used as a wrapper even if dracut is used to
actually generate the initrd. If it is used as wrapper and dracut is
stubbed, this might fail as the wrapper expects output from dracut.
As of now, this did not result in any issues, as all dracut-native
targets (where we do explicitly enable dracut in isar) just use the
wrapper instead of calling dracut directly.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/rootfs.bbclass | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index cea85626..d033bdf0 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -25,7 +25,6 @@ python () {
ROOTFS_PACKAGES ?= ""
ROOTFS_VARDEPS ?= ""
-ROOTFS_INITRAMFS_GENERATOR_CMD = "${@ d.getVar('ROOTFS_INITRAMFS_GENERATOR_CMDLINE').split()[0]}"
ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "update-initramfs -u -v -k $kernel_version"
ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
@@ -71,6 +70,8 @@ ROOTFS_PACKAGE_SUFFIX ?= "${PN}-${DISTRO}-${DISTRO_ARCH}"
# path to deploy stubbed versions of initrd update scripts during do_rootfs_install
ROOTFS_STUBS_DIR = "/usr/local/isar-sbin"
+ROOTFS_INITRD_STUBS = "update-initramfs"
+ROOTFS_INITRD_STUBS += "${@ ' dracut' if bb.utils.to_boolean(d.getVar('ROOTFS_USE_DRACUT')) else '' }"
# list of <outer>:<inner> or <outer> mount entries
ROOTFS_MOUNTS ??= "${REPO_ISAR_DIR}/${DISTRO}:/isar-apt ${WORKDIR}:/isar-work"
@@ -321,7 +322,9 @@ rootfs_disable_initrd_generation() {
set -e
mkdir -p "${ROOTFSDIR}${ROOTFS_STUBS_DIR}"
- ln -s /usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/${ROOTFS_INITRAMFS_GENERATOR_CMD}
+ for stub in ${ROOTFS_INITRD_STUBS}; do
+ ln -s /usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/$stub
+ done
mkdir -p '${ROOTFSDIR}/etc/apt/apt.conf.d'
echo 'DPkg::Path ${ROOTFS_STUBS_DIR}:/usr/sbin:/usr/bin:/sbin:/bin;' \
--
2.55.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/20260915100125.1991311-9-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-09-15 10:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 10:01 [PATCH 0/8] Add support to cross-compile a dracut initramfs 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 1/8] rootfs: generalize deployment of rootfs artifact 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 2/8] dracut-module: make module-setup compatible with sysroot 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 3/8] initramfs: move dracut logic to initrd-dracut class 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 4/8] dracut: use fixed log level on generation for progress reporting 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 5/8] dracut: enforce build of reproducible initrd 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 6/8] add host-tooling chroot for generic host tooling 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 7/8] dracut: add support for cross initrd generation 'Felix Moessbauer' via isar-users
2026-09-15 10:01 ` [PATCH 8/8] rootfs: stub both dracut and update-initramfs on dracut 'Felix Moessbauer' via isar-users
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox