[PATCH fsutils] partname: Ignore root=PARTUUID...

Brian Norris computersforpeace at gmail.com
Fri Jan 6 18:03:06 PST 2023


We're assuming all root= arguments are /dev/ paths, but many targets
utilize root=PARTUUID=<xxx> strategies. At least allow them to fall back
to scanning all block devices.

Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---

 libfstools/partname.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libfstools/partname.c b/libfstools/partname.c
index f59c52eb8f3c..9c27015643ad 100644
--- a/libfstools/partname.c
+++ b/libfstools/partname.c
@@ -128,12 +128,12 @@ static struct volume *partname_volume_find(char *name)
 			return NULL;
 	}
 
-	if (get_var_from_file("/proc/cmdline", "root", rootparam, sizeof(rootparam))) {
+	if (get_var_from_file("/proc/cmdline", "root", rootparam, sizeof(rootparam)) && rootparam[0] == '/') {
 		rootdev = rootdevname(rootparam);
 		/* find partition on same device as rootfs */
 		snprintf(ueventgstr, sizeof(ueventgstr), "%s/%s/*/uevent", block_dir_name, rootdev);
 	} else {
-		/* no 'root=' kernel cmdline parameter, find on any block device */
+		/* no useful 'root=' kernel cmdline parameter, find on any block device */
 		snprintf(ueventgstr, sizeof(ueventgstr), "%s/*/uevent", block_dir_name);
 	}
 
-- 
2.39.0




More information about the openwrt-devel mailing list