QEMU 5.2 for RISC-V,启动Linux Kernel的参数

BuildRoot 2020.02.10中的RISC-V 64的默认模拟器是QEMU4.2.0,其启动参数可以在board/qemu/riscv64-vir/readme.txt中看到,内容如下:

Run Linux in emulation with:

qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf \
    -device loader,file=output/images/Image,addr=0x80200000 \
    -append "rootwait root=/dev/vda ro" \
    -drive file=output/images/rootfs.ext2,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0 \
    -netdev user,id=net0 -device virtio-net-device,netdev=net0 \
    -nographic

The login prompt will appear in the terminal that started Qemu.

Tested with QEMU 3.1

 

经测试,BuildRoot自带编译输出的QEMU 4.2.0,使用上述参数能够正常输出启动log,运行正常。

 

但是目前QEMU官方最新的QEMU版本是QEMU 5.2.0,使用上述参数进行启动,则无法正常启动,QEMU会报错。查看QEMU官方ChangeLog可以看到,QEMU 5.2.0开始,模拟器内部集成了OpenSBI,因此上述启动参数会无法正常工作。修改启动参数如下,则QEMU可以正常启动。

qemu-system-riscv64  -M virt  -kernel output/images/Image \
    -append "rootwait root=/dev/vda ro" \
    -drive file=output/images/rootfs.ext2,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0 \
    -netdev user,id=net0 -device virtio-net-device,netdev=net0 \
    -nographic

 

经后续分析,QEMU 5.2.0使用BuildRoot编译出的OpenSBI和Linux Kernel,运行方法如下:

qemu-system-riscv64 -M virt -bios output/images/fw_jump.bin \
    -kernel output/images/Image -append "rootwait root=/dev/vda ro" \
    -drive file=output/images/rootfs.ext2,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0 \
    -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic

 

更新网卡,使用tap参数启动:

qemu-system-riscv64 -M virt -nographic \
    -bios output/images/fw_jump.bin \
    -kernel output/images/Image -append "rootwait root=/dev/vda ro" \
    -drive file=output/images/rootfs.ext2,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0 \
    -netdev tap,id=net0,ifname=qemutap,script=no,downscript=no \
    -device virtio-net-device,netdev=net0 



 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值