
In message 1187102431.13869.7.camel@elrond.sweden.atmel.com you wrote:
Ideally this should be in a script "reboot_cmd" which gets executed at every reboot before anything else is executed.
I really don't understand why you make all this so complicated.
I think we agree that all that needs to be done is running a single "saveenv" command once after installation of a new U-Boot image (which is supposed to never to happen in the field anyway).
So deine yoiur "bootcmd" to include something like a "run once" command, and define "once" as a "harmless" operation, like this:
=> setenv once version
Then, when you update U-Boot (under Linux), also change the definition of "once", equivalent to this:
=> setenv once "saveenv;setenv once version"
The next time U-Boot boots it will run this variable, will save the environment and then reset the variable to the effective no-op command.
Voila...
Best regards,
Wolfgang Denk