[U-Boot-Users] auto-save environment if using default environment?

Wolfgang Wegner wolfgang at leila.ping.de
Wed Mar 26 00:15:14 CET 2008


Hi Wolfgang,

On Tue, Mar 25, 2008 at 09:16:13PM +0100, Wolfgang Denk wrote:
> 
> Quite a number of boards  use  an  embedded  environment  which  gets
> auto-installed  when  programming the U-Boot image. And a significant
> percentage of boards I know use some installation tool that will  set
> up  things like serial number, MAC addresses etc. one way or another,
> andin many cases this includes running "saveenv".

with "installation tool" you mean any kind of interaction from the
U-Boot command prompt, correct? (Just for clarification on my side)
In my current application there (unfortunately) there is no hardware
serial number anyways, and no ethernet, so no data that would have to
be set for each device seperately.

> > I just made this small patch to auto-save the environment if it is
> > not found in flash but am wondering if
> > - I missed something and such a possibility does already exist?
> 
> No, and I strongly discourage it. It just makes detection of certain
> types of problems / hardware errors etc. more difficult or even
> impossible.
> 
> > - something similar might be worth considering as a new regular feature?
> 
> I think I would oppose such a change because I consider it really
> dangerous.

I think I get your point here, and especially as now Markus pointed
me to a possible solution just using the command shell I perfectly agree
that having it built-in like in my patch is just a source of possible
problems, not needed and thus not a good idea.

On the other hand (and taking into account your answer to Markus),
sometimes an automatic approach might have its use, too:

On our board we have an FPGA, and for different applications a different
FPGA file shall be loaded without updating the firmware. For this, the
application has to set an U-Boot environment variable that specifies which
FPGA file to load on next boot.
But, I do not want the application to mess around with the building the
complete environment, instead, it shall just modify the existing variables.
So, as I trust U-Boot more than my application, I want U-Boot to always
initialize the environment stored in flash, and have the application just
update the single variable - but this implies that even if the application
failed during updating the environment (be it because of a software fault
or power failure or whatever reason), U-Boot has to re-write this on the
next power-up in case it detects the flash environment is invalid.

I think there may also be different opinions about which is the best
solution here, but especially because the environment holds vital data
like bootcmd etc., for me this looks like the most secure solution although
I do not know if U-Boot already claims to have a brain. ;-)

Best regards,
Wolfgang





More information about the U-Boot mailing list