Skip to contentSkip to conversation

initramfs-framework: make RDEPENDS/RRECOMMENDS base package-specific

RFC PATCH In review Bastian Krause 2 participants 6 messages Apr 15, 2025 – Apr 22, 2025

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/4 initramfs-framework: make RDEPENDS/RRECOMMENDS base package-specific

initramfs-framework itself is a meta package. It cannot be referenced in PACKAGE_INSTALL directly, so the RDEPENDS/RRECOMMENDS do not have an effect. So turn them into directives for initramfs-framework-base instead.

Currently all users of initramfs-framework-* add ${VIRTUAL-RUNTIME_base-utils} explicitly to PACKAGE_INSTALL. For PACKAGE_CLASSES = "package_rpm", a dependency for /bin/sh is added by RPM's shebang detection further hiding this issue.

---
 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +2 -3
index bb4984366d..184da4f39d 100644
@@ -1,8 +1,6 @@
 SUMMARY = "Modular initramfs system"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_base-utils}"
-RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
 
 
 inherit allarch
@@ -72,6 +70,7 @@ PACKAGES = "${PN}-base \
            "
 
 FILES:${PN}-base = "/init /init.d/99-finish /dev"
+RDEPENDS:${PN}-base += "${VIRTUAL-RUNTIME_base-utils}"
 
 # 99-finish in base depends on some other module which mounts
 # the rootfs, like 90-rootfs. To replace that default, use
@@ -79,7 +78,7 @@ FILES:${PN}-base = "/init /init.d/99-finish /dev"
 # initramfs recipe and install something else, or install
 # something that runs earlier (for example, a 89-my-rootfs)
 # and mounts the rootfs. Then 90-rootfs will proceed immediately.
-RRECOMMENDS:${PN}-base += "initramfs-module-rootfs"
+RRECOMMENDS:${PN}-base += "initramfs-module-rootfs ${VIRTUAL-RUNTIME_base-utils-syslog}"
 
 SUMMARY:initramfs-module-exec = "initramfs support for easy execution of applications"
 RDEPENDS:initramfs-module-exec = "${PN}-base"
Signature · 1 line
2.39.5
#1 lore raw

RFC PATCH 2/4 core-image-initramfs-boot: drop unncessary base-utils from PACKAGE_INSTALL

base-utils are only needed because the initramfs init functionality is implemented in shell. There is no other reason in core-image-initramfs-boot to add this explicitly. So let initramfs-framework-base pull in the base-utils dependency and drop it here.

---
 meta/recipes-core/images/core-image-initramfs-boot.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/images/core-image-initramfs-boot.bb +1 -1
index 7258944751..6fc113345c 100644
@@ -4,7 +4,7 @@ LICENSE = "MIT"
 
 INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-udev"
 
-PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} ${VIRTUAL-RUNTIME_base-utils} base-passwd"
+PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} base-passwd"
 
 # Ensure the initramfs only contains the bare minimum
 IMAGE_FEATURES = ""
Signature · 1 line
2.39.5
#2 lore raw

RFC PATCH 3/4 core-image-minimal-initramfs: drop unncessary base-utils from PACKAGE_INSTALL

In reply to Bastian Krause

base-utils are only needed because the initramfs init functionality is implemented in shell. There is no other reason in core-image-minimal-initramfs to add this explicitly. So let initramfs-framework-base pull in the base-utils dependency and drop it here.

---
 meta/recipes-core/images/core-image-minimal-initramfs.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/images/core-image-minimal-initramfs.bb +1 -1
index 4e210d1bf3..fb629f1034 100644
@@ -12,7 +12,7 @@ INITRAMFS_SCRIPTS ?= "\
                       initramfs-module-install-efi \
                      "
 
-PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
+PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
 
 # Do not pollute the initrd image with rootfs features
 IMAGE_FEATURES = ""
Signature · 1 line
2.39.5
#3 lore raw

RFC PATCH 4/4 core-image-minimal-initramfs: drop explicit udev from PACKAGE_INSTALL

In reply to Bastian Krause

initramfs-module-udev pulls in the udev dependency. There is no reason in core-image-minimal-initramfs to add udev explicitly. So drop it here.

---
 meta/recipes-core/images/core-image-minimal-initramfs.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/images/core-image-minimal-initramfs.bb +1 -1
index fb629f1034..0c760b63bf 100644
@@ -12,7 +12,7 @@ INITRAMFS_SCRIPTS ?= "\
                       initramfs-module-install-efi \
                      "
 
-PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
+PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
 
 # Do not pollute the initrd image with rootfs features
 IMAGE_FEATURES = ""
Signature · 1 line
2.39.5
#4 lore raw
In reply to Bastian Krause
Quoted 9 lines · Bastian Krause

initramfs-framework itself is a meta package. It cannot be referenced in PACKAGE_INSTALL directly, so the RDEPENDS/RRECOMMENDS do not have an effect. So turn them into directives for initramfs-framework-base instead.

Currently all users of initramfs-framework-* add ${VIRTUAL-RUNTIME_base-utils} explicitly to PACKAGE_INSTALL. For PACKAGE_CLASSES = "package_rpm", a dependency for /bin/sh is added by RPM's shebang detection further hiding this issue.

Initially I stumbled upon this in a custom initramfs image with:

PACAKGE_INSTALL = "initramfs-framework-base"

Having PACKAGE_CLASSES = "package_ipk", the initramfs did not contain a shell. With PACKAGE_CLASSES = "package_rpm" however, busybox appeared (unexpectedly) in the image.

