在windows系统下使用QEMU运行milkv-duo系统

操作步骤:

  1. 下载QEUM

打开地址:Download QEMU - QEMU
可以看到 Stefan Weil provides binaries and installers for both 32-bit and 64-bit Windows.
点击 64-bit 进入 QEMU for Windows – Installers (64 bit)
下载 qemu-w64-setup-20230531.exe,安装到 D:\qemu

  1. RISC-V 64系统引导程序

打开地址:https://repo.openeuler.org/openEuler-preview/RISC-V/openEuler-22.09-riscv64
或者:NJU Mirror
点开QEMU路径,
下载 fw_payload_oe_qemuvirt.elf 保存到 d:\milkv-duo\

  1. 制作一个没有blink.sh的镜像
    参考 :GitHub - milkv-duo/duo-buildroot-sdk: Milk-V Duo Official buildroot SDK

  2. 启动批处理

将下面内容保存到 d:\milkv-duo\duo_start_vm.bat

@echo off
chcp 65001
set ssh_port=12055
set path=D:\qemu;%PATH%
qemu-system-riscv64 -machine virt -nographic -m 4G -smp 8 -trace events=event.log -kernel fw_payload_oe_qemuvirt.elf -bios none -drive file=milkv-duo-20230627-1107.img,format=raw,id=hd0  -device virtio-vga -device virtio-blk-device,drive=hd0  -device virtio-net-device,netdev=usernet  -netdev user,id=usernet,hostfwd=tcp::"%ssh_port%"-:22  -device qemu-xhci -usb -device usb-kbd -device usb-tablet  -append "root=/dev/vda2 rw console=ttyS0 swiotlb=1 loglevel=3 systemd.default_timeout_start_sec=600 selinux=0 highres=off mem=512M earlycon"
  1. 最后打开一个控制台窗口,运行这个批处理,不出意外即可正常进入。

制作openEuler riscv64的教程参考我的另一篇文章:

2 Likes

I’ve followed your instructions but running programs inside the emulator fails with the following error:

Illegal instruction

The solution is to build qemu from GitHub - T-head-Semi/qemu: Qemu for Xuantie RISC-V CPU, a generic machine emulator and virtualizer.

非常感谢你的反馈,文中所说方法是一个不标准的方法,是我自己东拼西凑出来的,出问题也是在所难免。可能是我编译的系统版本没有特殊指令所以并没有出现你反馈的错误,建议新手还是使用你的标准方法。