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

Masahiro Yamada yamada.masahiro at socionext.com
Thu Aug 11 15:54:25 CEST 2016


2016-08-04 14:40 GMT+09:00 Wolfgang Denk <wd at denx.de>:
> Dear James,
>
> In message <d18f75c7-388b-b607-ed70-64a250320d5a at gmail.com> you wrote:
>>
>> > In your case, you could save the "erase" by overwriting the first 4
>> > bytes (where the CRC32 checksum is stored) with 0xFFFFFFFF.
>
> Wrong.  I meant writing 0x00000000 - as you can always write that,
> setting any remaining 1 bits to 0 which does not require an erase of
> the sector.
>
>> In the case of my NOR flash storage, telling erase to do one byte
>> actually causes the erasure of an entire flash sector, which we've
>> reserved for the NV environment.  You are of course correct that
>> overwriting the CRC will have the same operational effect.
>
> ...and as the next "saveenv" will start with an erase, writing 0 to
> the CRC 32 field saves you one erase cycle on that sector.
>
> I know, this is nitpicking. Soryy.
>
>> It's a rare occurrence that we need to do this, we don't use this sort
>> of operation as a normal part of doing business.
>
> Agreed. This should never be part of regular operation.
>
> Best regards,
>
> Wolfgang Denk
>


Sorry for my late reply.


I was in the conflict between my coworkers from different schools.

One always wants to save his preference in the environments in a
non-volatile device.

Another wants to load "uEnv.txt" to adjust environments, so the
environments from a non-volatile device
are just annoying for him.  He just want to clean the saved
environments away, and makes the
sectors for environments to the initial state.


I was searching a way to make everyone happy.
As Tom pointed out, the latter can use CONFIG_ENV_IS_NOWHERE.
Thanks!

-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list