This is an old revision of the document!
This page contains recipes for using qemu to run FreeBSD inside virtual machines (especially non-native virtual machines) on a FreeBSD host. The goal is to have a at least one “blessed” qemu recipe for each architecture FreeBSD supports. For more details on running qemu in general including network configuration, see the qemu page.
For systems installed from an ISO image, the instructions assume you have downloaded an appropriate ISO image from a release or snapshot. When installing a new machine that requires a disk image, you can use truncate(1) to create an empty disk image before installing, for example:
truncate -s 16g /path/to/disk.img
If you wish to boot without a graphical console, add -nographic to the qemu command line.
arm64
An EFI firmware file is required to boot FreeBSD/arm64 in QEMU. Obtain it from http://people.FreeBSD.org/~gjb/QEMU_EFI.fd.
Booting a snapshot disk image
qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt \ -bios QEMU_EFI.fd -serial telnet::4444,server -nographic \ -drive if=none,file=VMDISK,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -device virtio-net-device,id=net0
Then telnet localhost:4444 to connect to the serial console.
powerpc
Note: This does not yet work. Both the default (g3beige) and mac99 machine types hang during boot.
powerpc64
To disable the graphic console, use -nographic -vga none. Note that the default NIC provided by qemu(4) (llan(4)) does not provide media status. As a result, DHCP is not started by devd out of the box. Use SYNCHDHCP in /etc/rc.conf instead of DHCP to enable DHCP on boot.
Install from ISO
qemu-system-ppc64 -cdrom /path/to/disc1.iso -drive file=/path/to/disk.img,format=raw -boot d
Booting Installed System
qemu-system-ppc64 -drive file=/path/to/disk.img,format=raw
sparc64
Note: FreeBSD/sparc64 does not currently boot under current versions of qemu but should boot under qemu 2.6 with -nographic once it is released.
Install from ISO
qemu-system-sparc64 -cdrom /path/to/disc1.iso -drive file=/path/to/disk.img,format=raw -boot d