[U-Boot] [PATCH 3/3] distro_bootcmd: Add support for booting from ubifs

Hans de Goede hdegoede at redhat.com
Thu Aug 20 18:04:15 CEST 2015


From: Roy Spliet <r.spliet at ultimaker.com>

Under the assumptions of having a UBI partition called boot

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 include/config_distro_bootcmd.h | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 3a360ca4..bbc2e1a 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -72,6 +72,47 @@
 	BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
 #endif
 
+#ifdef CONFIG_CMD_UBIFS
+#define BOOTENV_SHARED_UBIFS \
+	"scan_ubifs_for_extlinux="                                        \
+		"if ubifsexists ${prefix}extlinux/extlinux.conf; then "   \
+			"echo Found ${prefix}extlinux/extlinux.conf; "    \
+			"sysboot ubi0 0:0 ubifs ${scriptaddr} "           \
+				"${prefix}extlinux/extlinux.conf; "       \
+			"echo SCRIPT FAILED: continuing...; "             \
+		"fi\0"                                                    \
+	\
+	"scan_ubifs_for_scripts="                                         \
+		"for script in ${boot_scripts}; do "                      \
+			"if ubifsexists ${prefix}${script}; then "        \
+				"echo Found U-Boot script "               \
+					"${prefix}${script}; "            \
+				"ubifsload ${scriptaddr} "                \
+					"${prefix}${script}; "            \
+				"source ${scriptaddr}; "	          \
+				"echo SCRIPT FAILED: continuing...; "     \
+			"fi; "                                            \
+		"done\0"
+#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance) \
+	"bootcmd_ubifs="                                                  \
+		"if ubi part " #devtypel #instance "_main &&"             \
+				"ubifsmount ubi:boot; then "              \
+			"echo Scanning " #devtypel #instance "_main:boot;"\
+			"for prefix in ${boot_prefixes}; do "             \
+				"run scan_ubifs_for_extlinux; "           \
+				"run scan_ubifs_for_scripts; "            \
+			"done; "                                          \
+		"fi\0"
+#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance) \
+	"ubifs "
+#else
+#define BOOTENV_SHARED_UBIFS
+#define BOOTENV_DEV_UBIFS \
+	BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
+#define BOOTENV_DEV_NAME_UBIFS \
+	BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
+#endif
+
 #ifdef CONFIG_CMD_SATA
 #define BOOTENV_SHARED_SATA	BOOTENV_SHARED_BLKDEV(sata)
 #define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV
@@ -185,6 +226,7 @@
 	BOOTENV_SHARED_SATA \
 	BOOTENV_SHARED_SCSI \
 	BOOTENV_SHARED_IDE \
+	BOOTENV_SHARED_UBIFS \
 	"boot_prefixes=/ /boot/\0" \
 	"boot_scripts=boot.scr.uimg boot.scr\0" \
 	"boot_script_dhcp=boot.scr.uimg\0" \
-- 
2.4.3



More information about the U-Boot mailing list