[U-Boot] [PATCH v2 5/8] pico-imx6: Fix bootmenu handling

Otavio Salvador otavio at ossystems.com.br
Fri Sep 20 19:47:27 UTC 2019


We should use a common script to allow booting the U-Boot console as
fallback so we ended using a 'default_boot' and 'base_boot'
environment scripts to accomplish that.

Signed-off-by: Fabio Berton <fabio.berton at ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
 configs/pico-imx6_defconfig |  2 +-
 include/configs/pico-imx6.h | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/configs/pico-imx6_defconfig b/configs/pico-imx6_defconfig
index a0448b2236..4291f6fab0 100644
--- a/configs/pico-imx6_defconfig
+++ b/configs/pico-imx6_defconfig
@@ -15,7 +15,7 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
-CONFIG_BOOTCOMMAND="run findbaseboard; run findfdt; run finduuid; run distro_bootcmd"
+CONFIG_BOOTCOMMAND="run default_boot"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_DEFAULT_FDT_FILE="ask"
diff --git a/include/configs/pico-imx6.h b/include/configs/pico-imx6.h
index 2ea50f5488..d151da07f2 100644
--- a/include/configs/pico-imx6.h
+++ b/include/configs/pico-imx6.h
@@ -42,13 +42,13 @@
 
 #define BOOTMENU_ENV \
 	"bootmenu_0=Boot using PICO-Hobbit baseboard=" \
-		"setenv baseboard hobbit\0" \
+		"setenv baseboard hobbit; saveenv; run base_boot\0" \
 	"bootmenu_1=Boot using PICO-Pi baseboard=" \
-		"setenv baseboard pi\0" \
+		"setenv baseboard pi; saveenv; run base_boot\0" \
 	"bootmenu_2=Boot using PICO-Dwarf baseboard=" \
-		"setenv baseboard dwarf\0" \
+		"setenv baseboard dwarf; saveenv; run base_boot\0" \
 	"bootmenu_3=Boot using PICO-Nymph baseboard=" \
-		"setenv baseboard nymph\0" \
+		"setenv baseboard nymph; saveenv; run base_boot\0" \
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"console=ttymxc0\0" \
@@ -61,11 +61,6 @@
 	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
 	CONFIG_DFU_ENV_SETTINGS \
 	"finduuid=part uuid mmc 0:1 uuid\0" \
-	"findbaseboard=" \
-		"if test $baseboard = ask ; then " \
-			"bootmenu -1; fi;" \
-		"if test $baseboard != ask ; then " \
-			"saveenv; fi;\0" \
 	"findfdt="\
 		"if test $baseboard = hobbit && test $board_rev = MX6Q ; then " \
 			"setenv fdtfile imx6q-pico-hobbit.dtb; fi; " \
@@ -85,6 +80,13 @@
 			"setenv fdtfile imx6dl-pico-nymph.dtb; fi; " \
 		"if test $fdtfile = ask; then " \
 			"echo WARNING: Could not determine dtb to use; fi; \0" \
+	"default_boot=" \
+		"if test $baseboard = ask ; then " \
+			"bootmenu -1; " \
+		"else " \
+			"run base_boot;" \
+		"fi; \0" \
+	"base_boot=run findfdt; run finduuid; run distro_bootcmd\0" \
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"ramdisk_addr_r=0x13000000\0" \
-- 
2.23.0



More information about the U-Boot mailing list