diff mbox series

[v3,05/11] core-image-initramfs-boot: don't install RRECOMMENDS to reduce size

Message ID 20250404162932.447699-6-mikko.rapeli@linaro.org
State New
Headers show
Series systemd based initrd and modular kernel support | expand

Commit Message

Mikko Rapeli April 4, 2025, 4:29 p.m. UTC
Disables recommends to only install important packages.
Disable machine specific additions which are meant for
full rootfs boot. For example on genericarm64, full
set of kernel modules and WiFi related firmware is
in the machine recommends and those are not needed when
booting to rootfs from an initrd. These reduce systemd
initrd size from 200Mb to 54Mb.

Since recommends are not automatically installed anymore,
explicitly add initramfs-module-rootfs, busybox-udhcpc and libkmod
to shell script based initrd. initramfs-module-rootfs is needed to
mount the rootfs. Installing busybox-udhcpc and libkmod
for backwards compatibility.

Not installing openssl-conf, openssl-ossl-module-legacy or
ldconfig packages since they don't seem essential in initrd
to mount the rootfs.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 meta/recipes-core/images/core-image-initramfs-boot.bb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Richard Purdie April 10, 2025, 12:47 p.m. UTC | #1
On Fri, 2025-04-04 at 19:29 +0300, Mikko Rapeli via
lists.openembedded.org wrote:
> Disables recommends to only install important packages.
> Disable machine specific additions which are meant for
> full rootfs boot. For example on genericarm64, full
> set of kernel modules and WiFi related firmware is
> in the machine recommends and those are not needed when
> booting to rootfs from an initrd. These reduce systemd
> initrd size from 200Mb to 54Mb.
> 
> Since recommends are not automatically installed anymore,
> explicitly add initramfs-module-rootfs, busybox-udhcpc and libkmod
> to shell script based initrd. initramfs-module-rootfs is needed to
> mount the rootfs. Installing busybox-udhcpc and libkmod
> for backwards compatibility.
> 
> Not installing openssl-conf, openssl-ossl-module-legacy or
> ldconfig packages since they don't seem essential in initrd
> to mount the rootfs.
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> ---
>  meta/recipes-core/images/core-image-initramfs-boot.bb | 11
> ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-core/images/core-image-initramfs-boot.bb
> b/meta/recipes-core/images/core-image-initramfs-boot.bb
> index c66c28db76..99388476ac 100644
> --- a/meta/recipes-core/images/core-image-initramfs-boot.bb
> +++ b/meta/recipes-core/images/core-image-initramfs-boot.bb
> @@ -2,7 +2,7 @@ SUMMARY = "Basic initramfs to boot a fully-featured
> rootfs"
>  DESCRIPTION = "Small initramfs that contains just udev and init, to
> find the real rootfs."
>  LICENSE = "MIT"
>  
> -INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-
> udev"
> +INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-udev
> initramfs-module-rootfs"
>  
>  inherit image
>  
> @@ -20,8 +20,17 @@ PACKAGE_INSTALL = " \
>          ${VIRTUAL-RUNTIME_dev_manager} \
>      ', '${INITRAMFS_SCRIPTS}', d)} \
>      base-passwd \
> +    busybox-udhcpc \
> +    libkmod \
>  "
>  
> +# reduce size
> +NO_RECOMMENDATIONS = "1"
> +
> +# don't install automatically, pick manually instead
> +MACHINE_EXTRA_RDEPENDS = ""

I'd probably accept that removing the rrecommends below is probably ok
for the initramfs but I'm not convinced removing rdepends is a good
move. If that works, are the things in question really rdepends for the
machine?

> +MACHINE_EXTRA_RRECOMMENDS = ""
> +
>  # Ensure the initramfs only contains the bare minimum
>  IMAGE_FEATURES = ""
>  IMAGE_LINGUAS = ""

Cheers,

Richard
Mikko Rapeli April 10, 2025, 1:09 p.m. UTC | #2
Hi,

On Thu, Apr 10, 2025 at 01:47:27PM +0100, Richard Purdie wrote:
> On Fri, 2025-04-04 at 19:29 +0300, Mikko Rapeli via
> lists.openembedded.org wrote:
> > Disables recommends to only install important packages.
> > Disable machine specific additions which are meant for
> > full rootfs boot. For example on genericarm64, full
> > set of kernel modules and WiFi related firmware is
> > in the machine recommends and those are not needed when
> > booting to rootfs from an initrd. These reduce systemd
> > initrd size from 200Mb to 54Mb.
> > 
> > Since recommends are not automatically installed anymore,
> > explicitly add initramfs-module-rootfs, busybox-udhcpc and libkmod
> > to shell script based initrd. initramfs-module-rootfs is needed to
> > mount the rootfs. Installing busybox-udhcpc and libkmod
> > for backwards compatibility.
> > 
> > Not installing openssl-conf, openssl-ossl-module-legacy or
> > ldconfig packages since they don't seem essential in initrd
> > to mount the rootfs.
> > 
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> > ---
> > �meta/recipes-core/images/core-image-initramfs-boot.bb | 11
> > ++++++++++-
> > �1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/recipes-core/images/core-image-initramfs-boot.bb
> > b/meta/recipes-core/images/core-image-initramfs-boot.bb
> > index c66c28db76..99388476ac 100644
> > --- a/meta/recipes-core/images/core-image-initramfs-boot.bb
> > +++ b/meta/recipes-core/images/core-image-initramfs-boot.bb
> > @@ -2,7 +2,7 @@ SUMMARY = "Basic initramfs to boot a fully-featured
> > rootfs"
> > �DESCRIPTION = "Small initramfs that contains just udev and init, to
> > find the real rootfs."
> > �LICENSE = "MIT"
> > �
> > -INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-
> > udev"
> > +INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-udev
> > initramfs-module-rootfs"
> > �
> > �inherit image
> > �
> > @@ -20,8 +20,17 @@ PACKAGE_INSTALL = " \
> > �������� ${VIRTUAL-RUNTIME_dev_manager} \
> > ���� ', '${INITRAMFS_SCRIPTS}', d)} \
> > ���� base-passwd \
> > +��� busybox-udhcpc \
> > +��� libkmod \
> > �"
> > �
> > +# reduce size
> > +NO_RECOMMENDATIONS = "1"
> > +
> > +# don't install automatically, pick manually instead
> > +MACHINE_EXTRA_RDEPENDS = ""
> 
> I'd probably accept that removing the rrecommends below is probably ok
> for the initramfs but I'm not convinced removing rdepends is a good
> move. If that works, are the things in question really rdepends for the
> machine?

If MACHINE_EXTRA_RDEPENDS is for:

"A list of machine-specific packages to install as part of the image
being built that are __not essential for the machine to boot__. However,
the build process for more fully-featured images depends on the packages
being present."

Then I would think they are not needed for initramfs usecases.

Cheers,

-Mikko
diff mbox series

Patch

diff --git a/meta/recipes-core/images/core-image-initramfs-boot.bb b/meta/recipes-core/images/core-image-initramfs-boot.bb
index c66c28db76..99388476ac 100644
--- a/meta/recipes-core/images/core-image-initramfs-boot.bb
+++ b/meta/recipes-core/images/core-image-initramfs-boot.bb
@@ -2,7 +2,7 @@  SUMMARY = "Basic initramfs to boot a fully-featured rootfs"
 DESCRIPTION = "Small initramfs that contains just udev and init, to find the real rootfs."
 LICENSE = "MIT"
 
-INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-udev"
+INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-udev initramfs-module-rootfs"
 
 inherit image
 
@@ -20,8 +20,17 @@  PACKAGE_INSTALL = " \
         ${VIRTUAL-RUNTIME_dev_manager} \
     ', '${INITRAMFS_SCRIPTS}', d)} \
     base-passwd \
+    busybox-udhcpc \
+    libkmod \
 "
 
+# reduce size
+NO_RECOMMENDATIONS = "1"
+
+# don't install automatically, pick manually instead
+MACHINE_EXTRA_RDEPENDS = ""
+MACHINE_EXTRA_RRECOMMENDS = ""
+
 # Ensure the initramfs only contains the bare minimum
 IMAGE_FEATURES = ""
 IMAGE_LINGUAS = ""