Remove uefi setting entirely and use loader=bhyveload/grub/uefi/uefi-csm

This provides a single, consistent way to configure boot method. the guest listing
now shows uefi and uefi-csm guests without having to fudge the uefi setting into loader column.
This commit is contained in:
Matt Churchyard
2018-10-09 10:34:25 +01:00
parent 0cf424198c
commit edbcf6eed3
5 changed files with 31 additions and 29 deletions

View File

@@ -25,7 +25,7 @@
# POSSIBILITY OF SUCH DAMAGE.
VERSION=1.3-devel
VERSION_INT=103027
VERSION_INT=103028
VERSION_BSD=$(uname -K)
PATH=${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

View File

@@ -77,8 +77,14 @@ vm::run(){
# get cpu topology
vm::__cpu "_cpu"
# old uefi flag just sets loader="uefi"
util::checkyesno "${_uefi}" && _loader="uefi"
# check old uefi flag
if util::checkyesno "${_uefi}"; then
if [ "${_uefi}" = "csm" ]; then
_loader="uefi-csm"
else
_loader="uefi"
fi
fi
util::log_rotate "guest" "${_name}"
util::log "guest" "${_name}" \
@@ -123,19 +129,18 @@ vm::run(){
util::checkyesno "${_ignore_msr}" && _opts="${_opts}w"
# if uefi, make sure we have bootrom, then update options for uefi support
if [ "${_loader}" = "uefi" ]; then
if [ "${_loader%-*}" = "uefi" ]; then
if [ ${VERSION_BSD} -lt 1002509 ]; then
util::log "guest" "${_name}" "fatal; uefi guests can only be run on FreeBSD 10.3 or newer"
exit 15
fi
case "${_uefi}" in
csm)
case "${_loader}" in
uefi-csm)
_bootrom="/usr/local/share/uefi-firmware/BHYVE_UEFI_CSM.fd"
;;
*)
_bootrom="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd"
_uefi="yes"
;;
esac
@@ -145,9 +150,9 @@ vm::run(){
fi
_opts="-Hwl bootrom,${_bootrom}"
_uefi="yes"
else
# make sure uefi is unset as it affects various functions
_uefi=""
_uefi="no"
fi
# add any custom bhyve options
@@ -231,7 +236,7 @@ vm::run(){
# use null.iso if not an install and uefi firmware
# old instructions but some windows versions apparently needed this present
[ -z "${_iso}" -a -n "${_uefi}" -a "${_uefi}" != "csm" ] && \
[ -z "${_iso}" -a -n "${_uefi}" -a "${_loader}" != "uefi-csm" ] && \
_iso_dev="-s ${_install_slot}:0,ahci-cd,${vm_dir}/.config/null.iso"
# reasonably ugly hack to remove wait option after first run

View File

@@ -11,10 +11,11 @@
# double-quotes, and so cannot be used inside any values.
# loader
# If the guest you are using requires either bhyveload or grub-bhyve,
# specify the loader to use here.
# Specify the loader to use for the guest. This can either be
# one of the original bhyve loaders (bhyveload/grub), or
# you can specify to use uefi firmware to load the guest
#
# Valid Options: bhyveload,grub,uefi
# Valid Options: bhyveload,grub,uefi,uefi-csm
#
loader=""
@@ -34,15 +35,6 @@ bhyveload_loader=""
#
loader_timeout="3"
# uefi
#
# When using a UEFI loader, this can be used to specify the CSM firmware
# should be used instead of the default.
#
# Valid Options: csm
#
uefi=""
# cpu (required)
# specify the number of cpu cores to give to the guest
#

View File

@@ -3,9 +3,19 @@ graphics="yes"
xhci_mouse="yes"
cpu=2
memory=2G
# put up to 8 disks on a single ahci controller.
# without this, adding a disk pushes the following network devices onto higher slot numbers,
# which causes windows to see them as a new interface
ahci_device_limit="8"
# ideally this should be changed to virtio-net and drivers installed in the guest
# e1000 works out-of-the-box
network0_type="e1000"
network0_switch="public"
disk0_type="ahci-hd"
disk0_name="disk0.img"
# windows expects the host to expose localtime by default, not UTC
utctime="no"

9
vm.8
View File

@@ -994,8 +994,9 @@ This option sets the loader to use for a guest and must be specified.
The valid options are
.Sy bhyveload ,
.Sy grub ,
.Sy uefi ,
or
.Sy uefi .
.Sy uefi-csm .
.It bhyveload_loader
This option allows a custom path to be used for the loader inside the guest.
Passed to
@@ -1013,12 +1014,6 @@ If access to the grub console is needed, this can be increased to give more
time to connect to the console.
If access to the grub console is not required, it can also be reduced to speed
up overall boot.
.It uefi
This option can be used to choose the UEFI firmware to use. The only applicable
value here is
.Sy csm ,
which configures the guest to use the firmware that includes traditional BIOS
compatability.
.It cpu_sockets
Specify the number of CPU sockets that should be exposed to the guest. The product
of