Checking the rpm package's dependencies:

  $ rpm -qp build/tmp/deploy/rpm/noarch/initramfs-framework-base-1.0-r0.noarch.rpm --requires
  warning: Found bdb_ro Packages database while attempting sqlite backend: using bdb_ro backend.
  /bin/sh
  rpmlib(CompressedFileNames) <= 3.0.4-1
  rpmlib(FileDigests) <= 4.6.0-1
  rpmlib(PayloadFilesHavePrefix) <= 4.0-1
  rpmlib(PayloadIsZstd) <= 5.4.18-1

The shebang in the initramfs-framework-base scripts is added as a dependency, pulling in busybox in my case.

Now I'm wondering if that's expected. I'm surprised that switching the package manager results in additional dependencies getting pulled in.

This seems to have caused issues before, e.g.:

https://git.yoctoproject.org/poky/commit/?id=bc5d66e793b0750e540e9dac4608b8eb9644590e

Regards,
Bastian

Quoted 36 lines
---
  meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +2 -3
index bb4984366d..184da4f39d 100644
@@ -1,8 +1,6 @@
  SUMMARY = "Modular initramfs system"
  LICENSE = "MIT"
  LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_base-utils}"
-RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
 
 
  inherit allarch
@@ -72,6 +70,7 @@ PACKAGES = "${PN}-base \
             "
 
  FILES:${PN}-base = "/init /init.d/99-finish /dev"
+RDEPENDS:${PN}-base += "${VIRTUAL-RUNTIME_base-utils}"
 
  # 99-finish in base depends on some other module which mounts
  # the rootfs, like 90-rootfs. To replace that default, use
@@ -79,7 +78,7 @@ FILES:${PN}-base = "/init /init.d/99-finish /dev"
  # initramfs recipe and install something else, or install
  # something that runs earlier (for example, a 89-my-rootfs)
  # and mounts the rootfs. Then 90-rootfs will proceed immediately.
-RRECOMMENDS:${PN}-base += "initramfs-module-rootfs"
+RRECOMMENDS:${PN}-base += "initramfs-module-rootfs ${VIRTUAL-RUNTIME_base-utils-syslog}"
 
  SUMMARY:initramfs-module-exec = "initramfs support for easy execution of applications"
  RDEPENDS:initramfs-module-exec = "${PN}-base"
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw

I wonder if there's a gap in testing somehow? Can you review everything that mentions initramfs in meta/lib/oeqa/selftest/cases, and see if it can be extended to cover this?

Alex

Quoted 96 lines · Bastian Krause via lists.openembedded.org
Quoted 9 lines · Bastian Krause

initramfs-framework itself is a meta package. It cannot be referenced in PACKAGE_INSTALL directly, so the RDEPENDS/RRECOMMENDS do not have an effect. So turn them into directives for initramfs-framework-base instead.

Currently all users of initramfs-framework-* add ${VIRTUAL-RUNTIME_base-utils} explicitly to PACKAGE_INSTALL. For PACKAGE_CLASSES = "package_rpm", a dependency for /bin/sh is added by RPM's shebang detection further hiding this issue.

Initially I stumbled upon this in a custom initramfs image with:

PACAKGE_INSTALL = "initramfs-framework-base"

Having PACKAGE_CLASSES = "package_ipk", the initramfs did not contain a shell. With PACKAGE_CLASSES = "package_rpm" however, busybox appeared (unexpectedly) in the image.

Checking the rpm package's dependencies:

   $ rpm -qp build/tmp/deploy/rpm/noarch/initramfs-framework-base-1.0-r0.noarch.rpm --requires
   warning: Found bdb_ro Packages database while attempting sqlite backend: using bdb_ro backend.
   /bin/sh
   rpmlib(CompressedFileNames) <= 3.0.4-1
   rpmlib(FileDigests) <= 4.6.0-1
   rpmlib(PayloadFilesHavePrefix) <= 4.0-1
   rpmlib(PayloadIsZstd) <= 5.4.18-1

The shebang in the initramfs-framework-base scripts is added as a dependency, pulling in busybox in my case.

Now I'm wondering if that's expected. I'm surprised that switching the package manager results in additional dependencies getting pulled in.

This seems to have caused issues before, e.g.:

   https://git.yoctoproject.org/poky/commit/?id=bc5d66e793b0750e540e9dac4608b8eb9644590e

Regards,
Bastian

Quoted 28 lines
---
  meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +1 -2
index bb4984366d..184da4f39d 100644
@@ -1,8 +1,6 @@
  SUMMARY = "Modular initramfs system"
  LICENSE = "MIT"
  LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_base-utils}"
-RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
 
 
  inherit allarch
@@ -72,6 +70,7 @@ PACKAGES = "${PN}-base \
             "
 
  FILES:${PN}-base = "/init /init.d/99-finish /dev"
+RDEPENDS:${PN}-base += "${VIRTUAL-RUNTIME_base-utils}"
 
  # 99-finish in base depends on some other module which mounts
  # the rootfs, like 90-rootfs. To replace that default, use

meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb FILES:${PN}-base = "/init /init.d/99-finish /dev" · line 84

Quoted 8 lines
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +1 -1
@@ -79,7 +78,7 @@ FILES:${PN}-base = "/init /init.d/99-finish /dev"
  # initramfs recipe and install something else, or install
  # something that runs earlier (for example, a 89-my-rootfs)
  # and mounts the rootfs. Then 90-rootfs will proceed immediately.
-RRECOMMENDS:${PN}-base += "initramfs-module-rootfs"
+RRECOMMENDS:${PN}-base += "initramfs-module-rootfs ${VIRTUAL-RUNTIME_base-utils-syslog}"
 
  SUMMARY:initramfs-module-exec = "initramfs support for easy execution of applications"
  RDEPENDS:initramfs-module-exec = "${PN}-base"

--

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#214851): https://lists.openembedded.org/g/openembedded-core/message/214851
Mute This Topic: https://lists.openembedded.org/mt/112275547/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-