Hosts/BSD
QEMU on BSD hosts
This documentation is not written by a BSD expert - corrections welcome!
QEMU can be built on BSD hosts. At the moment most QEMU developers are Linux users, though, so BSD is not very well supported.
This page includes documentation of how to get the various BSD flavours running in a VM inside QEMU, so that Linux-based developers can do build tests on them. If you're running natively on BSD you can ignore the "VM setup" instructions.
FreeBSD
VM setup
Download and uncompress the official FreeBSD qcow2 image from
https://download.freebsd.org/ftp/releases/VM-IMAGES/11.0-RELEASE/amd64/Latest/
Run the image with:
qemu-system-x86_64 -m 2048 -hda FreeBSD-11.0-RELEASE-amd64.qcow2 -enable-kvm -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7722-:22 -device e1000,netdev=mynet0
(TODO: check virtio works and recommend that instead.)
Enable networking and ssh by adding these lines to /etc/rc.conf:
sshd_enable="YES" ifconfig_em0="DHCP"
Edit /etc/ssh/sshd_config to add
PermitRootLogin prohibit-password
and then reboot the VM or run
service netif restart service sshd start
Copy your ssh public key into the VM's /root/.ssh/authorized_keys
You should now be able to ssh into the VM from outside with
ssh -p 7722 root@localhost
Required packages
Install enough packages to do builds:
pkg update pkg install git pkg install gcc pkg install gmake pkg install python pkg install pkgconf pkg install pixman pkg install bison
This should be enough to configure and build QEMU as you would on Linux:
mkdir build cd build ../configure gmake gmake check
Note that you need to use 'gmake', not plain 'make'.