[PATCH v3 05/13] smegw01: Run altbootcmd in the case of failure

Fabio Estevam festevam at gmail.com
Mon Apr 24 13:11:58 CEST 2023


From: Eduard Strehlau <eduard at lionizers.com>

Run the altbootcmd script if any step of bootcmd fails.

This ensures that always a valid image can be run.

Signed-off-by: Eduard Strehlau <eduard at lionizers.com>
Signed-off-by: Fabio Estevam <festevam at denx.de>
---
Changes since v2:
- None

 configs/smegw01_defconfig | 2 +-
 include/configs/smegw01.h | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configs/smegw01_defconfig b/configs/smegw01_defconfig
index 418151a6de..b3580d5d6e 100644
--- a/configs/smegw01_defconfig
+++ b/configs/smegw01_defconfig
@@ -18,7 +18,7 @@ CONFIG_SYS_MEMTEST_END=0xa0000000
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="if test \"${ustate}\" = 1; then setenv upgrade_available 1; saveenv; fi; if run loadimage; then run mmcboot; fi; "
+CONFIG_BOOTCOMMAND="if test \"${ustate}\" = 1; then setenv upgrade_available 1; saveenv; fi; if run loadimage; then run mmcboot; else run altbootcmd; fi; "
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_SYS_PBSIZE=532
diff --git a/include/configs/smegw01.h b/include/configs/smegw01.h
index 6ee4acc70d..05edaac42f 100644
--- a/include/configs/smegw01.h
+++ b/include/configs/smegw01.h
@@ -39,7 +39,13 @@
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"if run loadfdt; then " \
-			"bootz ${loadaddr} - ${fdt_addr}; " \
+			"if bootz ${loadaddr} - ${fdt_addr}; then " \
+				"; " \
+			"else " \
+				"run altbootcmd; " \
+			"fi;" \
+		"else " \
+			"run altbootcmd; " \
 		"fi;\0" \
 	"altbootcmd=echo Performing rollback...; " \
 		"if test \"${mmcpart}\" = 1; then " \
-- 
2.38.1



More information about the U-Boot mailing list