So...
pkg install bhyve-firmware uefi-edk2-bhyve uefi-edk2-bhyve-csm vm-bhyve
kldload if_bridge if_tap nmdm vmm
echo 'if_bridge_load="YES"' >> /boot/loader.conf
echo 'if_tap_load="YES"' >> /boot/loader.conf
echo 'nmdm_load="YES"' >> /boot/loader.conf
echo 'vmm_load="YES"' >> /boot/loader.conf
echo 'ifconfig_igb1=up' >> /etc/rc.conf.local
sysrc vm_enable="YES"
sysrc vm_dir="zfs:zroot/vms"
sysrc vm_list=""
sysrc vm_delay="5"
zfs create -o mountpoint=/vms zroot/vms
vm init
cp /usr/local/share/examples/vm-bhyve/* /vms/.templates/
vm switch create sw1
vm switch add sw1 igb1
vm iso https://downloads.freepbxdistro.org/ISO/SNG7-FPBX-64bit-1910-2.iso
vm create -t freebpx -s 100G my_server
Modify the vm config file vm configure my_server
:
uefi="yes"
cpu=2
memory=4096M
network0_type="virtio-net"
network0_switch="sw1"
disk0_type="virtio-blk"
disk0_name="disk0.img"
uuid="<your UUID>"
network0_mac="<your MAC>"
vm install my_server SNG7-FPBX-64bit-1910-2.iso
When you're done, make it auto-start:
sysrc vm_list="my_server"
To access it:
vm console my_server
Finally, if you run into an issue where it can't find the UEFI bootloader, here's what I had to do:
-
Start the vm:
vm start my_server
-
Let it fail to the UEFI shell.
-
Type
exit
and selectBoot Maintenance Manager
, thenBoot from file
. -
Navigate to your
grubx64.efi
file and select it.
Probably here:/boot/efi/EFI/centos/grubx64.efi
-
Copy the existing
grubx64.efi
to the location where it's expected:
cp /boot/efi/EFI/centos/grubx64.efi /boot/efi/EFI/BOOT/
You'll likely need to repeat these last steps if the .efi file gets updated.