[U-Boot] A command to discard saved environments?

Wolfgang Denk wd at denx.de
Wed Aug 3 21:59:56 CEST 2016


Dear James,

In message <fcff97bb-d146-fc77-28e4-050cac0922f4 at gmail.com> you wrote:
> I know my non-volatile copy of the environment is in NOR flash so I use 
> the command
> 
> protect all off;erase <saved env address> +1
> 
> But, of course this is specific to NOR flash.
> 
> I'm not aware of a way to do this in the general case, independent of NV 
> environment storage media and redundancy.

The idea applies to all kinds of persistent storage: just overwrite a
few (4 or more) bytes at the beginning of each copy of the persistent
envrionment.

In your case, you could save the "erase" by overwriting the first 4
bytes (where the CRC32 checksum is stored) with 0xFFFFFFFF.

> I'd be supportive of having a way to do this.

No, I don't think we want to support this.  The persistent copy of the
environment is a precious resource, and I cannot think of a regular
use case to invalidate this.  If you do, the result is that you will
use the default settings at next boot - and the samve effect can be
acchieved by using "env reset" + "env save" as already recommended.
[The only difference is that you will not see the "invalid CRC, using
the default env" warning then, but I consider this a pro, not a con.]

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
Test everything. Hold on to the good.          - 1 Thessalonians 5:21


More information about the U-Boot mailing list