Skip to contentSkip to conversation

Addendum to dracut in rootfs

PATCH New Böszörményi Zoltán 2 participants 20 messages Feb 20, 2019 – Mar 4, 2019

lore
Share & tools
lore
#0 lore raw

According to build testing for different architectures.

Best regards,
Zoltán Böszörményi

#1 lore raw

PATCH 1/3 plymouth: Use a new DISTRO_FEATURE to enable plymouth-initrd

The new DISTRO_FEATURES knob is "plymouth_initrd".

---
 meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb +2 -3
index a5b16c979..b7be9f04b 100644
@@ -36,7 +36,6 @@ PACKAGECONFIG_append_x86-64 = " drm"
 PACKAGECONFIG[drm] = "--enable-drm,--disable-drm,libdrm"
 PACKAGECONFIG[pango] = "--enable-pango,--disable-pango,pango"
 PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+3"
-PACKAGECONFIG[initrd] = ",,,"
 
 LOGO ??= "${datadir}/plymouth/bizcom.png"
 
@@ -46,12 +45,12 @@ do_install_append() {
     # Remove /var/run from package as plymouth will populate it on startup
     rm -fr "${D}${localstatedir}/run"
 
-    if ! ${@bb.utils.contains('PACKAGECONFIG', 'initrd', 'true', 'false', d)}; then
+    if ! ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'true', 'false', d)}; then
         rm -rf "${D}${libexecdir}"
     fi
 }
 
-PACKAGES =. "${@bb.utils.contains('PACKAGECONFIG', 'initrd', '${PN}-initrd ', '', d)}"
+PACKAGES =. "${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', '${PN}-initrd ', '', d)}"
 PACKAGES =+ "${PN}-set-default-theme"
 
 FILES_${PN}-initrd = "${libexecdir}/plymouth/*"
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 dracut: Use "plymouth_initrd" DISTRO_FEATURE for dependency on plymouth-initrd

In reply to Böszörményi Zoltán
---
 meta-initramfs/recipes-devtools/dracut/dracut_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +2 -1
index a148dc83f..4efdf39f6 100644
@@ -68,8 +68,9 @@ CONFFILES_${PN} += "${sysconfdir}/dracut.conf"
 
 RDEPENDS_${PN}_class-target = " \
                      findutils cpio util-linux-blkid util-linux-getopt util-linux-losetup util-linux-umount util-linux \
-                     bash ldd xz plymouth-initrd kbd-consolefonts kbd-consoletrans kbd-keymaps kbd-unimaps gzip tar sed \
+                     bash ldd xz kbd-consolefonts kbd-consoletrans kbd-keymaps kbd-unimaps gzip tar sed \
                      openssh-scp openssh-ssh linux-firmware \
+                     ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'plymouth-initrd', '', d)} \
                      ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
                     "
 RDEPENDS_${PN}_class-native = "coreutils-native findutils-native cpio-native util-linux-native bash-native cross-compiler-ldd"
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 dracut: Use architecture override to RRECOMMEND intel-microcode

In reply to Böszörményi Zoltán
---
 meta-initramfs/recipes-devtools/dracut/dracut_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +3 -1
index 4efdf39f6..e168e05a6 100644
@@ -80,7 +80,9 @@ RRECOMMENDS_${PN}_class-target = " \
                      kernel-modules \
                      busybox \
                      coreutils \
-                     intel-microcode \
                     "
 
+RRECOMMENDS_${PN}_append_x86 = " intel-microcode "
+RRECOMMENDS_${PN}_append_x86-64 = " intel-microcode "
+
 BBCLASSEXTEND = "native"
Signature · 1 line
2.20.1
#5 lore raw

PATCH 1/4 plymouth: Use a new DISTRO_FEATURE to enable plymouth-initrd

The new DISTRO_FEATURES knob is "plymouth_initrd".

---
 meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb +2 -3
index a5b16c979..b7be9f04b 100644
@@ -36,7 +36,6 @@ PACKAGECONFIG_append_x86-64 = " drm"
 PACKAGECONFIG[drm] = "--enable-drm,--disable-drm,libdrm"
 PACKAGECONFIG[pango] = "--enable-pango,--disable-pango,pango"
 PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+3"
-PACKAGECONFIG[initrd] = ",,,"
 
 LOGO ??= "${datadir}/plymouth/bizcom.png"
 
