在 QEMU 内运行 openEuler RISC-V 移植版

This is an old revision of the document!


在 QEMU 内运行 openEuler RISC-V 移植版

不要忘记安装最新版的 QEMU以及将 QEMU 的目录添加到环境变量里!

openEuler 官网可以下载移植版,获取下面两个文件:

  • fw_payload_oe.elf
  • openEuler-preview.riscv64.qcow2

第一个为用于 QEMU 启动的 kernel image,第二个为虚拟磁盘镜像。

下载之后,通过一个小脚本来方便的启动:

#!/usr/bin/zsh
qemu-system-riscv64 \
  -nographic -machine virt \
  -smp 2 -m 4G \
  -kernel fw_payload_oe.elf \
  -drive file=openEuler-preview.riscv64.qcow2,format=qcow2,id=hd0 \
  -object rng-random,filename=/dev/urandom,id=rng0 \
  -device virtio-rng-device,rng=rng0 \
  -device virtio-blk-device,drive=hd0 \
  -device virtio-net-device,netdev=usernet \
  -netdev user,id=usernet,hostfwd=tcp::12055-:22 \
  -append 'root=/dev/vda1 rw console=ttyS0 systemd.default_timeout_start_sec=600 selinux=0 highres=off mem=4096M earlycon' \
  -bios none

当系统启动之后,可以在 Host 上通过 ssh 登录到运行于 QEMU 模拟器中的 openEuler OS:

$ ssh -p 12055 root@localhost

默认的用户名为 root,密码为 openEuler12#$

openeuler_risc-v_qemu_install.1645452999.txt.gz · Last modified: 2022/02/21 14:16 by misaka00251
CC Attribution-Share Alike 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International