[U-Boot] [PATCH v3 08/14] pico-imx6ul: Add bootmenu to choose the baseboard

Otavio Salvador otavio at ossystems.com.br
Thu Sep 13 19:57:00 UTC 2018


Currently the baseboards do not offer a way to autodetect which one is
in use, so we ask the user if no value has been set.

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---

Changes in v3: None
Changes in v2: None

 configs/pico-imx6ul_defconfig |  5 +++--
 include/configs/pico-imx6ul.h | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig
index 56cb4810dc..3d4063b136 100644
--- a/configs/pico-imx6ul_defconfig
+++ b/configs/pico-imx6ul_defconfig
@@ -13,13 +13,14 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
-CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd"
-CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb"
+CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
+CONFIG_DEFAULT_FDT_FILE="ask"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_USB_HOST_SUPPORT=y
 CONFIG_SPL_USB_GADGET_SUPPORT=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
+CONFIG_CMD_BOOTMENU=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_DFU=y
 # CONFIG_CMD_FLASH is not set
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
index 14d5cc3ddb..2276f72bae 100644
--- a/include/configs/pico-imx6ul.h
+++ b/include/configs/pico-imx6ul.h
@@ -50,6 +50,10 @@
 		"/imx6ul-pico-hobbit.dtb ext4 0 1;" \
 		"rootfs part 0 2\0" \
 
+#define BOOTMENU_ENV \
+	"bootmenu_0=Boot using PICO-Hobbit baseboard=" \
+		"setenv fdtfile imx6ul-pico-hobbit.dtb\0" \
+
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -59,6 +63,7 @@
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+	BOOTMENU_ENV \
 	"fdt_addr=0x83000000\0" \
 	"fdt_addr_r=0x83000000\0" \
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
@@ -67,6 +72,11 @@
 	"ramdiskaddr=0x83000000\0" \
 	"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
 	CONFIG_DFU_ENV_SETTINGS \
+	"findfdt=" \
+		"if test $fdtfile = ask ; then " \
+			"bootmenu -1; fi;" \
+		"if test $fdtfile != ask ; then " \
+			"saveenv; fi;\0" \
 	"finduuid=part uuid mmc 0:1 uuid\0" \
 	"partitions=" \
 		"uuid_disk=${uuid_gpt_disk};" \
-- 
2.19.0



More information about the U-Boot mailing list