diff --git a/meta-initramfs/recipes-devtools/dracut/dracut/0001-feat-dracut-install-split-ldd-command-arguments-for-.patch b/meta-initramfs/recipes-devtools/dracut/dracut/0001-feat-dracut-install-split-ldd-command-arguments-for-.patch deleted file mode 100644 index febdbdbddd..0000000000 --- a/meta-initramfs/recipes-devtools/dracut/dracut/0001-feat-dracut-install-split-ldd-command-arguments-for-.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 38dea7dd671fd621b563377cfbd95e4783568c6e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= - -Date: Fri, 7 Jun 2024 10:32:40 +0200 -Subject: [PATCH] feat(dracut-install): split ldd command arguments for - execvp() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This restores a not-so-subtle feature of previously executing ldd -via popen(), i.e. the ability to use a cross-compiled sysroot. - -The ldd command may be passed in via the DRACUT_LDD environment -variable, and the command may contain command line arguments. -The number of such arguments are not known in advance. - -Split the command into executable and arguments and run it -via execvp(). - -Fixes: d010fa0d7f8ef42ad31729d027d2e4be6dd6e588 -Signed-off-by: Zoltán Böszörményi -Upstream-Status: Submitted [https://github.com/dracut-ng/dracut-ng/pull/339] ---- - src/install/dracut-install.c | 47 +++++++++++++++++++++++++++++++++++- - 1 file changed, 46 insertions(+), 1 deletion(-) - -diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c -index e9708c45..724b27b5 100644 ---- a/src/install/dracut-install.c -+++ b/src/install/dracut-install.c -@@ -559,10 +559,55 @@ static int resolve_deps(const char *src) - log_debug("%s %s", ldd, fullsrcpath); - pid_t ldd_pid; - if ((ldd_pid = fork()) == 0) { -+ char **cmdline = NULL; -+ int start, pos, idx = 0; -+ /* Account for at least 2 elements plus the terminating NULL in cmdline */ -+ int args = 3; -+ -+ /* Estimate the number of space-separated elements in the "ldd" string */ -+ pos = 0; -+ while (isspace(ldd[pos])) -+ pos++; -+ for (; ldd[pos]; pos++) { -+ if (isspace(ldd[pos])) { -+ if (pos) -+ args++; -+ while (isspace(ldd[pos])) -+ pos++; -+ } -+ } -+ -+ cmdline = malloc(args * sizeof(char *)); -+ memset(cmdline, 0, args * sizeof(char *)); -+ -+ pos = 0; -+ while (isspace(ldd[pos])) -+ pos++; -+ start = pos; -+ for (; ldd[pos]; pos++) { -+ while (ldd[pos] && !isspace(ldd[pos])) -+ pos++; -+ -+ cmdline[idx] = malloc(pos - start + 1); -+ memcpy(cmdline[idx], ldd + start, pos - start); -+ cmdline[idx][pos - start] = 0; -+ idx++; -+ -+ if (!ldd[pos]) -+ break; -+ -+ while (isspace(ldd[pos])) -+ pos++; -+ start = pos; -+ } -+ -+ cmdline[idx++] = fullsrcpath; -+ cmdline[idx] = NULL; -+ - dup2(fds[1], 1); - dup2(fds[1], 2); - putenv("LC_ALL=C"); -- execlp(ldd, ldd, fullsrcpath, (char *)NULL); -+ execvp(cmdline[0], cmdline); - _exit(errno == ENOENT ? 127 : 126); - } - close(fds[1]); --- -2.45.2 - diff --git a/meta-initramfs/recipes-devtools/dracut/dracut/0001-feat-dracut.sh-try-STRIP-for-strip_cmd-first.patch b/meta-initramfs/recipes-devtools/dracut/dracut/0001-feat-dracut.sh-try-STRIP-for-strip_cmd-first.patch new file mode 100644 index 0000000000..00d75ccff6 --- /dev/null +++ b/meta-initramfs/recipes-devtools/dracut/dracut/0001-feat-dracut.sh-try-STRIP-for-strip_cmd-first.patch @@ -0,0 +1,33 @@ +From b8504fdbc6ac7b49aa0a9671267be8ac7affb2ee Mon Sep 17 00:00:00 2001 +From: Koen Kooi +Date: Thu, 19 Jun 2025 16:06:14 +0200 +Subject: [PATCH 1/2] feat: dracut.sh: try $STRIP for $strip_cmd first + +When using dracut in a cross enviroment, like OpenEmbedded, the host +provided strip (or eu-strip) won't work, so try using the $STRIP +variable from the shell environment first before falling back to path +based lookups. + +Signed-off-by: Koen Kooi +Upstream-Status: Submitted [https://github.com/dracut-ng/dracut-ng/pull/1639] +--- + dracut.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 45373efb..dbc5cd72 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -2262,7 +2262,8 @@ done + if [[ $do_strip == yes ]]; then + # Prefer strip from elfutils for package size + declare strip_cmd +- strip_cmd=$(command -v eu-strip) ++ strip_cmd="${STRIP}" ++ [ -z "$strip_cmd" ] && strip_cmd=$(command -v eu-strip) + [ -z "$strip_cmd" ] && strip_cmd="strip" + + for p in "$strip_cmd" xargs find; do +-- +2.47.3 + diff --git a/meta-initramfs/recipes-devtools/dracut/dracut/0001-fix-broken-symlink-in-dracut-config-examples.patch b/meta-initramfs/recipes-devtools/dracut/dracut/0002-fix-broken-symlink-in-dracut-config-examples.patch similarity index 83% rename from meta-initramfs/recipes-devtools/dracut/dracut/0001-fix-broken-symlink-in-dracut-config-examples.patch rename to meta-initramfs/recipes-devtools/dracut/dracut/0002-fix-broken-symlink-in-dracut-config-examples.patch index 7d0b65a161..e2c202a079 100644 --- a/meta-initramfs/recipes-devtools/dracut/dracut/0001-fix-broken-symlink-in-dracut-config-examples.patch +++ b/meta-initramfs/recipes-devtools/dracut/dracut/0002-fix-broken-symlink-in-dracut-config-examples.patch @@ -1,7 +1,7 @@ -From 8871c593973d9abfef45408575e5da887830f42e Mon Sep 17 00:00:00 2001 +From e01991f1d55d4d1327793790bad3724b89952704 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Thu, 22 May 2025 18:07:27 +0800 -Subject: [PATCH] fix broken symlink in dracut config examples +Subject: [PATCH 2/2] fix broken symlink in dracut config examples Due to commit [1], it installs dracut config examples under /usr. But while enable_test=no, the symlink of test in dracut config is broken @@ -28,17 +28,17 @@ Signed-off-by: Hongxu Jia 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile -index d33aebbc..151d9f79 100644 +index 3a40594b..df7956ab 100644 --- a/Makefile +++ b/Makefile -@@ -180,6 +180,7 @@ ifneq ($(enable_test),no) - cp -arx test $(DESTDIR)$(pkglibdir) +@@ -218,6 +218,7 @@ ifeq ($(enable_test),yes) + done else - rm -rf $(DESTDIR)$(pkglibdir)/modules.d/80test* + rm -rf $(DESTDIR)$(pkglibdir)/modules.d/70test* + rm -rf $(DESTDIR)$(pkglibdir)/dracut.conf.d/test* endif ifneq ($(enable_documentation),no) for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done -- -2.34.1 +2.47.3 diff --git a/meta-initramfs/recipes-devtools/dracut/dracut_106.bb b/meta-initramfs/recipes-devtools/dracut/dracut_108.bb similarity index 59% rename from meta-initramfs/recipes-devtools/dracut/dracut_106.bb rename to meta-initramfs/recipes-devtools/dracut/dracut_108.bb index d59b357dc1..5c95abbf29 100644 --- a/meta-initramfs/recipes-devtools/dracut/dracut_106.bb +++ b/meta-initramfs/recipes-devtools/dracut/dracut_108.bb @@ -7,10 +7,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" PE = "1" -SRCREV = "956c08774074ddc45b2f975e13d5c13d1fc36eff" +PV = "108" +SRCREV = "97c5568ec42abd5e6035f0cfa9d319ae6ae4e50a" SRC_URI = "git://github.com/dracut-ng/dracut-ng.git;protocol=http;branch=main \ - file://0001-feat-dracut-install-split-ldd-command-arguments-for-.patch \ - file://0001-fix-broken-symlink-in-dracut-config-examples.patch \ + file://0001-feat-dracut.sh-try-STRIP-for-strip_cmd-first.patch \ + file://0002-fix-broken-symlink-in-dracut-config-examples.patch \ " DEPENDS += "kmod" @@ -18,7 +19,6 @@ DEPENDS:append:libc-musl = " fts" inherit bash-completion pkgconfig - EXTRA_OECONF = "--prefix=${prefix} \ --libdir=${nonarch_libdir} \ --datadir=${datadir} \ @@ -55,6 +55,32 @@ do_install() { fi } +do_install:append:class-target () { + # Generate and install a config file listing where the DISTRO puts things, dracut + # is not always savvy enough to figure it out by itself + # Since this primarily fixes systemd issues, only install it when using systemd. + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + cat << EOF > ${B}/${DISTRO}.conf +stdloglvl=3 +sysloglvl=5 +sysctlconfdir=${sysconfdir}/sysctl.d +systemdutildir=${systemd_unitdir} +systemdutilconfdir=${sysconfdir}/systemd +systemdcatalog=${systemd_unitdir}catalog +systemdntpunits=${systemd_unitdir}ntp-units.d +systemdntpunitsconfdir=${sysconfdir}/systemd/ntp-units.d +systemdportable=${systemd_unitdir}/portable +systemdportableconfdir=${sysconfdir}/systemd/portable +systemdsystemunitdir=${systemd_system_unitdir} +systemdsystemconfdir=${sysconfdir}/systemd/system +systemduser=${systemd_user_unitdir} +systemduserconfdir=${sysconfdir}/systemd/user +EOF + install -m 0644 ${B}/${DISTRO}.conf ${D}${libdir}/dracut/dracut.conf.d/ + fi +} + + FILES:${PN} += "${nonarch_libdir}/kernel \ ${nonarch_libdir}/dracut \ ${systemd_unitdir} \ @@ -63,11 +89,16 @@ FILES:${PN}-dbg += "${nonarch_libdir}/dracut/.debug" CONFFILES:${PN} += "${sysconfdir}/dracut.conf" -RDEPENDS:${PN} = "findutils cpio util-linux-blkid util-linux-getopt util-linux bash ldd" +# The native variant uses a non-ldd based method of getting library +# dependencies, so ldd is only needed on the target +RDEPENDS:${PN} = "findutils cpio util-linux-blkid util-linux-getopt util-linux bash" +RDEPENDS:${PN}:append:class-target = " ldd" # This could be optimized a bit, but let's avoid non-booting systems :) -RRECOMMENDS:${PN} = "kernel-modules \ - coreutils \ - " +RRECOMMENDS:${PN}:class-target = "kernel-modules \ + coreutils \ + " + +BBCLASSEXTEND = "native nativesdk" CVE_STATUS[CVE-2010-4176] = "not-applicable-platform: Applies only to Fedora"