How do I clear environment variables previously saved with u-boot?

KyleL picture KyleL · Dec 16, 2013 · Viewed 36.8k times · Source

I am working with an embedded linux kit that is running u-boot. In order to get everything booting properly, I had to modify some environment variables and store them with the 'saveenv' command.

Now I would like to go back and see what the defaults were, verify that I know exactly what was changed, and figure out a way to change those defaults so that each unit in production won't need to be individually booted and modified.

Is there a way to tell u-boot to clear any saved data so I can see what the defaults are again? The flash type is QSPI if that makes a difference.

Answer

Joe Kul picture Joe Kul · Dec 16, 2013

On your kit, try

help env

and look for "env default".

env default [-f] var [...] - [forcibly] reset variable(s) to their default values

That sounds like what you are looking for.

env default -a

does a nonpersistent change, then "printenv" shows the defaults.

To change defaults, you would rebuild your u-boot.bin with changes e.g. to CONFIG_EXTRA_ENV_SETTINGS.