[U-Boot-Users] Using 'ver' env var

Wolfgang Denk
2007-08-13T20:45:48Z

In message <5CBE65F7D9232C47861CB09B0954861C66A93C@MAIL.infinitychannel.local> you wrote:
>
> > What makes you think so? saveenv does not do any filtering to exclude
> > any variable, so of course it gets saved, too.
>
> It does, but only if you explicitly call 'saveenv'... It does not store
> on it's own.

Of course. U-Boot usually does only what you tell it.

> > To print the U-Boot version without need to reset the board.
>
> But you can print it using 'version', too... And unless you explictly
> save it,
> the 'ver' env var does nothing more for you than the 'version' command,

You can use the variable in commands, like for implementing
version-dependent things, or test it, or ...

> Can't be accessed anywhere other then from the u-boot command prompt...

It is a normal environment variable like any other. It can be used
whenever and whererver other variables can get used. This includes
saving to flash and reading the flash from Linux.

> If you don't explicitly 'saveenv' there is no 'ver' variable to read
> from linux...
> And it can't be good for the flash to force u-boot to save on every
> boot.

It's not needed to save this on every boot. It's perfectly sufficient
to save it once after you've installed and booted a new version of
U-Boot.

> So if I update (from linux for example) 'ver' doesn't get updated unless
> u-boot is
> doing a saveenv on every boot...

Not on every boot. It's sufficient to perform this on the first boot.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
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
'What shall we do?' said Twoflower. 'Panic?' said Rincewind hope-
fully. He always held that panic was the best means of survival; back
in the olden days, his theory went, people faced with hungry sabre-
toothed tigers could be divided very simply in those who panicked and
those who stood there saying 'What a magnificent brute!' or 'Here,
pussy.' - Terry Pratchett, _The Light Fantastic_