U-Boot makes use of the so-called environment variables to define various aspects of the target functionality. On the STM32F4 SOM, the U-Boot environment is stored in the on-module NOR Flash 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.
To manipulate the U-Boot environment the following commands are used:
- printenv <var> - print the value of the variable var. Without arguments, prints all environment variables:
STM32F4X9-SOM> printenv bootcmd=run flashboot bootdelay=3 baudrate=115200 hostname=stm32f4x9-som ... Environment size: 892/4092 bytes STM32F4X9-SOM>
- setenv <var> <val> - set the variable var to the value val:
STM32F4X9-SOM> setenv image vlad/networking.uImage STM32F4X9-SOM>
Running setenv <var> will unset (undefine) a specified U-Boot variable, so it won't be shown as available next time you run printenv.
- saveenv - save the up-to-date U-Boot environment, possibly updated using setenv commands, into internal Flash. Running saveenv makes sure that any updates you have made to the U-Boot environment are persistent across power cycles and resets. If you don't run saveenv, any updates you may have made to the U-Boot environment will be lost on next reboot.
STM32F4X9-SOM> saveenv Saving Environment to Flash... . done Un-Protected 1 sectors Erasing Flash... . done Erased 1 sectors Writing to Flash... done . done Protected 1 sectors STM32F4X9-SOM>
|