Created
June 5, 2022 02:00
-
-
Save mengzhuo/6ae7d7a727c271c076f2f72afe5772b1 to your computer and use it in GitHub Desktop.
qemu-riscv-freebsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install required packages | |
sudo pkg install opensbi u-boot-qemu-riscv64 qemu | |
Note: emulators/qemu-devel also works. | |
Download FreeBSD/RISC-V virtual machine image | |
fetch https://download.freebsd.org/ftp/snapshots/VM-IMAGES/14.0-CURRENT/riscv64/Latest/FreeBSD-14.0-CURRENT-riscv-riscv64.raw.xz | |
xz --decompress FreeBSD-14.0-CURRENT-riscv-riscv64.raw.xz | |
Optionally, extend the image using truncate(1). The root filesystem will grow to fill the free space upon first boot. | |
truncate -s 10G FreeBSD-14.0-CURRENT-riscv-riscv64.raw | |
Boot image in QEMU | |
Spawn a VM with 2 CPUs and 2GB of memory: | |
qemu-system-riscv64 -machine virt -m 2048M -smp 2 -nographic \ | |
-bios /usr/local/share/opensbi/lp64/generic/firmware/fw_jump.elf \ | |
-kernel /usr/local/share/u-boot/u-boot-qemu-riscv64/u-boot.bin \ | |
-drive file=FreeBSD-14.0-CURRENT-riscv-riscv64.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \ | |
-netdev user,id=net0,ipv6=off,hostfwd=tcp::8022-:22 -device virtio-net-device,netdev=net0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment