Skip to content

Instantly share code, notes, and snippets.

@cconstab
Last active August 8, 2022 15:14
Show Gist options
  • Save cconstab/e63ffc14f50aae0279b5dc30d9033cad to your computer and use it in GitHub Desktop.
Save cconstab/e63ffc14f50aae0279b5dc30d9033cad to your computer and use it in GitHub Desktop.
Get Qemu
https://www.qemu.org/download/
Get ubuntu for risc v5 - I choose ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img
https://wiki.ubuntu.com/RISC-V
Uncompress with xz and give yourself some more space - I did this using a WSL 2 ubuntu shell as it was easier to use the tools from linux
xz -dk ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img.xz
qemu-img resize -f raw ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img + 25G
Now you need some firmware and a kernel for risc V which can be downloaded from here
https://github.com/riscv-software-src/opensbi
Download the latest opensbi release and grab the files you need
cp opensbi-1.0-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.elf fw_jump.elf
Download a uboot deb so you can pull out uboot.elf
http://ftp.us.debian.org/debian/pool/main/u/u-boot/
u-boot-qemu_2022.04+dfsg-2_all.deb - is what I choose
expand it
ar -x u-boot-qemu_2022.04+dfsg-2_all.deb
xz -dk data.tar.xz
tar xvf data.tar
cp usr/lib/u-boot/qemu-riscv64_smode/uboot.elf uboot.elf
OK ready to roll
qemu-system-riscv64 -machine virt -m 4096 -smp 4 -bios fw_jump.elf -kernel uboot.elf -device virtio-net-device,netdev=eth0 -netdev user,id=eth0 -drive file=ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio -cpu rv64
username ubuntu
password ubuntu
@cconstab
Copy link
Author

cconstab commented Aug 8, 2022

Theo, sorry for being so tardy getting back to you..., I will have a re run through the Gist and update with answers this week... Been very busy with one of my other projects at https://github.com/atsign-foundation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment