Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
openeuler_risc-v_qemu_install [2022/02/22 15:43] – [系统时间] Change usable method misaka00251openeuler_risc-v_qemu_install [2023/04/28 02:23] – Change PowerShell script misaka00251
Line 33: Line 33:
 qemu-system-riscv64 ` qemu-system-riscv64 `
   -nographic -machine virt `   -nographic -machine virt `
-  -smp -m 4G +  -smp -m 16G ` 
-  -kernel fw_payload_oe.elf ` +  -display sdl 
-  -drive file=openEuler-preview.riscv64.qcow2,format=qcow2,id=hd0 `+  -kernel "fw_payload_oe_qemuvirt.elf" ` 
 +  -bios none 
 +  -drive file=openEuler-22.03-V2-xfce-qemu-preview.qcow2,format=qcow2,id=hd0 
 +  -device virtio-vga `
   -device virtio-blk-device,drive=hd0 `   -device virtio-blk-device,drive=hd0 `
   -device virtio-net-device,netdev=usernet `   -device virtio-net-device,netdev=usernet `
-  -netdev user,id=usernet,hostfwd=tcp::12055-:22 ` +  -netdev user,id=usernet,hostfwd=tcp::12056-:22 
-  -append 'root=/dev/vda1 rw console=ttyS0 systemd.default_timeout_start_sec=600 selinux=0 highres=off mem=4096M earlycon' +  -device qemu-xhci -usb -device usb-kbd -device usb-tablet 
-  -bios none+  -append 'root=/dev/vda1 rw console=ttyS0 swiotlb=1 loglevel=3 systemd.default_timeout_start_sec=600 selinux=0 highres=off mem=16384M earlycon'
 </file> </file>
  
Line 67: Line 70:
 [repository] [repository]
 name=openEuler-risv-v name=openEuler-risv-v
-baseurl=https://isrc.iscas.ac.cn/mirror/openeuler-sig-riscv/oe-RISCV-repo/+#baseurl=https://isrc.iscas.ac.cn/mirror/openeuler-sig-riscv/oe-RISCV-repo
 +baseurl=https://repo.openeuler.org/openEuler-preview/RISC-V/everything/
 gpgcheck=0 gpgcheck=0
 </file> </file>
Line 105: Line 109:
 <code> <code>
 # systemctl enable systemd-timesyncd # systemctl enable systemd-timesyncd
-systemdtl start systemd-timesyncd+systemctl start systemd-timesyncd
 # systemctl status systemd-timesyncd # systemctl status systemd-timesyncd
 </code> </code>
Line 114: Line 118:
 # ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 </code> </code>
 +
 +===== Others =====
 +
 +''ping'' 在 ''iputils'' 包内。
 +
 +==== 公共 CI 机器上编译用户模式的 QEMU ====
 +
 +这里我们可以使用清华源来加快 git clone 的速度,然后转到最新版的分支用于构建:
 +
 +<code>
 +$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/qemu.git
 +$ cd qemu
 +$ git checkout stable-6.1
 +$ ./configure --target-list=riscv64-softmmu,riscv64-linux-user --prefix=/home/misaka00251/program/riscv64-qemu
 +$ make
 +$ make install
 +</code>
 +
 +上面的 prefix 可以自己定义位置,如果自定义了位置的话下面的 ''QEMU_HOME'' 也要一并修改。
 +
 +在编译成功之后,记得在 ''~/.bashrc'' 内添加环境变量:
 +
 +<file bashrc .bashrc>
 +export QEMU_HOME=/home/misaka00251/program/riscv64-qemu
 +export PATH=$QEMU_HOME/bin:$PATH
 +</file>
 +
 +随后 ''source ~/.bashrc'' 应用到当前 session,运行 ''qemu-system-riscv64 -version'' 如果出现版本号说明安装正确。
 +
 +:!: 公共机器上无需再去 openEuler 官方下载相关文件,Wechat@nil 准备了一份放在了 /var/tmp/oE-priv-img 内。
 +
 +==== 我的虚拟环境没空间了 ====
 +
 +这我还真在编译 openjdk 的时候遇到了。
 +
 +首先关机,然后使用 ''qemu-img info openEuler-preview.riscv64.qcow2'' 查看虚拟硬盘信息。
 +
 +然后使用 ''qemu-img resize openEuler-preview.riscv64.qcow2 +64G'' 来增加你的虚拟硬盘空间。
 +
 +接下来,进入系统并安装 ''parted'',输入 ''parted /dev/vda resizepart 1'',在询问结尾是多少 GB 时为了保险起见,我填写了 ''70GB''
 +
 +然后输入 ''partprobe /dev/vda'' 来重新读取分区表,最后输入 ''resize2fs /dev/vda1'' 来获得硬盘空间,结束~~~