public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v1 10/13] toradex: imx: enable BOOTCOUNT feature
Date: Tue, 16 Jun 2020 22:20:08 +0300	[thread overview]
Message-ID: <1592335211-5998-11-git-send-email-igor.opaniuk@gmail.com> (raw)
In-Reply-To: <1592335211-5998-1-git-send-email-igor.opaniuk@gmail.com>

From: Igor Opaniuk <igor.opaniuk@toradex.com>

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

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 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 6b0f0e4..65162a2 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -53,6 +53,7 @@ CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_BMP=y
+CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_PMIC=y
@@ -65,6 +66,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_I2C=y
 CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig
index 74a67a0..ce145cd 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -40,6 +40,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
@@ -54,6 +55,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=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_I2C=y
 CONFIG_SYS_I2C_MXC=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 44a3ff8..ca33327 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -52,6 +52,7 @@ CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_BMP=y
+CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_UUID=y
@@ -64,6 +65,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=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_I2C=y
 CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 7596478..89ee6e5 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -40,6 +40,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_HASH is not set
 CONFIG_CMD_MTDPARTS=y
@@ -54,6 +55,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=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_DFU_NAND=y
 CONFIG_DM_I2C=y
diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig
index c23ff97..13a3aae 100644
--- a/configs/colibri_imx7_emmc_defconfig
+++ b/configs/colibri_imx7_emmc_defconfig
@@ -38,6 +38,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
@@ -48,6 +49,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=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
-- 
2.7.4

  parent reply	other threads:[~2020-06-16 19:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 19:19 [PATCH v1 00/13] This patch-series includes updates for Toradex modules: Igor Opaniuk
2020-06-16 19:19 ` [PATCH v1 01/13] apalis-imx8: enable of_system_setup Igor Opaniuk
2020-06-23  7:49   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 02/13] apalis/colibri-imx8: re-enable CONFIG_IMX_SCU_THERMAL Igor Opaniuk
2020-06-23  7:50   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 03/13] colibri-imx8x: declare consoleargs Igor Opaniuk
2020-06-23  7:50   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 04/13] colibri_imx7: add addresses required for distro boot Igor Opaniuk
2020-06-23  7:51   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 05/13] colibri-imx6ull/imx7: define bootubipart " Igor Opaniuk
2020-06-23  7:50   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 06/13] colibri_vf_defconfig: enable part cmd Igor Opaniuk
2020-06-23  7:51   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 07/13] configs/colibri_vf.h: drop sdboot in favour of distro_bootcmd Igor Opaniuk
2020-06-23  7:51   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 08/13] apalis-tk1: enable distroboot Igor Opaniuk
2020-06-23  7:51   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 09/13] apalis-tk1: fix setting fdtfile value Igor Opaniuk
2020-06-23  7:50   ` sbabic at denx.de
2020-06-16 19:20 ` Igor Opaniuk [this message]
2020-06-23  7:51   ` [PATCH v1 10/13] toradex: imx: enable BOOTCOUNT feature sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 11/13] apalis_imx6: boot env configuration updates Igor Opaniuk
2020-06-23  7:51   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 12/13] colibri_imx7: " Igor Opaniuk
2020-06-23  7:50   ` sbabic at denx.de
2020-06-16 19:20 ` [PATCH v1 13/13] colibri_imx6: " Igor Opaniuk
2020-06-23  7:50   ` sbabic at denx.de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1592335211-5998-11-git-send-email-igor.opaniuk@gmail.com \
    --to=igor.opaniuk@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox