initramfs-framework: support LABEL with root-only udev trigger
PATCH v3 1/1 initramfs-framework: support LABEL with root-only udev trigger
Filesystem labels are not available in kernel uevents. Add util-linux-findfs to initramfs-module-udev and use findfs to resolve root=LABEL= to a device. Read the kernel-provided PARTUUID from sysfs and trigger only that partition, falling back to a full trigger if the label cannot be resolved safely. Keeping findfs out of the BusyBox defconfig avoids increasing BusyBox for unrelated users.
Exclude the util-linux dependency from signature propagation because this allarch recipe only invokes findfs at runtime.
Tested with bitbake -p, the core-image-minimal-initramfs dependency graph, and the sstatetests.SStateHashSameSigs2.test_sstate_allarch_samesigs selftest.
AI-Generated: OpenAI Codex
---
Changes in v3:
- Exclude the util-linux dependency from initramfs-framework signatures to preserve allarch sstate reuse across machines.
- Validate the fix with the allarch sstate signature selftest.
Changes in v2:
- Keep findfs out of the default BusyBox configuration.
- Add util-linux-findfs as an initramfs-module-udev runtime dependency.
---
meta/conf/layer.conf | 1 + .../initrdscripts/initramfs-framework/udev | 12 ++++++++++++ .../initrdscripts/initramfs-framework_1.0.bb | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-)
meta/conf/layer.conf +1 -0
@@ -61,6 +61,7 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ initramfs-framework->${VIRTUAL-RUNTIME_base-utils} \ initramfs-framework->eudev \ initramfs-framework->systemd \ + initramfs-framework->util-linux \ initramfs-module-install-efi->dosfstools \ initramfs-module-install-efi->e2fsprogs \ initramfs-module-install-efi->parted \
meta/recipes-core/initrdscripts/initramfs-framework/udev +12 -0
@@ -43,6 +43,18 @@ udev_trigger_root_device() { PARTUUID=?*) root_match="PARTUUID=${bootparam_root#PARTUUID=}" ;; + LABEL=?*) + # The kernel does not export the filesystem LABEL in the + # uevent, so resolve it to a device node with findfs and + # match on that device's kernel-provided PARTUUID. + root_label="${bootparam_root#LABEL=}" + root_dev=$(findfs "LABEL=$root_label" 2>/dev/null) || return 1 + [ -n "$root_dev" ] || return 1 + root_partuuid=$(sed -n 's/^PARTUUID=//p' \ + "/sys/class/block/${root_dev#/dev/}/uevent" 2>/dev/null) + [ -n "$root_partuuid" ] || return 1 + root_match="PARTUUID=$root_partuuid" + ;; *) return 1 ;;
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +1 -1
@@ -88,7 +88,7 @@ RDEPENDS:initramfs-module-mdev = "${PN}-base busybox-mdev" FILES:initramfs-module-mdev = "/init.d/01-mdev" SUMMARY:initramfs-module-udev = "initramfs support for udev" -RDEPENDS:initramfs-module-udev = "${PN}-base udev" +RDEPENDS:initramfs-module-udev = "${PN}-base udev util-linux-findfs" FILES:initramfs-module-udev = "/init.d/01-udev" SUMMARY:initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
Signature · 1 line
2.43.0
Hi,
Gentle ping on v3 of this patch.
The patch adds LABEL support for the root-only udev trigger and has been tested with bitbake -p, the initramfs dependency graph, and the allarch sstate signature selftest.
Please let me know if any further changes are needed.
Thanks
Wenwen
________________________________
From: Wenwen Fu <[email protected]>
Sent: Friday, August 28, 2026 22:21
To: [email protected] <[email protected]>
Cc: Wenwen Fu <[email protected]>
Subject: [PATCH v3] initramfs-framework: support LABEL with root-only udev trigger
Filesystem labels are not available in kernel uevents. Add util-linux-findfs to initramfs-module-udev and use findfs to resolve root=LABEL= to a device. Read the kernel-provided PARTUUID from sysfs and trigger only that partition, falling back to a full trigger if the label cannot be resolved safely. Keeping findfs out of the BusyBox defconfig avoids increasing BusyBox for unrelated users.
Exclude the util-linux dependency from signature propagation because this allarch recipe only invokes findfs at runtime.
Tested with bitbake -p, the core-image-minimal-initramfs dependency graph, and the sstatetests.SStateHashSameSigs2.test_sstate_allarch_samesigs selftest.
AI-Generated: OpenAI Codex
---
Changes in v3:
- Exclude the util-linux dependency from initramfs-framework signatures to preserve allarch sstate reuse across machines.
- Validate the fix with the allarch sstate signature selftest.
Changes in v2:
- Keep findfs out of the default BusyBox configuration.
- Add util-linux-findfs as an initramfs-module-udev runtime dependency.
---
meta/conf/layer.conf | 1 + .../initrdscripts/initramfs-framework/udev | 12 ++++++++++++ .../initrdscripts/initramfs-framework_1.0.bb | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-)
meta/conf/layer.conf +1 -0
@@ -61,6 +61,7 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ initramfs-framework->${VIRTUAL-RUNTIME_base-utils} \ initramfs-framework->eudev \ initramfs-framework->systemd \ + initramfs-framework->util-linux \ initramfs-module-install-efi->dosfstools \ initramfs-module-install-efi->e2fsprogs \ initramfs-module-install-efi->parted \
meta/recipes-core/initrdscripts/initramfs-framework/udev +12 -0
@@ -43,6 +43,18 @@ udev_trigger_root_device() { PARTUUID=?*) root_match="PARTUUID=${bootparam_root#PARTUUID=}" ;; + LABEL=?*) + # The kernel does not export the filesystem LABEL in the + # uevent, so resolve it to a device node with findfs and + # match on that device's kernel-provided PARTUUID. + root_label="${bootparam_root#LABEL=}" + root_dev=$(findfs "LABEL=$root_label" 2>/dev/null) || return 1 + [ -n "$root_dev" ] || return 1 + root_partuuid=$(sed -n 's/^PARTUUID=//p' \ + "/sys/class/block/${root_dev#/dev/}/uevent" 2>/dev/null) + [ -n "$root_partuuid" ] || return 1 + root_match="PARTUUID=$root_partuuid" + ;; *) return 1 ;;
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +1 -1
@@ -88,7 +88,7 @@ RDEPENDS:initramfs-module-mdev = "${PN}-base busybox-mdev" FILES:initramfs-module-mdev = "/init.d/01-mdev" SUMMARY:initramfs-module-udev = "initramfs support for udev" -RDEPENDS:initramfs-module-udev = "${PN}-base udev" +RDEPENDS:initramfs-module-udev = "${PN}-base udev util-linux-findfs" FILES:initramfs-module-udev = "/init.d/01-udev" SUMMARY:initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
--
2.43.0
Hi.
Quoted 2 lines · Wenwen Fu via lists.openembedded.org
Keeping findfs out of the BusyBox defconfig avoids increasing BusyBox for unrelated users.
We’ve merged this patch but can you confirm that the v1 you sent which uses busybox works just as well as the util-linux version?
I’ve done a build with findfs enabled in busybox and the increase in binary size is negligible, going from 71176 bytes to 71640, an increase of just 464 bytes. I think we should enable this and switch the initramfs back to busybox by default.
Ross
Hi Ross,
Yes, I have already tested the v1 implementation with BusyBox findfs, and it works correctly for root=LABEL= with the root-only udev trigger
The v1 implementation also provides better boot performance in my testing. The root-only trigger is the main source of the improvement, while using BusyBox findfs avoids the additional util-linux dependency. The BusyBox binary size increase is only 464 bytes.
So, I agree that enabling CONFIG_FINDFS in BusyBox and switching initramfs back to the BusyBox implementation is preferable. I will send a follow-up patch to make that change.
Thanks,
Wenwen
________________________________
From: Ross Burton <[email protected]>
Sent: Tuesday, September 8, 2026 19:05
To: Wenwen Fu <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH v3] initramfs-framework: support LABEL with root-only udev trigger
WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.
Hi.
Quoted 2 lines · Wenwen Fu via lists.openembedded.org
Keeping findfs out of the BusyBox defconfig avoids increasing BusyBox for unrelated users.
We’ve merged this patch but can you confirm that the v1 you sent which uses busybox works just as well as the util-linux version?
I’ve done a build with findfs enabled in busybox and the increase in binary size is negligible, going from 71176 bytes to 71640, an increase of just 464 bytes. I think we should enable this and switch the initramfs back to busybox by default.
Ross