1. Compile the fw_printenv tool
Execute under the uboot source path, and then generate the executable file of the fw _ printenv under tools/env.
. /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabimake env
2. Configure fw_env.config file
Modify the fw_env.config file under tools/env in the uboot source directory according to the mtd partition, the location and size of the UBOOT environment variables, etc. See the instructions in the fw_env.config file and the /tools/env/README file for specific modifications.
Among them, Device offset, Env size, and Flash sector size should correspond respectively to the three macro definitions CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, and CONFIG_ENV_SECT_SIZE in the include/configs/xxxx.h file in the U-Boot source code directory.
vi include/configs/mx6ul_14x14_evk.h
Take the test 256nand as an example:
CONFIG_ENV_OFFSET = 0x600000
ONFIG_ENV_SECT_SIZE = 0x20000
Open the tools/env/fw_env.config and modify as shown in the following figures:
Take the test 1gnand as an example:
CONFIG_ENV_OFFSET = 0x1000000
ONFIG_ENV_SECT_SIZE = 0x20000
nand model number MT29F8G08ABACA
Refer to the manual to change the ENV_SECT_SIZE value to 256K.
Open the tools/env/fw_env.config and modify as shown in the following figures:
nand model number MT29F8G08ABABA
Refer to the manual to change the ENV_SECT_SIZE value to 512K.
Open the tools/env/fw_env.config and modify as shown in the following figures:
3. Copy the file
Copy tools/env/fw_env.config to the /etc path of the development board;
Copy tools/env/fw_printenv to the root file system of the development board under the path /usr/bin.
And create a soft link to fw_setenv ln -s /usr/bin/fw_printenv /usr/bin/fw_setenv
4. Read and write environment variable test
Read environment:
Write environment variable:
The uboot phase has been modified synchronously.
5. Problems and solutions
Problem: make env reports an error in the uboot source code
Solution: Comment out the CC in the top-level Makefile and use the environment variable in the CC.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.