[PATCH] env: add Kconfig option for static flags list
Simon Glass
sjg at chromium.org
Mon May 11 15:41:59 CEST 2026
Hi James,
On 2026-05-09T23:01:44, James Hilliard <james.hilliard1 at gmail.com> wrote:
> env: add Kconfig option for static flags list
>
> 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(-)
We are trying to migrate away from the README, so would it be possible
to move the docs to one of these files instead:
doc/develop/environment.rst
doc/usage/environment.rst
> diff --git 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
In include/configs/aristainetos2.h
#define CFG_ENV_FLAGS_LIST_STATIC 'ethaddr:mw,serial#:sw,board_type:sw,' \
'sysnum:dw,panel:sw,ipaddr:iw,serverip:iw'
No trailing comma, so setting both will run serverip:iw into the first
Kconfig entry. Please normalise this one too.
> diff --git a/env/Kconfig b/env/Kconfig
> @@ -34,6 +34,19 @@ config ENV_CALLBACK_LIST_STATIC
> +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.
I agree with Quentin, There are only five remaining users of
CFG_ENV_FLAGS_LIST_STATIC, so you should consider converting each to a
defconfig setting of CONFIG_ENV_FLAGS_LIST_STATIC and dropping
CFG_ENV_FLAGS_LIST_STATIC entirely. Carrying two parallel mechanisms
plus the trailing-comma rule seems more confusing than finishing the
move.
> diff --git a/env/Kconfig b/env/Kconfig
> @@ -34,6 +34,19 @@ config ENV_CALLBACK_LIST_STATIC
> + When CONFIG_ENV_WRITEABLE_LIST is enabled, the 'w' access attribute
> + can be used to mark variables as writable.
Regards,
Simon
More information about the U-Boot
mailing list