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,第二个为虚拟磁盘镜像。
下载之后,Linux 可以通过一个小脚本来方便的启动:
- run.sh
#!/bin/bash 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
Windows 下通过 PowerShell 脚本启动:
- run.ps1
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 ` -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 使用的是 dnf 作为包管理器,配置文件在 /etc/dnf/dnf.conf
。
默认安装了 vim ,可以使用 vim 进行编辑。写入以下数据:
- dnf.conf
[main] gpgcheck=1 installonly_limit=3 clean_requirements_on_remove=True best=True skip_if_unavailable=False [repository] name=openEuler-risv-v baseurl=https://isrc.iscas.ac.cn/mirror/openeuler-sig-riscv/oe-RISCV-repo/ gpgcheck=0
然后执行 dnf update
即可。