@@ -46,12 +45,12 @@ do_install_append() {
     # Remove /var/run from package as plymouth will populate it on startup
     rm -fr "${D}${localstatedir}/run"
 
-    if ! ${@bb.utils.contains('PACKAGECONFIG', 'initrd', 'true', 'false', d)}; then
+    if ! ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'true', 'false', d)}; then
         rm -rf "${D}${libexecdir}"
     fi
 }
 
-PACKAGES =. "${@bb.utils.contains('PACKAGECONFIG', 'initrd', '${PN}-initrd ', '', d)}"
+PACKAGES =. "${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', '${PN}-initrd ', '', d)}"
 PACKAGES =+ "${PN}-set-default-theme"
 
 FILES_${PN}-initrd = "${libexecdir}/plymouth/*"
Signature · 1 line
2.20.1
#6 lore raw

PATCH 2/4 dracut: Use "plymouth_initrd" DISTRO_FEATURE for dependency on plymouth-initrd

In reply to Böszörményi Zoltán
---
 meta-initramfs/recipes-devtools/dracut/dracut_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +2 -1
index a148dc83f..4efdf39f6 100644
@@ -68,8 +68,9 @@ CONFFILES_${PN} += "${sysconfdir}/dracut.conf"
 
 RDEPENDS_${PN}_class-target = " \
                      findutils cpio util-linux-blkid util-linux-getopt util-linux-losetup util-linux-umount util-linux \
-                     bash ldd xz plymouth-initrd kbd-consolefonts kbd-consoletrans kbd-keymaps kbd-unimaps gzip tar sed \
+                     bash ldd xz kbd-consolefonts kbd-consoletrans kbd-keymaps kbd-unimaps gzip tar sed \
                      openssh-scp openssh-ssh linux-firmware \
+                     ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'plymouth-initrd', '', d)} \
                      ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
                     "
 RDEPENDS_${PN}_class-native = "coreutils-native findutils-native cpio-native util-linux-native bash-native cross-compiler-ldd"
Signature · 1 line
2.20.1
#7 lore raw

PATCH 3/4 dracut: Use architecture override to RRECOMMEND intel-microcode

In reply to Böszörményi Zoltán
---
 meta-initramfs/recipes-devtools/dracut/dracut_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +3 -1
index 4efdf39f6..e168e05a6 100644
@@ -80,7 +80,9 @@ RRECOMMENDS_${PN}_class-target = " \
                      kernel-modules \
                      busybox \
                      coreutils \
-                     intel-microcode \
                     "
 
+RRECOMMENDS_${PN}_append_x86 = " intel-microcode "
+RRECOMMENDS_${PN}_append_x86-64 = " intel-microcode "
+
 BBCLASSEXTEND = "native"
Signature · 1 line
2.20.1
#8 lore raw

PATCH 4/4 dracut.bbclass: Use systemd DISTRO_FEATURE to depend on systemd

In reply to Böszörményi Zoltán
---
 meta-initramfs/classes/dracut.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-initramfs/classes/dracut.bbclass +1 -1
index 3c1421df8..58c4493a3 100644
@@ -76,7 +76,7 @@ DRACUT_DEPENDS = " \
 			ldconfig-native coreutils-native findutils-native \
 			cpio-native util-linux-native kmod-native xz-native \
 			dracut-native pkgconfig-native cross-compiler-ldd \
-			systemd \
+			${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
 		"
 DEPENDS_append_class-target = " ${DRACUT_DEPENDS}"
 PACKAGE_WRITE_DEPS_append = " ${DRACUT_DEPENDS}"
Signature · 1 line
2.20.1
#10 lore raw

PATCH v3 1/7 cross-compiler-ldd: add new recipe

dracut runs ldd internally when discovering library dependencies for executables. cross-compiler-ldd is needed so dracut may eventually run while creating the rootfs.

---
 .../cross-compile-ldd-fix-infinite-loop.patch | 19 +++++++++++
 .../dracut/cross-compiler-ldd_git.bb          | 33 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 meta-initramfs/recipes-devtools/dracut/cross-compiler-ldd/cross-compile-ldd-fix-infinite-loop.patch
 create mode 100644 meta-initramfs/recipes-devtools/dracut/cross-compiler-ldd_git.bb
