- The loading address of the kernel and device tree needs to be set in the uboot environment variable, and
boot.scr
these parameters can be passed directly.boot.scr
Is generated by theboot.cmd
use ofmkimage
tools.mkimage
Tools are in theuboot/tools
folderboot.scr
Put it in the first partition of the TF card.
boot.cmd
# 在uboot根目录下新建
vim boot.cmd
# 写入以下内容
setenv bootargs console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb
load mmc 0:1 0x80008000 zImage
bootz 0x80008000 - 0x80C00000
# 第一行setenv命令,设定了变量bootargs(启动参数)为:通过tty0和ttyS0串口输出启动信息;启动失败延迟5秒重启,根文件在TF卡的第二分区,可读写;
# 第二行指定了从TF中将设备树的dtb文件加载到0x80C00000的位置(地址参考自官方SDK)
# 第三行指定了将压缩后的内核zImage加载到0x80008000的位置
# 第四行为从加载地址启动内核的命令
If you are using the ttyS1 serial port, use the following code:
setenv bootargs console=tty1 console=ttyS1,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb
load mmc 0:1 0x80008000 zImage
bootz 0x80008000 - 0x80C00000
mkimage
# 该工具在`uboot/tools`文件夹下
# 在uboot根目录下输入以下命令拷贝到用户文件夹下,方便以后可以直接使用
sudo cp ./tools/mkimage /usr/local/bin/mkimage
boot.scr
# 使用以下命令生成`boot.scr`,然后将其放入第一分区
mkimage -C none -A arm -T script -d boot.cmd boot.scr