Benjamin Drung b3e8cc4011 Use dracut-install in manual_add_modules
I sprinkled mkinitramfs with `date -Ins` to see where most time is
spent. I ran the [1] test case in a chroot on my laptop. mkinitramfs
took 18.3 seconds. The most time consuming parts:

* 10.13 s (51.4%) auto_add_modules
* 7.20 s (36.5%) run_scripts_optional /usr/share/initramfs-tools/hooks
* 1.27 s (6.4%) final { cat; cpio; cpio|compress } > $outfile

The remaining 1.11 seconds are spread over the remaining parts.

Following hooks in /usr/share/initramfs-tools/hooks took the longest:

* 4.56s (63.3%) framebuffer
* 0.87s (12.1%) plymouth
* 0.81s (11.3%) cryptroot
* 0.23s (3.2%) lvm2
* 0.18s (2.5%) udev
* 0.17s (2.4%) mdadm

The remaining 0.38 seconds are spread over the remaining dozen of hooks.

The framebuffer hook just calls copy_modules_dir and manual_add_modules
multiple times. auto_add_modules calls copy_modules_dir multiple times
and manual_add_modules. copy_modules_dir calls find and then
manual_add_modules.

So most time will be spent in manual_add_modules. This function calls
modprobe on the modules, copies the modules, and add_firmware on the
firmwares from a "modinfo -F firmware" call.

Replacing manual_add_modules by a call to /usr/lib/dracut/dracut-install
speeds up the initramfs building significantly. In the chroot on my
laptop the mkinitramfs execution reduces from 18.3 seconds to 11.0 (40%
reduction).

[1] schroot-wrapper -c mantic -u root --ppa bdrung/ppa -p \
linux-image-generic,initramfs-tools,zstd,busybox-initramfs,cryptsetup-initramfs,isc-dhcp-client,kbd,lvm2,mdadm,ntfs-3g,plymouth,plymouth-theme-spinner

LP: #2031185
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2024-05-21 00:12:31 +02:00

44 lines
1.6 KiB
Plaintext

Source: initramfs-tools
Section: utils
Priority: optional
Uploaders: Michael Prokop <mika@debian.org>, Ben Hutchings <benh@debian.org>
Maintainer: Debian kernel team <debian-kernel@lists.debian.org>
Build-Depends: bash-completion, debhelper-compat (= 13), shunit2 <!nocheck>
Rules-Requires-Root: no
Standards-Version: 4.7.0
Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools
Vcs-Git: https://salsa.debian.org/kernel-team/initramfs-tools.git
Package: initramfs-tools
Architecture: all
Multi-Arch: foreign
Depends: initramfs-tools-core (= ${binary:Version}),
linux-base,
${misc:Depends}
Suggests: bash-completion
Provides: linux-initramfs-tool
Conflicts: linux-initramfs-tool
Description: generic modular initramfs generator (automation)
This package builds a bootable initramfs for Linux kernel packages. The
initramfs is loaded along with the kernel and is responsible for
mounting the root filesystem and starting the main init system.
Package: initramfs-tools-core
Architecture: all
Multi-Arch: foreign
Recommends: zstd, ${busybox:Recommends}
Depends: coreutils (>= 8.24),
cpio (>= 2.12),
dracut-install,
klibc-utils (>= 2.0.4-8~),
kmod,
logsave | e2fsprogs (<< 1.45.3-1~),
udev,
${misc:Depends}
Suggests: bash-completion
Description: generic modular initramfs generator (core tools)
This package contains the mkinitramfs program that can be used to
create a bootable initramfs for a Linux kernel. The initramfs should
be loaded along with the kernel and is then responsible for mounting
the root filesystem and starting the main init system.