U-Boot makes use of the so-called environment variables to define various aspects of the target functionality. On the STM32F7 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:
bootargs=stm32_platform=stm32f7-som console=ttyS0,115200 panic=10
Environment size: 887/4092 bytes
- setenv <var> <val> - set the variable var to the value val:
STM32F7-SOM> setenv image vlad/networking.uImage
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.
Saving Environment to Flash...
Un-Protected 1 sectors
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors