From: Eduard Strehlau Date: Wed, 26 Apr 2023 16:04:51 +0000 (-0300) Subject: smegw01: Add altbootcmd X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=ac52bb99cc7c9c288432f80710b21bd54e743f58;p=u-boot.git 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 Signed-off-by: Fabio Estevam --- diff --git a/configs/smegw01_defconfig b/configs/smegw01_defconfig index 5d9d419463..418151a6de 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 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 diff --git a/include/configs/smegw01.h b/include/configs/smegw01.h index a356f095a6..6ee4acc70d 100644 --- a/include/configs/smegw01.h +++ b/include/configs/smegw01.h @@ -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