[RFC PATCH v2 3/3] bootm: handle global.bootm.root_dev

Robert Karszniewicz r.karszniewicz at phytec.de
Wed Aug 5 06:10:07 EDT 2020


---
 common/bootm.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 73409bf9f70c..01b54ab93958 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -656,7 +656,18 @@ int bootm_boot(struct bootm_data *bootm_data)
 	if (bootm_data->appendroot) {
 		char *rootarg;
 
-		rootarg = path_get_linux_rootarg(data->os_file);
+		if (bootm_data->root_dev) {
+			const char *root_dev_name = devpath_to_name(bootm_data->root_dev);
+			const struct cdev *root_cdev = cdev_by_name(root_dev_name);
+
+			if (root_cdev && root_cdev->partuuid[0] != 0) {
+				rootarg = basprintf("root=PARTUUID=%s", root_cdev->partuuid);
+			} else {
+				rootarg = path_get_linux_rootarg("invalid");
+			}
+		} else {
+			rootarg = path_get_linux_rootarg(data->os_file);
+		}
 		if (!IS_ERR(rootarg)) {
 			printf("Adding \"%s\" to Kernel commandline\n", rootarg);
 			globalvar_add_simple("linux.bootargs.bootm.appendroot",
-- 
2.7.4




More information about the barebox mailing list