mirror of
https://github.com/churchers/vm-bhyve.git
synced 2025-12-11 01:10:01 +01:00
Change loader="" to support bhyveload/grub/uefi
Makes some sense as we display "uefi" under "Loader" when listing guests and only one can be set. Old uefi="" setting can still be set to "csm" to choose the csm firmware.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
VERSION=1.3-devel
|
||||
VERSION_INT=103025
|
||||
VERSION_INT=103026
|
||||
VERSION_BSD=$(uname -K)
|
||||
PATH=${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#
|
||||
core::list(){
|
||||
local _name _loader _cpu _our_host
|
||||
local _memory _run _vm _auto _num _uefi _graphics _vnc
|
||||
local _memory _run _vm _auto _num _graphics _vnc
|
||||
local _format="%s^%s^%s^%s^%s^%s^%s^%s\n"
|
||||
|
||||
_our_host=$(hostname)
|
||||
@@ -51,12 +51,8 @@ core::list(){
|
||||
config::get "_loader" "loader" "none"
|
||||
config::get "_cpu" "cpu"
|
||||
config::get "_memory" "memory"
|
||||
config::get "_uefi" "uefi"
|
||||
config::get "_graphics" "graphics"
|
||||
|
||||
# show uefi in loader column if it's a uefi guest
|
||||
util::checkyesno "${_uefi}" && _loader="uefi"
|
||||
|
||||
# defaults
|
||||
_vnc="-"
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ info::guest_show(){
|
||||
# basic guest configuration
|
||||
info::__output_config "loader" "" "none"
|
||||
info::__output_config "uuid" "" "auto"
|
||||
info::__output_config "uefi" "" "no"
|
||||
info::__output_config "uefi" "" "default"
|
||||
info::__output_config "cpu"
|
||||
|
||||
# check for a cpu topology
|
||||
|
||||
46
lib/vm-run
46
lib/vm-run
@@ -56,7 +56,7 @@ vm::run(){
|
||||
config::get "_loader" "loader"
|
||||
config::get "_bootdisk" "disk0_name"
|
||||
config::get "_bootdisk_dev" "disk0_dev" "file"
|
||||
config::get "_uefi" "uefi" "no"
|
||||
config::get "_uefi" "uefi"
|
||||
config::get "_hostbridge" "hostbridge" "standard"
|
||||
config::get "_comports" "comports" "com1"
|
||||
config::get "_uuid" "uuid"
|
||||
@@ -74,13 +74,16 @@ vm::run(){
|
||||
config::set "${_name}" "uuid" "${_uuid}"
|
||||
fi
|
||||
|
||||
# get cpu topology
|
||||
vm::__cpu "_cpu"
|
||||
|
||||
# old uefi flag just sets loader="uefi"
|
||||
util::checkyesno "${_uefi}" && _loader="uefi"
|
||||
|
||||
util::log_rotate "guest" "${_name}"
|
||||
util::log "guest" "${_name}" \
|
||||
"initialising" \
|
||||
" [loader: ${_loader:-none}]" \
|
||||
" [uefi: ${_uefi}]" \
|
||||
" [loader: ${_loader}]" \
|
||||
" [cpu: ${_cpu}]" \
|
||||
" [memory: ${_memory}]" \
|
||||
" [hostbridge: ${_hostbridge}]" \
|
||||
@@ -92,7 +95,7 @@ vm::run(){
|
||||
" [primary disk dev: ${_bootdisk_dev}]"
|
||||
|
||||
# check basic settings
|
||||
if [ -z "${_cpu}" -o -z "${_memory}" -o -z "${_bootdisk}" ]; then
|
||||
if [ -z "${_loader}" -o -z "${_cpu}" -o -z "${_memory}" -o -z "${_bootdisk}" ]; then
|
||||
util::log "guest" "${_name}" "fatal; unable to start - missing required configuration"
|
||||
exit 15
|
||||
fi
|
||||
@@ -120,7 +123,7 @@ vm::run(){
|
||||
util::checkyesno "${_ignore_msr}" && _opts="${_opts}w"
|
||||
|
||||
# if uefi, make sure we have bootrom, then update options for uefi support
|
||||
if util::checkyesno "${_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
|
||||
@@ -128,32 +131,23 @@ vm::run(){
|
||||
|
||||
case "${_uefi}" in
|
||||
csm)
|
||||
_bootrom="BHYVE_UEFI_CSM.fd"
|
||||
;&
|
||||
_bootrom="/usr/local/share/uefi-firmware/BHYVE_UEFI_CSM.fd"
|
||||
;;
|
||||
*)
|
||||
[ -z "${_bootrom}" ] && _bootrom="BHYVE_UEFI.fd"
|
||||
|
||||
# look in sysutils/uefi-edk2-bhyve install location and our own .config dir
|
||||
if [ -e "${vm_dir}/.config/${_bootrom}" ]; then
|
||||
_bootrom="${vm_dir}/.config/${_bootrom}"
|
||||
elif [ -e "/usr/local/share/uefi-firmware/${_bootrom}" ]; then
|
||||
_bootrom="/usr/local/share/uefi-firmware/${_bootrom}"
|
||||
else
|
||||
util::log "guest" "${_name}" "fatal; unable to locate relevant uefi firmware"
|
||||
exit 15
|
||||
fi
|
||||
|
||||
_opts="-Hwl bootrom,${_bootrom}"
|
||||
_bootrom="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd"
|
||||
_uefi="yes"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
_uefi=""
|
||||
|
||||
# we must have a loader
|
||||
if [ -z "${_loader}" ]; then
|
||||
util::log "guest" "${_name}" "fatal; guest does not have a loader specified"
|
||||
if [ ! -e "${_bootrom}" ]; then
|
||||
util::log "guest" "${_name}" "fatal; unable to locate firmware ${_bootrom}"
|
||||
exit 15
|
||||
fi
|
||||
|
||||
_opts="-Hwl bootrom,${_bootrom}"
|
||||
else
|
||||
# make sure uefi is unset as it affects various functions
|
||||
_uefi=""
|
||||
fi
|
||||
|
||||
# add any custom bhyve options
|
||||
@@ -244,7 +238,7 @@ vm::run(){
|
||||
[ "${_run}" -eq "2" ] && vm::bhyve_device_fbuf_clear_wait
|
||||
|
||||
# load guest
|
||||
if [ -n "${_loader}" ]; then
|
||||
if [ -z "${_uefi}" ]; then
|
||||
guest::load "${_iso}"
|
||||
_exit=$?
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
uefi="yes"
|
||||
loader="uefi"
|
||||
graphics="yes"
|
||||
xhci_mouse="yes"
|
||||
cpu=1
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# If the guest you are using requires either bhyveload or grub-bhyve,
|
||||
# specify the loader to use here.
|
||||
#
|
||||
# Valid Options: bhyveload,grub
|
||||
# Valid Options: bhyveload,grub,uefi
|
||||
#
|
||||
loader=""
|
||||
|
||||
@@ -35,15 +35,11 @@ bhyveload_loader=""
|
||||
loader_timeout="3"
|
||||
|
||||
# uefi
|
||||
# Tells bhyve that it should load the UEFI firmware. To use UEFI
|
||||
# this can be any value other than [empty]/off/false/no/0. If
|
||||
# it contains the string 'csm', the UEFI BIOS compatability (CSM)
|
||||
# firmware will be used.
|
||||
#
|
||||
# Please note when using UEFI firmware, no loader is required
|
||||
# regardless of the guest operating system.
|
||||
# When using a UEFI loader, this can be used to specify the CSM firmware
|
||||
# should be used instead of the default.
|
||||
#
|
||||
# Default: no
|
||||
# Valid Options: csm
|
||||
#
|
||||
uefi=""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#loader="grub"
|
||||
|
||||
# Use UEFI when booting from a disk
|
||||
uefi="yes"
|
||||
loader="uefi"
|
||||
|
||||
cpu=1
|
||||
memory=1024M
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# DragonFly 4.6 and later can boot with UEFI. The Dragonfly installer works
|
||||
# with UEFI beginning at 4.8
|
||||
uefi="yes"
|
||||
loader="uefi"
|
||||
# The live CD has a serial console, but the installer requires graphics
|
||||
graphics="yes"
|
||||
cpu=1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
uefi="yes"
|
||||
loader="uefi"
|
||||
graphics="yes"
|
||||
xhci_mouse="yes"
|
||||
cpu=2
|
||||
|
||||
30
vm.8
30
vm.8
@@ -990,22 +990,12 @@ The settings for each guest are stored in
|
||||
An overview of the available configuration options is listed below.
|
||||
.Bl -tag -width 17n
|
||||
.It loader
|
||||
Windows, Linux &
|
||||
.Fx
|
||||
guests will use the correct loader by default.
|
||||
For other guests that require a loader to be used, this can set to
|
||||
.Sy bhyveload
|
||||
This option sets the loader to use for a guest and must be specified.
|
||||
The valid options are
|
||||
.Sy bhyveload ,
|
||||
.Sy grub ,
|
||||
or
|
||||
.Sy grub .
|
||||
As an example,
|
||||
.Nx
|
||||
&
|
||||
.Ox
|
||||
can be supported by using the
|
||||
.Sy generic
|
||||
guest type, and specifying the
|
||||
.Sy grub
|
||||
loader.
|
||||
.Sy uefi .
|
||||
.It bhyveload_loader
|
||||
This option allows a custom path to be used for the loader inside the guest.
|
||||
Passed to
|
||||
@@ -1024,13 +1014,11 @@ 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
|
||||
Set this (any non-empty value) for guests that need UEFI firmware.
|
||||
If set to
|
||||
This option can be used to choose the UEFI firmware to use. The only applicable
|
||||
value here is
|
||||
.Sy csm ,
|
||||
the BIOS compatibility UEFI-CSM firmware will be used.
|
||||
.It cpu
|
||||
A numeric value specifying the number of virtual CPU cores to assign to the
|
||||
guest.
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user