Required ports:

sysutils/bhyve-firmware

sysutils/uefi-edk2-bhyve

sysutils/uefi-edk2-bhyve-csm

net/tigervnc-viewer

Add the following lines to /etc/rc.conf. Replace re0 with your own network interface. It's good practice to assign each VM a unique tap interface in case you need to run multiple VMs at the same time. For simplicity's sake, this setup uses only one tap:

 if_bridge_load="YES"
 if_tap_load="YES"
 cloned_interfaces="bridge0 tap0"
 ifconfig_bridge0="DHCP addm re0 addm tap0"
 ifconfig_bridge0_alias0="inet 10.0.0.1/24"

Reboot your machine and then grab a 9front ISO.

Make a directory where you'll store everything 9front-related. I usually keep all my bhyve(8) VMs under a ZFS dataset:

$ cd /path/to/vms/
$ mkdir 9front
$ mv /path/to/9front_iso 9front.iso

Create an empty file to be used as the VM's hard drive. 10G will be more than enough:

$ truncate -s 10G disk.img

Make a startup script. Feel free to tweak the variable values to match your own setup. Obviously, when you're done installing 9front from the ISO, you'll be running the script without the -s 3,... line:

name="9front"
cpu="2"
mem="2G"
iso="9front.iso"
disk="disk.img"
tap="tap0"

ifconfig ${tap} up

bhyve -c ${cpu} -m ${mem} -wH \
        -s 0,hostbridge \
        -s 3,ahci-cd,${iso} \
        -s 4,ahci-hd,${disk} \
        -s 5,virtio-net,${tap} \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \
        -s 30,xhci,tablet \
        -s 31,lpc \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        ${name}

Make a shutdown script in order for bhyve(8) to close properly:

name="9front"
tap="tap0"

ifconfig ${tap} down
bhyvectl --force-poweroff --vm=${name}
bhyvectl --destroy --vm=${name}

Make the scripts executable and start the VM:

$ chmod +x 9front_start 9front_stop
# ./9front_start; ./9front_stop

Run vncviewer(1) to connect to the VNC display:

$ vncviewer 0.0.0.0

When prompted for the monitor type during boot, choose xga.

bhyve/9front (last edited 2021-11-23T02:51:07+0000 by ChristosMargiolis)