qemu模拟器搭建arm运行环境

最近看了宋宝华老师的《Linux设备驱动开发详解:基于最新的Linux 4.0内核》,里面讲到qemu试验平台,但是没详细讲解搭建的过程。所以就试着自己搭建。

搭建过程中参考了其他人的文章


但是都在启动过程中遇到了如下问题:


VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
1f00          131072 mtdblock0
 (driver?)
1f01           32768 mtdblock1
 (driver?)
b300           32768 mmcblk0
 driver: mmcblk
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2+ #1
Hardware name: ARM-Versatile Express
[<8010f9e0>] (unwind_backtrace) from [<8010bc7c>] (show_stack+0x10/0x14)
[<8010bc7c>] (show_stack) from [<80645964>] (dump_stack+0x78/0x98)
[<80645964>] (dump_stack) from [<8011ead4>] (panic+0xcc/0x250)
[<8011ead4>] (panic) from [<809011c0>] (mount_block_root+0x194/0x288)
[<809011c0>] (mount_block_root) from [<809013ac>] (mount_root+0xf8/0x11c)
[<809013ac>] (mount_root) from [<809014f8>] (prepare_namespace+0x128/0x18c)
[<809014f8>] (prepare_namespace) from [<80900e4c>] (kernel_init_freeable+0x20c/0x254)
[<80900e4c>] (kernel_init_freeable) from [<806595dc>] (kernel_init+0x8/0x10c)
[<806595dc>] (kernel_init) from [<801078a8>] (ret_from_fork+0x14/0x2c)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

起初我以为是文件系统镜像制作过程出了问题,上网有找了n种制作方法,也都失败了!每次的错误也不尽相同!

在我想要放弃的时候,突然发现启动信息中的"null"(红色带下划线的位置),原来这就是启动出错的原因,就是没有指定root device,

最后找到了海枫的文章,原文地址:http://blog.csdn.net/linyt/article/details/42504975

启动成功

qemu-system-arm -M vexpress-a9 -m 512M -kernel/path/to/kernel/dir/arch/arm/boot/zImage-dtb /path/to/kernel/dir/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "root=/dev/mmcblk0 console=ttyAMA0" -sd a9rootfs.ext3


你可能感兴趣的:(qemu,arm,linux,内核)