meta-initramfs/recipes-devtools/dracut/cross-compiler-ldd/cross-compile-ldd-fix-infinite-loop.patch new file +19 -0
new file mode 100644
index 000000000..4aae731d1
@@ -0,0 +1,19 @@
+diff --git a/cross-compile-ldd b/cross-compile-ldd
+index ef2ca20..332d57f 100644
+--- a/cross-compile-ldd
++++ b/cross-compile-ldd
+@@ -337,13 +337,13 @@ do_scan_etc_ldsoconf() {
+ # Build up the full list of search directories
+ declare -a needed_search_path
+ do_trace "Adding basic lib dirs\n"
+-ld_library_path="${ld_library_path}:"
+ while [ -n "${ld_library_path}" ]; do
+     d="${ld_library_path%%:*}"
+     if [ -n "${d}" ]; then
+         do_trace "-> adding search dir '%s'\n" "${d}"
+         needed_search_path+=( "${d}" )
+     fi
++    [[ "$ld_library_path" == "${ld_library_path#*:}" ]] && break
+     ld_library_path="${ld_library_path#*:}"
+ done
+ do_trace "Done adding basic lib dirs\n"
meta-initramfs/recipes-devtools/dracut/cross-compiler-ldd_git.bb new file +33 -0
new file mode 100644
index 000000000..f8b7906ea
@@ -0,0 +1,33 @@
+SUMMARY = "Cross-compiler LDD"
+HOMEPAGE = "https://gist.github.com/c403786c1394f53f44a3b61214489e6f"
+BUGTRACKER = ""
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://cross-compile-ldd;beginline=53;endline=57;md5=2b29d19d18a430b931dda3750e865c84"
+
+SRCBRANCH = "master"
+SRCREV = "eb44581caf7dd60b149a6691abef46264c46e866"
+SRC_URI = " \
+			git://gist.github.com/c403786c1394f53f44a3b61214489e6f.git;protocol=https;branch=${SRCBRANCH} \
+			file://cross-compile-ldd-fix-infinite-loop.patch \
+		"
+
+S = "${WORKDIR}/git"
+
+inherit siteinfo
+
+SYSROOT_PREPROCESS_FUNCS += " cross_ldd_populate_sysroot "
+
+cross_ldd_populate_sysroot() {
+	mkdir -p ${SYSROOT_DESTDIR}${bindir_crossscripts}
+	cat ${S}/cross-compile-ldd | \
+		sed \
+			-e "s,^prefix=.*$,prefix=${TARGET_SYS}," \
+			-e "s,^bits=.*$,bits=${SITEINFO_BITS}," \
+			-e "s,^ld_library_path=.*$,ld_library_path=${LD_LIBRARY_PATH:-/lib:/usr/lib}," \
+		>${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
+	chmod +x ${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
+}
+
+DEPENDS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
+PACKAGE_WRITE_DEPS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
Signature · 1 line
2.20.1
#11 lore raw

PATCH v3 2/7 dracut: Allow native build

In reply to Böszörményi Zoltán

For useful modules to be successfully included into the initramfs, the dependencies must be extended.

---
v2: Only RDEPEND on systemd if DISTRO_FEATURES has it.

v3: Use plymouth_initrd DISTRO_FEATURE to depend on plymouth-initrd.

 .../recipes-devtools/dracut/dracut_git.bb        | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +14 -2
index dd2e8bbb3..a1d7cb119 100644
@@ -59,11 +59,23 @@ FILES_${PN}-dbg += "${prefix}/lib/dracut/.debug"
 
 CONFFILES_${PN} += "${sysconfdir}/dracut.conf"
 
-RDEPENDS_${PN} = "findutils cpio util-linux-blkid util-linux-getopt util-linux bash ldd"
+RDEPENDS_${PN}_class-target = " \
+                     findutils cpio util-linux-blkid util-linux-getopt util-linux-losetup util-linux-umount util-linux \
+                     bash ldd xz kbd-consolefonts kbd-consoletrans kbd-keymaps kbd-unimaps gzip tar sed \
+                     openssh-scp openssh-ssh linux-firmware \
+                     ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'plymouth-initrd', '', d)} \
+                     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
+                    "
+RDEPENDS_${PN}_class-native = "coreutils-native findutils-native cpio-native util-linux-native bash-native cross-compiler-ldd"
 
 # This could be optimized a bit, but let's avoid non-booting systems :)
-RRECOMMENDS_${PN} = " \
+RRECOMMENDS_${PN}_class-target = " \
                      kernel-modules \
                      busybox \
                      coreutils \
                     "
+
+RRECOMMENDS_${PN}_append_x86_class-target = " intel-microcode "
+RRECOMMENDS_${PN}_append_x86-64_class-target = " intel-microcode "
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.20.1
#12 lore raw

PATCH v2 3/7 dracut: Add execute_dracut opkg intercept script

In reply to Böszörményi Zoltán

---
v2: The script name is execute_dracut, not execute-dracut
so it is identical to the postinst-intercepts variant.

 .../dracut/dracut/execute_dracut              | 21 +++++++++++++++++++
 .../recipes-devtools/dracut/dracut_git.bb     |  5 +++++
 2 files changed, 26 insertions(+)
 create mode 100755 meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut
meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut new file +21 -0
new file mode 100755
index 000000000..96bcc92ed
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ ! -f $OPKG_INTERCEPT_DIR/execute-dracut ]; then
+	KERNEL_VERSION=$1
+	shift
+	MY_KERNEL_VERSION=$(readlink /boot/bzimage | sed 's,^.*bzImage-,,')
+	if [[ -z "$MY_KERNEL_VERSION" ]]; then
+		if [[ -d /lib/modules/$KERNEL_VERSION ]]; then
+			MY_KERNEL_VERSION="${KERNEL_VERSION}"
+		fi
+	fi
+	[[ -z "$MY_KERNEL_VERSION" ]] && echo COULD NOT DETERMINE KERNEL VERSION TO RUN DEPMOD AND DRACUT && echo PLEASE DO IT MANUALLY && exit 0
+	cat <<EOF > $OPKG_INTERCEPT_DIR/execute-dracut
+echo RUNNING: depmod -a $MY_KERNEL_VERSION
+depmod -a $MY_KERNEL_VERSION
+echo RUNNING: dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
+echo "dracut: $(dracut --help | grep 'Version:')"
+dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
+EOF
+	chmod +x $OPKG_INTERCEPT_DIR/execute-dracut
+fi
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +5 -0
index a1d7cb119..cb49d9539 100644
@@ -12,6 +12,7 @@ PV = "049"
 SRCREV = "225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1"
 SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
            file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
+           file://execute_dracut \
            "
 
 DEPENDS += "kmod"
@@ -49,11 +50,15 @@ do_install() {
     # Its Makefile uses cp -arx to install modules.d, so fix the owner
     # to root:root
     chown -R root:root ${D}/${prefix}/lib/dracut/modules.d
+
+    install -d -m0755 ${D}${datadir}/opkg/intercept
+    install -m0755 ${WORKDIR}/execute_dracut ${D}${datadir}/opkg/intercept
 }
 
 FILES_${PN} += "${prefix}/lib/kernel \
                 ${prefix}/lib/dracut \
                 ${systemd_unitdir} \
+                ${datadir}/opkg/intercept \
                "
 FILES_${PN}-dbg += "${prefix}/lib/dracut/.debug"
 
Signature · 1 line
2.20.1
#13 lore raw

Re: [meta-initramfs][PATCH 3/7 v2] dracut: Add execute_dracut opkg intercept script

Quoted 17 lines · Böszörményi Zoltán

---
v2: The script name is execute_dracut, not execute-dracut
so it is identical to the postinst-intercepts variant.

 .../dracut/dracut/execute_dracut              | 21 +++++++++++++++++++
 .../recipes-devtools/dracut/dracut_git.bb     |  5 +++++
 2 files changed, 26 insertions(+)
 create mode 100755 meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut
meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut new file +0 -0
new file mode 100755
index 000000000..96bcc92ed

meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut line 6

Quoted 6 lines
meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut new file +6 -0
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ ! -f $OPKG_INTERCEPT_DIR/execute-dracut ]; then
+       KERNEL_VERSION=$1
+       shift
+       MY_KERNEL_VERSION=$(readlink /boot/bzimage | sed 's,^.*bzImage-,,')

this assumption breaks all image builds for qemux86 and qemux86_64 unless that is fixed, it will be hard to accept this series. bzImage is not the kernel name always and may not be present in rootfs all the time.

ERROR: yoe-simple-image-1.0-r0 do_rootfs: The postinstall intercept hook 'execute_dracut' failed, details in /mnt/a/yoe/build/tmp/work/qemux86-yoe-linux/yoe-s imple-image/1.0-r0/temp/log.do_rootfs
ERROR: yoe-simple-image-1.0-r0 do_rootfs:
ERROR: yoe-simple-image-1.0-r0 do_rootfs: Function failed: do_rootfs

Quoted 46 lines
meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut new file +15 -0
+       if [[ -z "$MY_KERNEL_VERSION" ]]; then
+               if [[ -d /lib/modules/$KERNEL_VERSION ]]; then
+                       MY_KERNEL_VERSION="${KERNEL_VERSION}"
+               fi
+       fi
+       [[ -z "$MY_KERNEL_VERSION" ]] && echo COULD NOT DETERMINE KERNEL VERSION TO RUN DEPMOD AND DRACUT && echo PLEASE DO IT MANUALLY && exit 0
+       cat <<EOF > $OPKG_INTERCEPT_DIR/execute-dracut
+echo RUNNING: depmod -a $MY_KERNEL_VERSION
+depmod -a $MY_KERNEL_VERSION
+echo RUNNING: dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
+echo "dracut: $(dracut --help | grep 'Version:')"
+dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
+EOF
+       chmod +x $OPKG_INTERCEPT_DIR/execute-dracut
+fi
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +5 -1
index a1d7cb119..cb49d9539 100644
@@ -12,6 +12,7 @@ PV = "049"
 SRCREV = "225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1"
 SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
            file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
+           file://execute_dracut \
            "
 
 DEPENDS += "kmod"
@@ -49,11 +50,15 @@ do_install() {
     # Its Makefile uses cp -arx to install modules.d, so fix the owner
     # to root:root
     chown -R root:root ${D}/${prefix}/lib/dracut/modules.d
+
+    install -d -m0755 ${D}${datadir}/opkg/intercept
+    install -m0755 ${WORKDIR}/execute_dracut ${D}${datadir}/opkg/intercept
 }
 
 FILES_${PN} += "${prefix}/lib/kernel \
                 ${prefix}/lib/dracut \
                 ${systemd_unitdir} \
+                ${datadir}/opkg/intercept \
                "
 FILES_${PN}-dbg += "${prefix}/lib/dracut/.debug"
 
--

2.20.1

#14 lore raw

Re: [meta-initramfs][PATCH 3/7 v2] dracut: Add execute_dracut opkg intercept script

2019. 03. 03. 23:05 keltezéssel, Khem Raj írta:

Quoted 12 lines · Böszörményi Zoltán
Quoted 11 lines

---
v2: The script name is execute_dracut, not execute-dracut
so it is identical to the postinst-intercepts variant.

  .../dracut/dracut/execute_dracut              | 21 +++++++++++++++++++
  .../recipes-devtools/dracut/dracut_git.bb     |  5 +++++
  2 files changed, 26 insertions(+)

create mode 100755 meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut

Quoted 16 lines

meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut line 6

Quoted 12 lines
meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut new file +6 -0
new file mode 100755
index 000000000..96bcc92ed
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ ! -f $OPKG_INTERCEPT_DIR/execute-dracut ]; then
+       KERNEL_VERSION=$1
+       shift
+       MY_KERNEL_VERSION=$(readlink /boot/bzimage | sed 's,^.*bzImage-,,')

