300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > qemu模拟u-boot引导内核难点记录

qemu模拟u-boot引导内核难点记录

时间:2023-07-02 03:11:32

相关推荐

qemu模拟u-boot引导内核难点记录

流程记录

1 编译u-boot、linux内核、busybox简易文件系统2 遇到的问题及解决方案2.1 qemu-system-arm模拟启动linux内核和busybox遇到的错误2.2 qemu-system-arm模拟启动u-boot时的错误

1 编译u-boot、linux内核、busybox简易文件系统

编译参考链接:/m0_46205725/article/details/117301262

2 遇到的问题及解决方案

2.1 qemu-system-arm模拟启动linux内核和busybox遇到的错误

执行如下命令启动linux内核和busybox文件系统

qemu-system-arm -M vexpress-a9 -m 512M -dtb vexpress-v2p-ca9.dtb -kernel zImage -nographic --append "root=/dev/mmcblk0 rw console=ttyAMA0" -sd initrd.img

1 报第1个错大致如下:

[3.14325312]kernel panic:can not mount ext filesystemcan not mount VFS...[3.15845645]kernel panic

解决方案:因为initrd.img文件是使用mkfs.ext4进行格式化,因此重新编译linux内核,并开启配置项CONFIG_EXT4_FS=y。

2 解决第1错后,又报错如下:

Kernel panic - not syncing: No working init found

解决方案:查了半天,发现initrd.img文件里没有放busybox文件系统,自然也就没有init程序。格式化initrd.img文件后挂载到/mnt,然后将busybox的文件都复制到/mnt,然后卸载。

2.2 qemu-system-arm模拟启动u-boot时的错误

执行如下命令启动u-boot时

qemu-system-arm -M vexpress-a9 -m 512M -kernel u-boot -nographic -net nic -net nic,vlan=0 -net tap,vlan=0,ifname=tap -sd initrd.img

1 报第1个错如下:

qemu-system-arm:vlan,invalid argument.

解决方案

参考链接/birencs/article/details/126666827

增加tap0虚拟网卡后,改成如下命令

qemu-system-arm -M vexpress-a9 -m 512M -kernel u-boot -nographic -net nic -net tap,ifname=tap0,script=no,downscript=no -sd initrd.img

在u-boot中使用bootm命令引导linux内核和dtb设备树时

2 报第2个错如下:

参考链接/u014426028/article/details/108221255

=> can not recovery resverve memory!

解决方案:明确内核加载地址和入口地址以及u-boot中tftp下载地址。在u-boot中使用bdinfo命令查看内存范围如下图,正好是qemu-system-arm设置的512M

因此,使用u-boot源码目录下tool/mkimage重新制作uImage,设置内核加载地址和入口地址如下图。

在u-boot中使用bootm命令引导linux内核和dtb设备树时

3 第三个问题,卡在Starting kernel… 。如下图

解决方案:参考链接/p/f7d5b6ad0710

在u-boot中设置变量,增加boot参数console

=>setenv bootargs 'root=/dev/mmcblk0 rw console=ttyAMA0'

流程都没毛病!神伤良久!

总结:qemu参数-sd initrd.img实际就是u-boot中的emmc设备。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。