Uboot configuration compilation and common instructions

1. Configure and compile Uboot
(1) Configure Uboot
Because a set of Uboot can compile a lot of images for different development boards, the purpose of configuration is to tell which development board the image compiled by Uboot runs on.
①Open Makefile
\210 Find board-related configuration options
eg: As in x210, the configuration option described in the makefile is X210_sd_config
②Configure Uboot
make (config options) _config
③ Compile
make ARCH =arm CROSS_COMPILE=arm-linux- (the name of the cross-compilation toolchain)
2. Detailed explanation of Uboot command
(1) Help command
Uboot provides a rich set of commands, but the commands supported by different development boards are different (configurable). Under the Uboot environment, enter help to view the commands supported by the current development board.
(2) Environment variable related commands
print/printenv can print all environment variables under the current Uboot to the current command line.
The role of environment variables is to save a lot of configuration information.
(3) Addition, deletion and modification of environment variables
setenv
setenv environment variable name environment variable value
①If this environment variable name exists before, then it is to modify the value of the environment variable
②If this environment variable name does not exist before, then add the environment variable.
③ If there is no value of the environment variable after the setenv environment variable, then delete the environment variable
(4) Save environment variables
savenv
(5) Program download command
tftp download files over the network
Note: To use tftp, you need to configure the network first; key settings for configuring the network: ① The development board, windows, and virtual machine are on the same network segment; ② The virtual machine is set to bridge mode, and the selected network card must be the physical network card in Windows; ③ For long-term use, try to use a static IP; ④ After the configuration is completed, a network test ping should be performed
tftp The program file to be downloaded from the memory address of the development board
eg:tftp 0xc0080000 uImage.bin
(6) Execution program
bootm 内存地址 参数(如果执行需要参数)
执行的是固定格式的二进制程序;
固定格式:指的是我们在下载程序的时候,会在可执行程序的前面加一个头信息,这个头信息中包含了操作系统的信息、文件的压缩方式等等。(也就是说这个指令是带操作系统下的程序执行指令)
如果是裸机程序,在Uboot下使用go +程序的内存地址 进行执行
(7)查看内存内容
md 开发板中的内存地址
变种:md.b(字节) md.w(字) md.l
(8)修改内存内容
mm 要修改内存的首地址
注:
①mm命令可用于修改一个范围的内存地址下的内容,方式是一个内存地址一个内存地址的修改,修改完一个会自动跳转到下一个内存地址下。
②修改写入的数据必须是一个合法的十六进制立即数
③如果中间的某个地址下的值不用修改,那么只需要敲回车,不用输入值,即原值不动。
④如果想要退出mm命令,则输入空格,然后回车就会退出修改状态。
(9)擦除NandFlash
nand erase 起始地址(start) 要清除的长度(len)
擦除start处开始的,长度为len的区域
eg:
nand erase 0x4000 0000 0x5000 0000
(10)写/读nand Flash
nand write 内存起始地址 flash起始地址 长度len
将内存起始地址处,长度为len的数据,写入flash起始地址处
eg: nand write c000 8000 4000 0000 5000 0000
nand read 内存起始地址 flash起始地址 长度len
将flash中起始地址处长度为len的数据拷贝到起始地址为内存的起始地址的地方。
(11)设置自启动
①设置从nand flash自动启动
setenv bootcmd nand read c0008000 4000 0000 5000 0000\;bootm c000 8000
②设置自动下载内核到内存启动
setenv bootcmd tftp c000 8000 UImage.bin \;bootm c000 8000

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326028401&siteId=291194637