]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
smegw01: Add altbootcmd
authorEduard Strehlau <eduard@lionizers.com>
Wed, 26 Apr 2023 16:04:51 +0000 (13:04 -0300)
committerStefano Babic <sbabic@denx.de>
Tue, 2 May 2023 08:57:32 +0000 (10:57 +0200)
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>
configs/smegw01_defconfig
include/configs/smegw01.h

index 5d9d4194639d16600265d17bc6590bdc7b2fdced..418151a6de05ac36dcac318deb1157ad2dc7e45d 100644 (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
index a356f095a68ce6c62b20c6b94ea4066de0864f81..6ee4acc70d29e6be1fc0be206da33dc6f70f3366 100644 (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 ...; " \
                "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