[U-Boot] [PATCH] fw_setenv: avoid writing environment when nothing has changed

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Sep 25 09:50:13 UTC 2018


On 2018-09-24 09:42, Alex Kiernan wrote:
> On Wed, Sep 5, 2018 at 8:23 PM Rasmus Villemoes
> <rasmus.villemoes at prevas.dk> wrote:
>>
>> In the case where one deletes an already-non-existing variable, or sets
>> a variable to the value it already has, there is no point in writing the
>> environment back, thus reducing wear on the underlying storage
>> device.
>>
>> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> 
> If you were running with a redundant env, and you were trying to sync
> both copies, wouldn't you want a non-changing write to happen?

Hm, probably, yes. But I'd still like to avoid it if they are already in
sync, so perhaps I could just add

  if (memcmp(environment.data, redundant->data, ENV_SIZE))
    environment.dirty = 1;

after reading in the second copy [using that environment.data at that
point is still ((struct env_image_redundant *)addr0)->data ].

Rasmus


More information about the U-Boot mailing list