Skip to content

feat(dracut-install): only install requested firmwares with --hostonly - #2833

Draft
martinezjavier wants to merge 1 commit into
dracut-ng:mainfrom
martinezjavier:hostonly-firmware-support
Draft

martinezjavier wants to merge 1 commit into
dracut-ng:mainfrom
martinezjavier:hostonly-firmware-support

Conversation

@martinezjavier

Copy link
Copy Markdown
Contributor

The --hostonly dracut option is used to generate smaller initramfs images, that are tailored to the running system. But one piece of information that has never been present is the set of firmware files requested by devices.

The Linux kernel now exposes this information as sysfs entries, so it can be queried to only include the firmware files that are loaded in the host.

Add a --sysfs-firmware option to dracut-install and a sysfs_firmware="yes" dracut.conf option, that can be used to opt-in using the sysfs entries as the source of information to gather the list of firmware files to include in the initramfs image.

This option is only valid when used along --host-only, since --no-hostonly still includes all the firmware files that were defined in kernel modinfo. If a kernel does not expose requested firmware sysfs entries, the option is a no-op and the fallback is to just include all the firmware files that are defined in the kernel modules modinfo.

@github-actions github-actions Bot added c docs dracut-install Issues related to dracut install man test Issues related to testing labels Nov 18, 2026
Comment thread dracut.sh Fixed
Comment thread dracut.sh Fixed
@aafeijoo-suse

Copy link
Copy Markdown
Contributor

The Linux kernel now exposes this information as sysfs entries, so it can be queried to only include the firmware files that are loaded in the host.

Has https://lore.kernel.org/lkml/20261017142826.2668881-1-javierm@redhat.com/ already been merged, or are we sure that it'll be in its current form? Thanks

@martinezjavier

Copy link
Copy Markdown
Contributor Author

@aafeijoo-suse sorry, I should had make clear in the PR comment. It needs to wait for the kernel patch to land and that is the reason why I opened as a draft.

The Linux kernel maintainer said that he would like dracut to agree with the solution before merging the kernel changes: https://lore.kernel.org/driver-core/DMK7KD9A3LR1.25UWRP5SLKQDD@kernel.org/:

However, I can see how having a queryable history could simplify automated
tooling like dracut. Has this been discussed with the dracut maintainers, and is
there a concrete plan to use this interface?

@martinezjavier
martinezjavier force-pushed the hostonly-firmware-support branch 2 times, most recently from efb650b to d5a8657 Compare November 18, 2026 13:46
@martinezjavier

Copy link
Copy Markdown
Contributor Author

I've tested this MR on an AM625 BeaglePlay board with a patched kernel that exposes the requested firmware though sysfs entries:

$ cat /sys/class/firmware/requested*
powervr/rogue_33.15.11.3_v1.fw
regulatory.db
regulatory.db.p7s
ti-connectivity/wl1271-nvs.bin
ti-connectivity/wl18xx-conf.bin
ti-connectivity/wl18xx-fw-4.bin

$ echo 'sysfs_firmware="yes"' > /etc/dracut.conf.d/sysfs-firmware.conf
$ echo 'hostonly_mode="strict"' >> /etc/dracut.conf.d/sysfs-firmware.conf
$ dracut --hostonly --force /tmp/initrd-hostonly-sysfs.img $(uname -r)

$ (cpio -t < /tmp/initrd-hostonly-sysfs.img; /usr/lib/dracut/skipcpio /tmp/initrd-hostonly-sysfs.img | zstdcat | cpio -t) 2>/dev/null | grep "firmware/.*\." | sort -u
usr/lib/firmware/powervr/rogue_33.15.11.3_v1.fw.xz
usr/lib/firmware/regulatory.db
usr/lib/firmware/regulatory.db.p7s
usr/lib/firmware/ti-connectivity/wl1271-nvs.bin.xz
usr/lib/firmware/ti-connectivity/wl127x-nvs.bin.xz
usr/lib/firmware/ti-connectivity/wl18xx-conf.bin
usr/lib/firmware/ti-connectivity/wl18xx-fw-4.bin.xz

@martinezjavier
martinezjavier force-pushed the hostonly-firmware-support branch from d5a8657 to 8c717f7 Compare November 18, 2026 13:52
The --hostonly dracut option is used to generate smaller initramfs images,
that are tailored to the running system. But one piece of information that
has never been present is the set of firmware files requested by devices.

The Linux kernel now exposes this information as sysfs entries, so it can
be queried to only include the firmware files that are loaded in the host.

Add a --sysfs-firmware option to dracut-install and a sysfs_firmware="yes"
dracut.conf option, that can be used to opt-in using the sysfs entries as
the source of information to gather the list of firmware files to include
in the initramfs image.

This option is only valid when used along --host-only, since --no-hostonly
still includes all the firmware files that were defined in kernel modinfo.
If a kernel does not expose requested firmware sysfs entries, the option
is a no-op and the fallback is to just include all the firmware files that
are defined in the kernel modules modinfo.
@martinezjavier
martinezjavier force-pushed the hostonly-firmware-support branch from 8c717f7 to c9463e7 Compare November 18, 2026 14:12
@martinezjavier

Copy link
Copy Markdown
Contributor Author

The failing checks don't seem to be related to the changes in this PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c docs dracut-install Issues related to dracut install man test Issues related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants