====== bhyve UEFI ======
The bhyve hypervisor supports Unified Extensible Firmware Interface Graphics Output Protocol or "UEFI-GOP" in %%FreeBSD%% 11 (added in -CURRENT revision [[https://svnweb.freebsd.org/base?view=revision&sortby=date&revision=302332|r302332]])
===== Retrieve the Firmware Binary =====
pkg install bhyve-firmware
===== Hypervisor, Network and Storage Preparation =====
Modify to suit your system, particularly with regard to the hardware network device (example is em0):
kldload vmm
ifconfig tap0 create up
ifconfig bridge0 create up
ifconfig bridge0 addm em0
ifconfig bridge0 addm tap0
truncate -s 5G disk.img
===== Boot a Virtual Machine =====
bhyve -c 2 -m 4G -w -H \
-s 0,hostbridge \
-s 3,ahci-cd,/path/to/uefi-OS-install.iso \
-s 4,ahci-hd,disk.img \
-s 5,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \
-s 30,xhci,tablet \
-s 31,lpc -l com1,stdio \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
vm0
This will create a virtual machine with 4GB of RAM with a display resolution of 800 by 600 that can be accessed via VNC at: ''%%0.0.0.0:5900%%''
Arbitrary resolutions are not yet supported. In the meantime, available resolutions are:
1920 x 1200
1920 x 1080
1600 x 1200
1600 x 900
1280 x 1024
1280 x 720
1024 x 768
800 x 600
640 x 480
Specifying an unsupported resolution will result in UEFI falling back to 800x600.
The ''%%fbuf wait%%'' parameter instructs bhyve to only boot upon the initiation of a VNC connection, simplifying the installation of operating systems that require immediate keyboard input. This can be removed for post-installation use.
The ''%%xhci,tablet%%'' parameter provides precise cursor synchronization when using VNC, but is not supported by %%FreeBSD%%.
Desktop versions of Microsoft Windows require the presence of a CD/DVD device, which can be an empty file created with ''%%touch(1)%%''.
''%%bhyveload%%'' and ''%%sysutils/grub2-bhyve%%'' are not required for UEFI.
For %%FreeBSD%% 12.0 or newer guests, the default setting has changed for console output in the boot loader (boot_serial="YES"). For the %%FreeBSD%% installer to work correctly, hit **3** at the boot menu, allowing you to drop to the **OK** prompt. Set the ''%%boot_serial%%'' environment variable:
''%%set boot_serial=NO%%''
Then issue ''%%boot%%'' to continue with the install. Once the install has completed, ensure that you set ''%%boot_serial="NO"%%'' in the ''%%/boot/loader.conf%%'' file to allow post to display on the UEFI console on each boot.
This has been tested with %%FreeBSD%%/UEFI, %%OpenBSD%%/UEFI ([[bhyve/OpenBSD]]), popular GNU/Linux distributions and various versions of Microsoft Windows Desktop and Server on %%FreeBSD%% the 11-CURRENT r300097 snapshot.
----
[[/CategoryHowTo|CategoryHowTo]] [[/CategoryVirtualization]]