From de4742be04b8ed87929507c07399b59850104259 Mon Sep 17 00:00:00 2001 From: Igor Opaniuk Date: Wed, 3 Jun 2020 10:55:51 +0300 Subject: toradex: imx: enable BOOTCOUNT feature This introduces automatic boot counter that increases after every reset. After a power-on reset, it will be initialized with 1, and each reboot will increment the value by 1. By default it's disabled if bootlimit isn't set. To enable this feature you have set bootcount limit ("bootlimit"), alternate boot action ("altbootcmd") that will be performed if the new value of bootcount exceeds the value of bootlimit, and "upgrade_available" to let U-Boot automatically increase and save the counter value after every reset: > setenv bootlimit 5 > setenv upgrade_available 1 > setenv altbootcmd "bootm ..." In case the bootlimit exceeds, the message will be shown and albootcmd executed: Warning: Bootlimit (5) exceeded. Using altbootcmd. To reset bootcount run: > bootcount reset Print current value: > bootcount print Relates-to: ELB-2703 Signed-off-by: Igor Opaniuk --- configs/apalis_imx6_defconfig | 3 +++ configs/colibri-imx6ull_defconfig | 3 +++ configs/colibri_imx6_defconfig | 3 +++ configs/colibri_imx7_defconfig | 3 +++ configs/colibri_imx7_emmc_defconfig | 3 +++ 5 files changed, 15 insertions(+) diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig index 96311da5ef..72ad9d3175 100644 --- a/configs/apalis_imx6_defconfig +++ b/configs/apalis_imx6_defconfig @@ -45,6 +45,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y @@ -55,6 +56,8 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=4096 CONFIG_DWC_AHSATA=y +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y CONFIG_DM_MMC=y diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig index a0ba71d0f5..743f703e0c 100644 --- a/configs/colibri-imx6ull_defconfig +++ b/configs/colibri-imx6ull_defconfig @@ -34,6 +34,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_MTDPARTS=y @@ -47,6 +48,8 @@ CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DFU_NAND=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig index bc7f9a5b51..dda5c115da 100644 --- a/configs/colibri_imx6_defconfig +++ b/configs/colibri_imx6_defconfig @@ -44,6 +44,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_UUID=y CONFIG_CMD_PMIC=y @@ -54,6 +55,8 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y CONFIG_DM_MMC=y diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig index 579b444b28..021f0c346a 100644 --- a/configs/colibri_imx7_defconfig +++ b/configs/colibri_imx7_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_BOOTP_PXE is not set CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand" @@ -44,6 +45,8 @@ CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DFU_NAND=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig index 75732925ab..b62f6da300 100644 --- a/configs/colibri_imx7_emmc_defconfig +++ b/configs/colibri_imx7_emmc_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y # CONFIG_CMD_HASH is not set # CONFIG_ISO_PARTITION is not set @@ -41,6 +42,8 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_FSL_CAAM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x82000000 -- cgit v1.2.3