this assumption breaks all image builds for qemux86 and qemux86_64 unless that is fixed, it will be hard to accept this series. bzImage is not the kernel name always

I have read kernel.bbclass more closely and I can use ${KERNEL_IMAGETYPE} and ${KERNEL_IMAGEDEST} to remove these assumptions.

Quoted 2 lines

and may not be present in rootfs all the
time.

Now, based on the code of kernel.bbclass, it's hard to believe that the kernel image is not always present in rootfs.

According to the code in kernel.bbclass ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} will always be a symlink to ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} in the same directory.

Quoted 57 lines

ERROR: yoe-simple-image-1.0-r0 do_rootfs: The postinstall intercept hook 'execute_dracut' failed, details in /mnt/a/yoe/build/tmp/work/qemux86-yoe-linux/yoe-s imple-image/1.0-r0/temp/log.do_rootfs
ERROR: yoe-simple-image-1.0-r0 do_rootfs:
ERROR: yoe-simple-image-1.0-r0 do_rootfs: Function failed: do_rootfs

Quoted 46 lines
meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut new file +15 -0
+       if [[ -z "$MY_KERNEL_VERSION" ]]; then
+               if [[ -d /lib/modules/$KERNEL_VERSION ]]; then
+                       MY_KERNEL_VERSION="${KERNEL_VERSION}"
+               fi
+       fi
+       [[ -z "$MY_KERNEL_VERSION" ]] && echo COULD NOT DETERMINE KERNEL VERSION TO RUN DEPMOD AND DRACUT && echo PLEASE DO IT MANUALLY && exit 0
+       cat <<EOF > $OPKG_INTERCEPT_DIR/execute-dracut
+echo RUNNING: depmod -a $MY_KERNEL_VERSION
+depmod -a $MY_KERNEL_VERSION
+echo RUNNING: dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
+echo "dracut: $(dracut --help | grep 'Version:')"
+dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
+EOF
+       chmod +x $OPKG_INTERCEPT_DIR/execute-dracut
+fi
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +5 -1
index a1d7cb119..cb49d9539 100644
@@ -12,6 +12,7 @@ PV = "049"
  SRCREV = "225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1"
  SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
             file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
+           file://execute_dracut \
             "
 
  DEPENDS += "kmod"
@@ -49,11 +50,15 @@ do_install() {
      # Its Makefile uses cp -arx to install modules.d, so fix the owner
      # to root:root
      chown -R root:root ${D}/${prefix}/lib/dracut/modules.d
+
+    install -d -m0755 ${D}${datadir}/opkg/intercept
+    install -m0755 ${WORKDIR}/execute_dracut ${D}${datadir}/opkg/intercept
  }
 
  FILES_${PN} += "${prefix}/lib/kernel \
                  ${prefix}/lib/dracut \
                  ${systemd_unitdir} \
+                ${datadir}/opkg/intercept \
                 "
  FILES_${PN}-dbg += "${prefix}/lib/dracut/.debug"
 
--

2.20.1

#15 lore raw

PATCH v3 4/7 meta-initramfs: Add postinst-intercepts/execute_dracut

In reply to Böszörményi Zoltán

So dracut can be triggered to run during do_rootfs.

---
 .../postinst-intercepts/execute_dracut          | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100755 meta-initramfs/postinst-intercepts/execute_dracut
meta-initramfs/postinst-intercepts/execute_dracut new file +17 -0
new file mode 100755
index 000000000..78d81a902
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+export \
+	prefix dracutsysrootdir \
+	systemdutildir systemdsystemunitdir systemdsystemconfdir udevdir \
+	DRACUT_ARCH DRACUT_TESTBIN DRACUT_LDD DRACUT_LDCONFIG \
+	DRACUT_COMPRESS_LZMA DRACUT_INSTALL DRACUT_INSTALL_PATH
+
+[[ -d $DRACUT_TMPDIR ]] || mkdir -p $DRACUT_TMPDIR
+
+echo RUNNING: depmod $DEPMODOPT -a $MY_KERNEL_VERSION
+depmod $DEPMODOPT -a $MY_KERNEL_VERSION
+echo "dracut: $(dracut --help | grep 'Version:')"
+echo RUNNING: dracut -f --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS $EXTRAOPTS $D/boot/initramfs.img $MY_KERNEL_VERSION
+dracut -f --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS $EXTRAOPTS $D/boot/initramfs.img $MY_KERNEL_VERSION
Signature · 1 line
2.20.1
#16 lore raw

PATCH v3 5/7 classes/dracut.bbclass: add new bbclass

In reply to Böszörményi Zoltán

dracut.bbclass can be used from kernel or other recipes, like custom dracut modules or plymouth boot splash themes.

---
v2: Use ${TUNE_ARCH} so allarch packages can use this bbclass.

v3: Conditionally depend on systemd based on DISTRO_FEATURES.

 meta-initramfs/classes/dracut.bbclass | 82 +++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 meta-initramfs/classes/dracut.bbclass
meta-initramfs/classes/dracut.bbclass new file +82 -0
new file mode 100644
index 000000000..58c4493a3
@@ -0,0 +1,82 @@
+DRACUT_PN ??= "${PN}"
+DRACUT_OPTS ??= "--early-microcode --lzma"
+
+python __anonymous () {
+    pkg = d.getVar("DRACUT_PN", True)
+    if pkg != 'dracut':
+        d.appendVar("RDEPENDS_%s" % pkg, " dracut ")
+    if not pkg.startswith('kernel'):
+        d.appendVarFlag("do_configure", "depends", "virtual/kernel:do_shared_workdir")
+        d.appendVarFlag("do_compile", "depends", "virtual/kernel:do_compile_kernelmodules")
+}
+
+export BUILD_TIME_KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
+
+dracut_postinst () {
+	MY_KERNEL_VERSION=$(readlink $D/boot/bzimage | sed 's,^.*bzImage-,,')
+	if [[ -z "$MY_KERNEL_VERSION" ]]; then
+		MY_KERNEL_VERSION="${KERNEL_VERSION}"
+	fi
+	if [[ -z "$MY_KERNEL_VERSION" ]]; then
+		MY_KERNEL_VERSION="${BUILD_TIME_KERNEL_VERSION}"
+	fi
+	if [[ -z "$MY_KERNEL_VERSION" ]]; then
+		exit 1
+	fi
+
+	if [ -n "$D" ]; then
+		#DEBUGOPTS="--debug --keep"
+		DEBUGOPTS="--keep"
+
+		# We have to unset "prefix" as dracut uses it to move files around.
+		# Yocto has it set as part of the build environment.
+		$INTERCEPT_DIR/postinst_intercept execute_dracut ${PKG} mlprefix=${MLPREFIX} \
+			prefix= \
+			MY_KERNEL_VERSION=$MY_KERNEL_VERSION \
+			DEPMODOPT="\"-b $D\"" \
+			dracutsysrootdir=$D \
+			DEBUGOPTS="\"$DEBUGOPTS\"" \
+			DRACUT_OPTS="\"${DRACUT_OPTS}\"" \
+			EXTRAOPTS="\"-k $D/lib/modules/$MY_KERNEL_VERSION\"" \
+			systemdutildir=${systemd_unitdir} \
+			systemdsystemunitdir=${systemd_system_unitdir} \
+			systemdsystemconfdir=/etc/systemd/system \
+			udevdir=/usr/lib/udev \
+			DRACUT_TMPDIR=${WORKDIR}/dracut-tmpdir \
+			DRACUT_ARCH="${TUNE_ARCH}" \
+			DRACUT_TESTBIN=/bin/bash.bash \
+			DRACUT_COMPRESS_LZMA=$NATIVE_ROOT/usr/bin/lzma \
+			DRACUT_LDD="\"PATH='$PATH' ${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
+			DRACUT_LDCONFIG=$NATIVE_ROOT/usr/bin/ldconfig \
+			DRACUT_INSTALL="\"$NATIVE_ROOT/usr/lib/dracut/dracut-install\"" \
+			DRACUT_INSTALL_PATH="/usr/sbin:/usr/bin:/sbin:/bin"
+	else
+		execute_dracut $MY_KERNEL_VERSION ${DRACUT_OPTS}
+	fi
+}
+
+dracut_populate_packages[vardeps] += "dracut_postinst"
+
+python dracut_populate_packages() {
+    localdata = d.createCopy()
+
+    pkg = d.getVar('DRACUT_PN', True)
+
+    postinst = d.getVar('pkg_postinst_%s' % pkg, True)
+    if not postinst:
+        postinst = '#!/bin/sh\n'
+    postinst += localdata.getVar('dracut_postinst', True)
+    d.setVar('pkg_postinst_%s' % pkg, postinst)
+}
+
+PACKAGESPLITFUNCS_prepend = "dracut_populate_packages "
+
+DRACUT_DEPENDS = " \
+			binutils-cross-${TUNE_ARCH} gcc-cross-${TUNE_ARCH} \
+			ldconfig-native coreutils-native findutils-native \
+			cpio-native util-linux-native kmod-native xz-native \
+			dracut-native pkgconfig-native cross-compiler-ldd \
+			${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
+		"
+DEPENDS_append_class-target = " ${DRACUT_DEPENDS}"
+PACKAGE_WRITE_DEPS_append = " ${DRACUT_DEPENDS}"
Signature · 1 line
2.20.1
#17 lore raw

