Skip to content

rapido-cut: only install modprobe if kmods are gathered - #287

Merged
ddiss merged 1 commit into
rapido-linux:masterfrom
ddiss:no-modprobe-if-no-kmods
Nov 9, 2026
Merged

ddiss merged 1 commit into
rapido-linux:masterfrom
ddiss:no-modprobe-if-no-kmods

Conversation

@ddiss

@ddiss ddiss commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Some cut scripts, e.g. simple-example, don't have any explicit kmod dependencies. 9p and virtio_rng modules may still be pulled in via conf_kmod_deps(), based on VIRTFS_SHARE_PATH and QEMU_EXTRA_ARGS (-device virtio-rng-pci) respectively. If no kmods are resolved then we can save quite some space by omitting modprobe (and modules.dep etc) from the initramfs image.

This change implements that logic, which on my machine saves quite some space: simple-example image size drops from 19537576 to 11959184 bytes, i.e. a 7M saving.

I also implemented the modprobe omission logic if all modules are built-in (detected via cpio_state.off across gather_archive_kmods() calls), but that becomes ugly when autorun scripts call modprobe for built-in modules. That means we'll likely not use this much, but the cost to code complexity is minimal, which makes it worthwhile IMO.

Some cut scripts, e.g. simple-example, don't have any explicit kmod
dependencies. 9p and virtio_rng modules may still be pulled in via
conf_kmod_deps(), based on VIRTFS_SHARE_PATH and QEMU_EXTRA_ARGS
(-device virtio-rng-pci) respectively. If no kmods are resolved then
we can save quite some space by omitting modprobe (and modules.dep etc)
from the initramfs image.

This change implements that logic, which on my machine saves quite some
space: simple-example image size drops from 19537576 to 11959184 bytes,
i.e. a 7M saving.

I also implemented the modprobe omission logic if all modules are
built-in (detected via cpio_state.off across gather_archive_kmods()
calls), but that becomes ugly when autorun scripts call modprobe for
built-in modules. That means we'll likely not use this much, but the
cost to code complexity is minimal, which makes it worthwhile IMO.

Signed-off-by: David Disseldorp <[email protected]>
@ddiss
ddiss merged commit 430d11e into rapido-linux:master Nov 9, 2026
2 checks passed
@ddiss
ddiss deleted the no-modprobe-if-no-kmods branch November 9, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant