[U-Boot] [PATCH] allow config_distro_bootcmd to pass uuid to extlinux.conf

Iain Paton ipaton0 at gmail.com
Sun Dec 14 15:52:16 CET 2014


Set ptuuid and fsuuid variables to the partition / filesystem
where we found extlinux.conf which allows us to use a replaceable
parameter in the append line in extlinux.conf like this

append root=PARTUUID=${ptuuid}

this means we never have to hardcode a root=/dev/mmcblk0p1 type path
anywhere.

Signed-off-by: Iain Paton <ipaton0 at gmail.com>
---

Since the uuids are only looked for after we've already found extlinux.conf
there's little cost/risk to making them available.
I realise that assuming extlinux.conf is on the root partition isn't perfect
but for the common case where it will be, there are many advantages to 
this.

 include/config_distro_bootcmd.h  | 2 ++
 include/config_distro_defaults.h | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index be616e8..dd4ab09 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -166,6 +166,8 @@
 	"bootpart=1\0" \
 	\
 	"boot_extlinux="                                                  \
+		"part uuid ${devtype} ${devnum}:${bootpart} ptuuid; "     \
+		"fsuuid ${devtype} ${devnum}:${bootpart} fsuuid; "        \
 		"sysboot ${devtype} ${devnum}:${bootpart} any "           \
 			"${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
 	\
diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h
index 1ecc0bb..03e1efb 100644
--- a/include/config_distro_defaults.h
+++ b/include/config_distro_defaults.h
@@ -38,8 +38,10 @@
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_FS_GENERIC
+#define CONFIG_CMD_FS_UUID
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
+#define CONFIG_CMD_PART
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_PXE
 
@@ -53,4 +55,6 @@
 #define CONFIG_SUPPORT_RAW_INITRD
 #define CONFIG_SYS_HUSH_PARSER
 
+#define CONFIG_PARTITION_UUIDS
+
 #endif	/* _CONFIG_CMD_DISTRO_DEFAULTS_H */
-- 
2.1.3



More information about the U-Boot mailing list