Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 701
KyleL Avatar asked Dec 16 '13 22:12

KyleL


People also ask

Where is U-Boot environment stored?

The U-Boot environment is stored in the SD Card memory and is persistent across power or reset cycles. Parameters defined by the U-boot environment variables include: target IP address, target MAC address, location in RAM where a Linux bootable image will be loaded, and many others.

Which command can be used to remove an environmental variable?

The dsadmin command can be used for deleting an environment variable in a particular project.


2 Answers

The eraseenv is not defined in my case. According to @Joshua's answer, I find the following command does what eraseenv does.

env default -a
saveenv
like image 192
Iceberg Avatar answered Oct 10 '22 04:10

Iceberg


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.

like image 22
Joe Kul Avatar answered Oct 10 '22 04:10

Joe Kul