Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

To use default vars without removing them from flash execute

env default -a

within u-boot and then execute $bootcmd. Joe Kul's solution.

To erase the vars from the SPI flash execute

run eraseenv

within u-boot and then reboot.

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
# add uboot env variable
setenv my_var 1

# printenv my_var
my_var=1

# remove/unset uboot env variable
setenv my_var

# printenv my_var
## Error: "my_var" not defined
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top