[U-Boot] interaction between CONFIG_CMD_SAVEENV and CONFIG_BOOTCOMMAND

Wolfgang Denk wd at denx.de
Wed Sep 14 20:38:32 CEST 2016


Dear Nicolas,

In message <CAJZhe_jhWpQLgwquHZ2U5jHL7hvkBFc=Kz0joyELDAM5vR+t7A at mail.gmail.com> you wrote:
> 
> > Would that really be enough?  Please keep in mind that "env save" (or
> > "saveenv") is only responsible for storing the current environment
> > into persistant storage.  It does not modify the environment at all.
> > To modify the environment, you can use quite a number of commands,
> > including "env set", "env import" etc.  You would have to disable all
> > of these to prevent modifications of the environment settings - and
> > probably cripple U-Boot to a level where it becomes unusable.
> 
> >> Our objective is just to avoid the user to modify the content in the
> persistent storage. Indeed, we have to retrieve the original content at
> each reboot.
> If the user makes something wrong in its current environment, this is its
> responsability, but after the reset, we have to gat back the original
> content we stored once for all. In that case, saveenv would maybe be
> enough, don't you think?

It should work as you expect.

But since you ask what I _think_ ... :-)  As a developer I really hate
systems that attempt to lock me down into such a crippled environment.
I still love and cherish the old quote:

"UNIX was not designed to stop you from doing stupid things,  because
that would also stop you from doing clever things."       - Doug Gwyn

You plan to implement a policy that restricts the freedom of the user
for a questionable (to me - I don't know your requirements) advantage.
Would it not be possible to implement a more open design, where the
user can actually save his changes to the persistent environment
(so someone who knows what he is doing can use the full power of the
software), and instead provide a way to perform a factory reset (using
"env default -f" or similar) to your original settings?  That would
feel much more U-Boot-like to me :-)


> > Which exact version of U-Boot are you talking about?
> >>  a quite old one, v2015.01 :-( And we do not plan to upgrade this
> "primary bootloader" u-boot.

Hm... this should still not show such behaviour.  Check your board
config file thoroughly, especially your environment settings.  Check
that environment definitions are explicitly terminated by NUL
characters, and that all string quotes pair.  If you have any #ifdef
magic there, check that, too.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All I ask is a chance to prove that money can't make me happy.


More information about the U-Boot mailing list