smegw01: Add altbootcmd

Add an altbootcmd script, which is convenient way to integrate with
swupdate and perform a roll back of the previous working version in the
case of update failure.

Signed-off-by: Eduard Strehlau <eduard@lionizers.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
This commit is contained in:
Eduard Strehlau 2023-04-26 13:04:51 -03:00 committed by Stefano Babic
parent 3bb2b48ed2
commit ac52bb99cc
2 changed files with 9 additions and 1 deletions

View file

@ -18,7 +18,7 @@ CONFIG_SYS_MEMTEST_END=0xa0000000
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="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; fi; "
CONFIG_HUSH_PARSER=y
CONFIG_SYS_MAXARGS=32
CONFIG_SYS_PBSIZE=532

View file

@ -33,6 +33,7 @@
"mmcargs=setenv bootargs console=${console},${baudrate} " \
"root=/dev/mmcblk0p${mmcpart} rootwait rw " \
__stringify(EXTRA_BOOTPARAMS) "\0" \
"bootlimit=3\0" \
"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/${image}\0" \
"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} boot/${fdtfile}\0" \
"mmcboot=echo Booting from mmc ...; " \
@ -40,6 +41,13 @@
"if run loadfdt; then " \
"bootz ${loadaddr} - ${fdt_addr}; " \
"fi;\0" \
"altbootcmd=echo Performing rollback...; " \
"if test \"${mmcpart}\" = 1; then " \
"setenv mmcpart 2; " \
"else " \
"setenv mmcpart 1; " \
"fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; " \
"run bootcmd;\0"
/* Physical Memory Map */
#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR