Skip to content

Instantly share code, notes, and snippets.

@YukariChiba
Created January 9, 2025 13:00
Show Gist options
  • Select an option

  • Save YukariChiba/d97d9a589651849f7a5e6382f7bec0be to your computer and use it in GitHub Desktop.

Select an option

Save YukariChiba/d97d9a589651849f7a5e6382f7bec0be to your computer and use it in GitHub Desktop.
#!/bin/bash
IMAGE_SEARCH=$(find ./Downloads/deepin-23-beige-preview-riscv64-*.iso | sort | tail -n1)
IMAGE=${1:-$IMAGE_SEARCH}
VCPU=16
VRAM=16G
if [ ! -f ./test-disk.img ]; then
fallocate -l 80G test.img
fi
qemu-system-riscv64 \
-smp $VCPU -m $VRAM -cpu rv64 \
-machine virt,acpi=off \
-device virtio-scsi-pci,id=scsi \
-drive if=pflash,format=raw,unit=0,file=/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd,readonly=on \
-device scsi-cd,drive=cd0 \
-drive file=$IMAGE,id=cd0,format=raw,readonly=on \
-device virtio-net,netdev=deepinnet -netdev user,id=deepinnet,hostfwd=tcp:127.0.0.1:15900-:5900 \
-device virtio-sound-pci,audiodev=deepinaudio -audiodev alsa,id=deepinaudio \
-device qemu-xhci,id=xhci -device usb-tablet,bus=xhci.0 -device usb-kbd,bus=xhci.0 \
-drive file=./test.img,if=virtio \
-device virtio-vga-gl -display gtk,gl=on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment