[PATCH] Add Kconfig option for altbootcmd when using CONFIG_BOOTCOUNT_LIMIT
Tomáš Peterka
tomas.peterka at dronetag.com
Thu Jan 30 16:44:11 CET 2025
Hello u-boot maintainers,
I would like to merge a simple patch for user-friendliness when configuring u-boot with Yocto. The problem is missing option for altbootcmd when using the feature CONFIG_BOOTCOUNT_LIMIT. Simply adding the option CONFIG_BOOTCOUNT_ALTBOOTCMD into Kconfig shouldn't be a problem when there is already CONFIG_BOOTCOMMAND? Users then can use CONFIG_BOOTCOUNT_ALTBOOTCMD instead of misusing CFG_EXTRA_ENV_SETTINGS (and friends) that are usually used by configs of specific boards.
Many thanks for considering this,
Tomas
>From 9f5d1863e99c3a33893381cc924f25797b4b6f8a Wed Jan 29 19:06:55 2025 -0600
From: Tomas Peterka <tomas.peterka at dronetag.com>
Date: Tue, 30 Jan 2025 09:00:00 +0100
Subject: [PATCH] Add altbootcmd to Kconfig
Upstream-Status: Pending
---
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index 0080d2a165..982ddc9826 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -183,6 +183,12 @@ config BOOTCOUNT_BOOTLIMIT
counter being cleared.
If set to 0, do not set a boot limit in the environment.
+config BOOTCOUNT_ALTBOOTCMD
+ string "Alternative boot command when BOOTLIMIT is reached"
+ default "env set bootfile altboot.scr; bootflow scan -lb"
+ help
+ Set the alternative boot command once BOOTLIMIT is reached
+
config SYS_BOOTCOUNT_SINGLEWORD
bool "Use single word to pack boot count and magic value"
depends on BOOTCOUNT_GENERIC
diff --git a/include/env_default.h b/include/env_default.h
index aa3dd40f3f..59bb0f6a6a 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -115,6 +115,9 @@ const char default_environment[] = {
#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
"bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
#endif
+#ifdef CONFIG_BOOTCOUNT_ALTBOOTCMD
+ "altbootcmd=" CONFIG_BOOTCOUNT_ALTBOOTCMD "\0"
+#endif
#ifdef CONFIG_MTDIDS_DEFAULT
"mtdids=" CONFIG_MTDIDS_DEFAULT "\0"
#endif
More information about the U-Boot
mailing list