PATCH v3 6/7 plymouth: Use plymouth_initrd DISTRO_FEATURE

In reply to Böszörményi Zoltán

dracut conditionally depends plymouth-initrd using the same DISTRO_FEATURE knob.

---
 meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb +2 -3
index a5b16c979..b7be9f04b 100644
@@ -36,7 +36,6 @@ PACKAGECONFIG_append_x86-64 = " drm"
 PACKAGECONFIG[drm] = "--enable-drm,--disable-drm,libdrm"
 PACKAGECONFIG[pango] = "--enable-pango,--disable-pango,pango"
 PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+3"
-PACKAGECONFIG[initrd] = ",,,"
 
 LOGO ??= "${datadir}/plymouth/bizcom.png"
 
@@ -46,12 +45,12 @@ do_install_append() {
     # Remove /var/run from package as plymouth will populate it on startup
     rm -fr "${D}${localstatedir}/run"
 
-    if ! ${@bb.utils.contains('PACKAGECONFIG', 'initrd', 'true', 'false', d)}; then
+    if ! ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'true', 'false', d)}; then
         rm -rf "${D}${libexecdir}"
     fi
 }
 
-PACKAGES =. "${@bb.utils.contains('PACKAGECONFIG', 'initrd', '${PN}-initrd ', '', d)}"
+PACKAGES =. "${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', '${PN}-initrd ', '', d)}"
 PACKAGES =+ "${PN}-set-default-theme"
 
 FILES_${PN}-initrd = "${libexecdir}/plymouth/*"
Signature · 1 line
2.20.1
#18 lore raw

Re: [meta-oe][PATCH 6/7] plymouth: Use plymouth_initrd DISTRO_FEATURE

Quoted 4 lines · Böszörményi Zoltán

dracut conditionally depends plymouth-initrd using the same DISTRO_FEATURE knob.

cant apply this on top of master-next, can you rebase and resend

Quoted 35 lines
---
 meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta-oe/recipes-core/plymouth/plymouth_0.9.2.bb +2 -4
index a5b16c979..b7be9f04b 100644
@@ -36,7 +36,6 @@ PACKAGECONFIG_append_x86-64 = " drm"
 PACKAGECONFIG[drm] = "--enable-drm,--disable-drm,libdrm"
 PACKAGECONFIG[pango] = "--enable-pango,--disable-pango,pango"
 PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+3"
-PACKAGECONFIG[initrd] = ",,,"
 
 LOGO ??= "${datadir}/plymouth/bizcom.png"
 
@@ -46,12 +45,12 @@ do_install_append() {
     # Remove /var/run from package as plymouth will populate it on startup
     rm -fr "${D}${localstatedir}/run"
 
-    if ! ${@bb.utils.contains('PACKAGECONFIG', 'initrd', 'true', 'false', d)}; then
+    if ! ${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', 'true', 'false', d)}; then
         rm -rf "${D}${libexecdir}"
     fi
 }
 
-PACKAGES =. "${@bb.utils.contains('PACKAGECONFIG', 'initrd', '${PN}-initrd ', '', d)}"
+PACKAGES =. "${@bb.utils.contains('DISTRO_FEATURES', 'plymouth_initrd', '${PN}-initrd ', '', d)}"
 PACKAGES =+ "${PN}-set-default-theme"
 
 FILES_${PN}-initrd = "${libexecdir}/plymouth/*"
--

2.20.1

#19 lore raw

PATCH v3 7/7 dracut: use the code that allows running under do_rootfs

In reply to Böszörményi Zoltán
---
 meta-initramfs/recipes-devtools/dracut/dracut_git.bb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
meta-initramfs/recipes-devtools/dracut/dracut_git.bb +6 -4
index cb49d9539..fdc4c1309 100644
@@ -6,11 +6,13 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
 PE = "1"
-PV = "049"
+PV = "050"
+PR = "r0.alpha.rootfs"
 
-# v048 tag
-SRCREV = "225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1"
-SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
+# v049 tag plus run from a rootfs
+SRCBRANCH = "allow-separate-rootfs"
+SRCREV = "6fe40f64f923e61e17c9d3db06cf9bfe6e83a68a"
+SRC_URI = "git://github.com/zboszor/dracut.git;protocol=https;branch=${SRCBRANCH} \
            file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
            file://execute_dracut \
            "
Signature · 1 line
2.20.1