[PATCH v1] env: add w flags for net config in explicit write mode
Benjamin ROBIN
benjamin.robin at bootlin.com
Sun Jan 25 14:33:22 CET 2026
Hello Heiko,
On Sunday, January 25, 2026 at 2:03 PM, Heiko Schocher wrote:
> > Users who enable CONFIG_ENV_WRITEABLE_LIST typically want full control
> > over
> > which environment variables are writable. The new default behavior
> > introduced by your patch might not align with what all users expect or
> > want.
> >
> > Would overriding the flags using CFG_ENV_FLAGS_LIST_STATIC not work in
> > this
> > case?
>
> Good question, I have to test... or may Adrian has already done
> such tests...
Please test.
> But looking into code.. if we add this variables in ENV_WRITEABLE_LIST
> the results would be, that this variables are twice in ENV_FLAGS_LIST_STATIC
>
> include/env_flags.h
> 87 #define ENV_FLAGS_LIST_STATIC \
> 88 ETHADDR_FLAGS \
> 89 NET_FLAGS \
> 90 NET6_FLAGS \
> 91 SERIAL_FLAGS \
> 92 CFG_ENV_FLAGS_LIST_STATIC
>
> once through NET_FLAGS and once through CFG_ENV_FLAGS_LIST_STATIC
Yes, the variables with the flags would be declared twice.
> So, that is not good, and I think, code will find the first
> entry, and parse it -> so it will not work.
What leads you to this assumption?
If you examine the code, you'll notice that:
- The env_attr_lookup() function returns the last entry.
- When iterating over the flags using env_attr_walk(), any previous attribute
flags are overridden by subsequent flag declarations.
> Should we instead in case CONFIG_ENV_WRITEABLE_LIST is enabled
> only set/allow CFG_ENV_FLAGS_LIST_STATIC in ENV_FLAGS_LIST_STATIC ?
I haven't tested this myself, as I currently don't have a test environment
available. Please test it, and if it doesn't work, the correct fix would be to
ensure that any future flag declaration overrides previous ones.
--
Benjamin Robin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the U-Boot
mailing list