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


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SimIt-ARM-3.0 给予命令行ARM指令模拟器,短小精悍,是研究ARM处理器的好工具,该模拟器既可以运行用户级别的ELF程序,又可以模拟运行Linux操作系统;提供了简单易用的调试命令,可以逐条跟踪指令的执行。 SimIt-ARM-3.0-gk-20150902.tar.bz2 HowTo 0.what is SimIt-ARM-3.0 SimIt-ARM 3.0 is an instruction-set simulator that runs both system-level and user-level ARM programs, for more about it please read user's guide file. 1.how to build tar jxvf SimIt-ARM-3.0-gk-20150902.tar.bz2 cd SimIt-ARM-3.0-gk ./configure make make install After these steps, the ./build/bindirectory contains the following programs: ema An ARM interpreter. To test the installation was successful type ./build/bin/ema test/wc configure modifiy PATH environment variable: PATH=$PATH:$HOME/SimIt-ARM-3.0-gk/build/bin ; export PATH 2. how to use 2.1 run user-level ARM programs [root@ORA9 SimIt-ARM-3.0-gk]# cd gcc-asm [root@ORA9 gcc-asm]# more hello.c /* * hello.c * Tue Sep 8 10:13:40 CST 2015 */ int main() { printf("hello world\n"); __asm("mov r0,#2\n\t" "swi 0x1\n\t"); // syscall: exit(2); } [root@ORA9 gcc-asm]# arm-linux-gcc -v Reading specs from /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/specs Configured with: /opt/crosstool/crosstool-0.28/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/opt/crosstool/arm-linux/gcc-3.4.1-glibc-2.3.2 --with-float=soft --with-headers=/opt/crosstool/arm-linux/gcc-3.4.1-glibc-2.3.2/arm-linux/include --with-local-prefix=/opt/crosstool/arm-linux/gcc-3.4.1-glibc-2.3.2/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long Thread model: posix gcc version 3.4.1 [root@ORA9 gcc-asm]# arm-linux-gcc hello.c -o hello -static [root@ORA9 gcc-asm]# ls -l hello* -rwxr-xr-x 1 root root 520775 Sep 8 10:18 hello -rw-r--r-- 1 root root 160 Sep 8 10:15 hello.c [root@ORA9 gcc-asm]# file hello hello: ELF 32-bit LSB executable, ARM, vers

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值