Filesystem labels are not available in kernel uevents. Enable the
BusyBox findfs applet and use it to resolve root=LABEL= to a device.
Read the kernel-provided PARTUUID from sysfs and trigger only that
partition. Fall back to the full trigger when the label cannot be
resolved safely.

Signed-off-by: Wenwen Fu <[email protected]>
---
 meta/recipes-core/busybox/busybox/defconfig          |  2 +-
 .../initrdscripts/initramfs-framework/udev           | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/busybox/busybox/defconfig 
b/meta/recipes-core/busybox/busybox/defconfig
index 1f4b5e3d1e..a282370a8f 100644
--- a/meta/recipes-core/busybox/busybox/defconfig
+++ b/meta/recipes-core/busybox/busybox/defconfig
@@ -634,7 +634,7 @@ CONFIG_FEATURE_FDISK_WRITABLE=y
 # CONFIG_FEATURE_OSF_LABEL is not set
 # CONFIG_FEATURE_GPT_LABEL is not set
 # CONFIG_FEATURE_FDISK_ADVANCED is not set
-# CONFIG_FINDFS is not set
+CONFIG_FINDFS=y
 CONFIG_FLOCK=y
 # CONFIG_FDFLUSH is not set
 # CONFIG_FREERAMDISK is not set
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev 
b/meta/recipes-core/initrdscripts/initramfs-framework/udev
index 8f67e78a7c..85c5ba1178 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/udev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
@@ -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
                        ;;
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#244394): 
https://lists.openembedded.org/g/openembedded-core/message/244394
Mute This Topic: https://lists.openembedded.org/mt/120935036/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to