说明
用来加载内核
步骤
准备工作
启动 tftp 服务
编译内核
内核需要 uImage 格式,才能被 uboot 加载
1
| make LOADADDR=0x60003000 uImage -j$(nproc)
|
把 output/arch/arm/boot/uImage 和 dts 放到 tftp 的目录
uboot
手动测试
进入 uboot 后中断
1 2 3 4 5 6 7
| sudo qemu-system-arm \ -M vexpress-a9 \ -m 512M \ -kernel ~/downloads/u-boot-2023.04/output/u-boot \ -nographic \ -netdev bridge,id=net0,br=virbr0 \ -net nic,netdev=net0
|
手动设置变量
1 2 3 4 5 6
| setenv ipaddr 10.0.2.222
setenv serverip 10.0.2.1 ping 10.0.2.1
|
下载内核,设备树,启动
1 2 3
| tftp 0x60003000 uImage tftp 0x60500000 vexpress-v2p-ca9.dtb bootm 0x60003000 - 0x60500000
|
配置
1 2 3
| Environment ---> [*] Create default environment from file (uboot.env) Path to default environment file (NEW)
|
uboot.env
1 2 3 4
| ipaddr=10.0.2.222 serverip=10.0.2.1 bootargs=root=/dev/mmcblk0 rw init=/linuxrc ip=10.0.2.222 console=ttyAMA0 bootcmd=tftp 0x60003000 uImage; tftp 0x60500000 vexpress-v2p-ca9.dtb; bootm 0x60003000 - 0x60500000
|
编译
运行
1 2 3 4 5 6 7
| sudo qemu-system-arm \ -M vexpress-a9 \ -m 512M \ -kernel ~/downloads/u-boot-2023.04/output/u-boot \ -nographic \ -netdev bridge,id=net0,br=virbr0 \ -net nic,netdev=net0
|