diff mbox series

[U-Boot,v3,1/2] Add BOOTCOUNT_BOOTLIMIT to set reboot limit

Message ID 20180721202533.20727-2-alex.kiernan@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Add bootlimit to Kconfig | expand

Commit Message

Alex Kiernan July 21, 2018, 8:25 p.m. UTC
Add ability to set environment bootlimit from Kconfig

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

Changes in v3: None
Changes in v2: None

 drivers/bootcount/Kconfig | 8 ++++++++
 include/env_default.h     | 3 +++
 2 files changed, 11 insertions(+)

Comments

Tom Rini Aug. 17, 2018, 8:34 p.m. UTC | #1
On Sat, Jul 21, 2018 at 08:25:32PM +0000, Alex Kiernan wrote:

> Add ability to set environment bootlimit from Kconfig
> 
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index d335ed14b9..9a0bd516d9 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -72,6 +72,14 @@  config BOOTCOUNT_AT91
 
 endchoice
 
+config BOOTCOUNT_BOOTLIMIT
+	int "Maximum number of reboot cycles allowed"
+	default 0
+	help
+	  Set the Maximum number of reboot cycles allowed without the boot
+	  counter being cleared.
+	  If set to 0 do not set a boot limit in the environment.
+
 config BOOTCOUNT_ALEN
 	int "I2C address length"
 	default 1
diff --git a/include/env_default.h b/include/env_default.h
index bd600cfa44..86b639d3e2 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -104,6 +104,9 @@  const uchar default_environment[] = {
 	"soc="		CONFIG_SYS_SOC			"\0"
 #endif
 #endif
+#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
+	"bootlimit="	__stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
+#endif
 #ifdef	CONFIG_EXTRA_ENV_SETTINGS
 	CONFIG_EXTRA_ENV_SETTINGS
 #endif