[U-Boot] U-Boot Env Vars in Flash and EEPROM at the same time (hybrid env)?

Brian Hutchinson b.hutchman at gmail.com
Thu Mar 18 15:58:31 CET 2010


(puts on flame retardant underwear) Can environment variables be
pulled from Flash and EEPROM?

Why would I want to do this?  I need to provide fail safe upgrade path
and need to do something similar to the bootcount feature in PPC (I'm
using ARM though).

I have a internal SRAM that I can use for the bootcount feature (no
registers survive reset so SRAM is next best option) but I want to be
able to select Kernel B or Kernel A.  Let me explain more.  Right now
the bootcount feature boots a primary kernel and if it fails it tries
a secondary kernel.  So in my case the bootcount feature would
translate to Kernel A always tried first, then B and we want to be
able to say boot B first, then A on failure (make the choice
configurable based on upgrades etc).

The goal is to not brick a device during a upgrade.  Whatever bank you
are running out of, you upgrade by flashing the bank not being used.
Once a bank has been upgraded, if I want to select that bank to boot
... I would need to modify a environment variable but if it is stored
in flash then while that sector (a 256k sector in my case) is being
updated ... if power is lost I just hosed myself.  If the environment
variable I update was stored in EEPROM, then it would be closer to an
atomic action that couldn't be interrupted with say a power failure.

So what I'm asking about is a Hybrid environment were some variables
are in flash and some are in EEPROM.  The env is read from both
locations and saveenv writes some vars in flash and some in EEPROM.
With the current u-boot code I have (1.1.6) the environment choices
are mutually exclusive (flash, eeprom, nvram etc.)

Is this a sane approach or am I heading for heart ache?  This has to
be something that others have dealt with but I didn't see any similar
discussions in the archives.

Regards,

Brian


More information about the U-Boot mailing list