[PATCH] env: add Kconfig option for static flags list

James Hilliard james.hilliard1 at gmail.com
Sun May 10 01:01:44 CEST 2026


Environment callbacks can already be configured from Kconfig with
CONFIG_ENV_CALLBACK_LIST_STATIC, but static environment flags still
require board headers to define CFG_ENV_FLAGS_LIST_STATIC.

Add CONFIG_ENV_FLAGS_LIST_STATIC and append it to ENV_FLAGS_LIST_STATIC
after the legacy CFG_ENV_FLAGS_LIST_STATIC value. Normalize existing
CFG_ENV_FLAGS_LIST_STATIC definitions to end with a comma so the Kconfig
list can be concatenated directly.

This lets boards configure writeable-list policy and type validation
from defconfig without adding a config header solely for env flags.

Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
---
 README                             |  6 ++++++
 env/Kconfig                        | 13 +++++++++++++
 include/configs/capricorn-common.h |  2 +-
 include/configs/hmibsc.h           |  2 +-
 include/configs/imx6q-bosch-acc.h  |  2 +-
 include/configs/iot2050.h          |  2 +-
 include/configs/socrates.h         |  2 +-
 include/env_flags.h                |  3 ++-
 8 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 6836a917c79..b963ce23078 100644
--- a/README
+++ b/README
@@ -1107,6 +1107,7 @@ Configuration Settings:
 		Use buffered writes to flash.
 
 - CONFIG_ENV_FLAGS_LIST_DEFAULT
+- CONFIG_ENV_FLAGS_LIST_STATIC
 - CFG_ENV_FLAGS_LIST_STATIC
 	Enable validation of the values given to environment variables when
 	calling env set.  Variables can be restricted to only decimal,
@@ -1133,11 +1134,16 @@ Configuration Settings:
 		r - Read-only
 		o - Write-once
 		c - Change-default
+		w - Writeable if CONFIG_ENV_WRITEABLE_LIST is enabled
 
 	- CONFIG_ENV_FLAGS_LIST_DEFAULT
 		Define this to a list (string) to define the ".flags"
 		environment variable in the default or embedded environment.
 
+	- CONFIG_ENV_FLAGS_LIST_STATIC
+		Define this to a list (string) to add to the static flags
+		list.
+
 	- CFG_ENV_FLAGS_LIST_STATIC
 		Define this to a list (string) to define validation that
 		should be done if an entry is not found in the ".flags"
diff --git a/env/Kconfig b/env/Kconfig
index 7abd82ab6f3..ca8f9aff19e 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -34,6 +34,19 @@ config ENV_CALLBACK_LIST_STATIC
 	  If the callback name is not specified, then the callback is deleted.
 	  Spaces are also allowed anywhere in the list.
 
+config ENV_FLAGS_LIST_STATIC
+	string "Static flags list"
+	default ""
+	help
+	  The environment flags are associated with variables in a static
+	  list. Define this list in the same format as
+	  CFG_ENV_FLAGS_LIST_STATIC.
+
+	  When CONFIG_ENV_WRITEABLE_LIST is enabled, the 'w' access attribute
+	  can be used to mark variables as writable.
+
+	  Spaces are also allowed anywhere in the list.
+
 config SAVEENV
 	def_bool y if CMD_SAVEENV
 
diff --git a/include/configs/capricorn-common.h b/include/configs/capricorn-common.h
index ee13d2ab950..95a05d64d68 100644
--- a/include/configs/capricorn-common.h
+++ b/include/configs/capricorn-common.h
@@ -48,7 +48,7 @@
 	"sig_a:sw,sig_b:sw," \
 	"target_env:sw," \
 	"upgrade_available:dw," \
-	"ustate:dw"
+	"ustate:dw,"
 #endif
 
 /* Default location for tftp and bootm */
diff --git a/include/configs/hmibsc.h b/include/configs/hmibsc.h
index 950ec8b190d..cca562a66c9 100644
--- a/include/configs/hmibsc.h
+++ b/include/configs/hmibsc.h
@@ -10,6 +10,6 @@
 
 /* PHY needs a longer aneg time */
 
-#define CFG_ENV_FLAGS_LIST_STATIC "BOOT_A_LEFT:dw,BOOT_B_LEFT:dw,BOOT_ORDER:sw"
+#define CFG_ENV_FLAGS_LIST_STATIC "BOOT_A_LEFT:dw,BOOT_B_LEFT:dw,BOOT_ORDER:sw,"
 
 #endif
diff --git a/include/configs/imx6q-bosch-acc.h b/include/configs/imx6q-bosch-acc.h
index 84da8250684..5662b59343e 100644
--- a/include/configs/imx6q-bosch-acc.h
+++ b/include/configs/imx6q-bosch-acc.h
@@ -54,7 +54,7 @@
 	"fitpart:dw," \
 	"mmcpart:dw," \
 	"production:bw," \
-	"ustate:dw"
+	"ustate:dw,"
 
 #else
 /* SD Card boot */
diff --git a/include/configs/iot2050.h b/include/configs/iot2050.h
index 5c58c7bbaab..fe3fd5405d7 100644
--- a/include/configs/iot2050.h
+++ b/include/configs/iot2050.h
@@ -43,7 +43,7 @@
 	"board_uuid:sw,board_name:sw,board_serial:sw,board_a5e:sw,"	\
 	"mlfb:sw,fw_version:sw,seboot_version:sw,"			\
 	"m2_manual_config:sw,"						\
-	"eth1addr:mw,eth2addr:mw,watchdog_timeout_ms:dw,boot_targets:sw"
+	"eth1addr:mw,eth2addr:mw,watchdog_timeout_ms:dw,boot_targets:sw,"
 #endif
 
 #endif /* __CONFIG_IOT2050_H */
diff --git a/include/configs/socrates.h b/include/configs/socrates.h
index 006d649f6ed..9cd0abd60aa 100644
--- a/include/configs/socrates.h
+++ b/include/configs/socrates.h
@@ -108,7 +108,7 @@
  */
 #define CFG_SYS_BOOTMAPSZ	(8 << 20)	/* Initial Memory map for Linux	*/
 
-#define CFG_ENV_FLAGS_LIST_STATIC "ethaddr:mw,eth1addr:mw,system1_addr:xw,serial#:sw,ethact:sw,ethprime:sw"
+#define CFG_ENV_FLAGS_LIST_STATIC "ethaddr:mw,eth1addr:mw,system1_addr:xw,serial#:sw,ethact:sw,ethprime:sw,"
 
 /* pass open firmware flat tree */
 
diff --git a/include/env_flags.h b/include/env_flags.h
index 123fdbcb0ba..98b50c72227 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -89,7 +89,8 @@ enum env_flags_varaccess {
 	NET_FLAGS \
 	NET6_FLAGS \
 	SERIAL_FLAGS \
-	CFG_ENV_FLAGS_LIST_STATIC
+	CFG_ENV_FLAGS_LIST_STATIC \
+	CONFIG_ENV_FLAGS_LIST_STATIC
 
 #ifdef CONFIG_CMD_ENV_FLAGS
 /*
-- 
2.53.0



More information about the U-Boot mailing list