标签:bin uboot flash environment program env Uboot 环境变量
As we know, the bootloader stores its configuration into an area of the flash called the environment. The environment is basically stored as a sequence of null-terminated strings, with a little header containing a checksum at the beginning. Using the “printenv”, “setenv” and “saveenv” commands in U-Boot, while this environment can easily be manipulated. It is sometimes desirable to be able to generate a binary image of an environment that can be directly flashed next to the bootloader, kernel and root filesystem into the device’s flash memory.
In order to modify the U-Boot environment variables from user space, the program called “mkenvimage” is needed, this program can be generated from the U-Boot sources, follow the instructions in the tools/env/README file.
make env
|
This will get the program “mkenvimage”, the program is executed in host computer, not the target board. The text file “uboot-env.txt” describing the environment is needed like:
git-bash
bootargs=console=ttyS0,115200
bootcmd=tftp 22000000 Image
[...]
|
Then use mkenvimage as follows:
. /mkenvimage -s 0x40000 -o uboot- env .bin uboot- env .txt
|
The -s option allows to specify the size of the image to create. It must match the size of the flash area reserved for the U-Boot environment.
Before using the new uboot-env.bin, the old bin file should be restored by the following commands:
dd if = /dev/mtd7 of=uboot- env .bin
|
Then, flashing the new bin file in /dev/mtd7 by the following commands:
flash_eraseall /dev/mtd7
flashcp uboot- env .bin /dev/mtd7
|
Or, the Lauterbach Debugger is also a good tool to flash the Hyper-Flash.
标签:bin,uboot,flash,environment,program,env,Uboot,环境变量 来源: https://www.cnblogs.com/hutiann/p/11431185.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。