[U-Boot] [PATCH] env: common: load read-only variables after reset
Yaniv Levinsky
yaniv.levinsky at compulab.co.il
Sun Jul 29 09:39:08 UTC 2018
Hello Wolfgang,
On 07/28/2018 03:56 PM, Wolfgang Denk wrote:
> Dear Yaniv,
>
> In message <20180727153444.5602-1-yaniv.levinsky at compulab.co.il> you wrote:
>> U-Boot fails to load read-only variables from storage after a reset. It
>> happens because the environment hash table prevents creating read-only
>> variables unless the H_FORCE flag is passed.
>
> This is NOT a good idea. "env import" should respect read-only
> settings in exactly the same way as "env set" does. Please keep in
> minf that the user my set a variable to read-only exactly just to
> prevent if from bein (accidentially) overwritten when importing an
> (not exactly know) set of environment settings. Your patch would
> kill any such protection.
>
> IMO the correct approach would be to add a "-f" flag to "env import"
> and the, and ONLY then, also set the H_FORCE flag.
>
> Naked-by: Wolfgang Denk <wd at denx.de>
>
> Best regards,
>
> Wolfgang Denk
>
Thank you for reviewing the patch.
The command "env import" should of course respect access restriction flags.
Confusingly, the function env_import() in env/common.c has nothing to do with
the implementation of the "env import" command. This is done entirely by
do_env_import() in cmd/nvedit.c.
To the best of my knowledge, the function env_import() is used only by storage
devices to load the environment on boot. In this scenario, I think we do need to
ignore access restriction flags. Otherwise, read-only variables won't load from
storage with the rest of the environment.
Please correct me if I'm wrong.
Thanks,
Yaniv
More information about the U-Boot
mailing list