mbox series

[0/2] Significantly speedup image generation

Message ID 20250410052751.3835154-1-felix.moessbauer@siemens.com
Headers show
Series Significantly speedup image generation | expand

Message

Felix Moessbauer April 10, 2025, 5:27 a.m. UTC
Especially on non native machines, the image generation can take a long time.
This is due to the fact that the initrd is generated during the rootfs
installation. By that, also the initrd is generated multiple times, despite
only one final version is needed. In case of a out-of-rootfs initrd, it is built
5 times (2x in rootfs, 2x in initramfs +1x manually in initramfs).

We optimize this by manually controlling when the initrd is built instead of
relying on the triggers from the initramfs-tools. As initramfs-tools does
not provide a conf.d style mechanism to completely disable the generation,
we now install this package during bootstrap and then stub the update-initramfs
calls during rootfs installation. In rootfs_postprocess, we restore the
original update-initramfs calls and build the initrd manually.

Changes since RFC v3:

- Use path-injection during do_packages_install to replace the update-initramfs script
- No need to add packages to bootstrap
- The initrd stub is deployed and removed in do_rootfs_install. By that, the clean rootfs
  is deployed into the sstate cache

Changes since RFC v2:

- Complete re-design of approach to better integrate with sstate cache
- Unify logic in rootfs.bblcass and initramfs.bbclass

Best regards,
Felix

Felix Moessbauer (2):
  delay creation of initrd until end of rootfs install
  report approximate progress during initrd generation

 meta/classes/image.bbclass                    | 17 ++---
 meta/classes/initramfs.bbclass                | 39 +---------
 meta/classes/rootfs.bbclass                   | 72 ++++++++++++++++++-
 meta/lib/rootfs_progress.py                   | 33 +++++++--
 .../sbuild-chroot/sbuild-chroot.inc           |  1 +
 5 files changed, 106 insertions(+), 56 deletions(-)