Page MenuHomeFreeBSD

D44933.diff
No OneTemporary

D44933.diff

diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh
--- a/share/examples/bhyve/vmrun.sh
+++ b/share/examples/bhyve/vmrun.sh
@@ -72,29 +72,29 @@
echo " -C: console device (default: ${DEFAULT_CONSOLE})"
echo " -d: virtio diskdev file (default: ${DEFAULT_VIRTIO_DISK})"
echo " -e: set FreeBSD loader environment variable"
- echo " -E: Use UEFI mode"
- echo " -f: Use a specific UEFI firmware"
+ echo " -E: Use UEFI mode (amd64 only)"
+ echo " -f: Use a specific boot firmware (e.g., EDK2, U-Boot)"
echo " -F: Use a custom UEFI GOP framebuffer size" \
- "(default: ${DEFAULT_VNCSIZE})"
+ "(default: ${DEFAULT_VNCSIZE}) (amd64 only)"
echo " -G: bind the GDB stub to the specified address"
echo " -H: host filesystem to export to the loader"
echo " -i: force boot of the Installation CDROM image"
echo " -I: Installation CDROM image location" \
"(default: ${DEFAULT_ISOFILE})"
- echo " -l: the OS loader to use (default: /boot/userboot.so)"
+ echo " -l: the OS loader to use (default: /boot/userboot.so) (amd64 only)"
echo " -L: IP address for UEFI GOP VNC server" \
"(default: ${DEFAULT_VNCHOST})"
echo " -m: memory size (default: ${DEFAULT_MEMSIZE})"
echo " -n: network adapter emulation type" \
"(default: ${DEFAULT_NIC})"
echo " -p: pass-through a host PCI device (e.g ppt0 or" \
- "bus/slot/func)"
+ "bus/slot/func) (amd64 only)"
echo " -P: UEFI GOP VNC port (default: ${DEFAULT_VNCPORT})"
echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)"
- echo " -T: Enable tablet device (for UEFI GOP)"
+ echo " -T: Enable tablet device (for UEFI GOP) (amd64 only)"
echo " -u: RTC keeps UTC time"
echo " -v: Wait for VNC client connection before booting VM"
- echo " -w: ignore unimplemented MSRs"
+ echo " -w: ignore unimplemented MSRs (amd64 only)"
echo ""
[ -n "$msg" ] && errmsg "$msg"
exit 1
@@ -111,6 +111,12 @@
exit 1
fi
+platform=$(uname -m)
+if [ "${platform}" != amd64 -a "${platform}" != arm64 ]; then
+ errmsg "This script is only supported on amd64 and arm64 platforms"
+ exit 1
+fi
+
force_install=0
isofile=${DEFAULT_ISOFILE}
memsize=${DEFAULT_MEMSIZE}
@@ -121,7 +127,6 @@
disk_total=0
disk_emulation=${DEFAULT_DISK}
loader_opt=""
-bhyverun_opt="-H -P"
pass_total=0
# EFI-specific options
@@ -133,7 +138,21 @@
vncsize=${DEFAULT_VNCSIZE}
tablet=""
-while getopts aAc:C:d:e:Ef:F:G:hH:iI:l:L:m:n:p:P:t:Tuvw c ; do
+# arm64 only
+uboot_firmware="/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin"
+
+case ${platform} in
+amd64)
+ bhyverun_opt="-H -P"
+ opts="aAc:C:d:e:Ef:F:G:hH:iI:l:L:m:n:p:P:t:Tuvw"
+ ;;
+arm64)
+ bhyverun_opt=""
+ opts="aAc:C:d:e:f:F:G:hH:iI:L:m:n:P:t:uv"
+ ;;
+esac
+
+while getopts $opts c ; do
case $c in
a)
bhyverun_opt="${bhyverun_opt} -a"
@@ -161,7 +180,7 @@
efi_mode=1
;;
f)
- efi_firmware="${OPTARG}"
+ firmware="${OPTARG}"
;;
F)
vncsize="${OPTARG}"
@@ -246,12 +265,25 @@
bhyverun_opt="${bhyverun_opt} -S"
fi
-if [ ${efi_mode} -gt 0 ]; then
- if [ ! -f ${efi_firmware} ]; then
- echo "Error: EFI Firmware ${efi_firmware} doesn't exist." \
- "Try: pkg install edk2-bhyve"
- exit 1
+if [ -z "$firmware" ]; then
+ case ${platform} in
+ amd64)
+ firmware="${efi_firmware}"
+ firmware_pkg="edk2-bhyve"
+ ;;
+ arm64)
+ firmware="${uboot_firmware}"
+ firmware_pkg="u-boot-bhyve-arm64"
+ ;;
+ esac
+fi
+
+if [ -n "${firmware}" -a ! -f "${firmware}" ]; then
+ echo "Error: Firmware file ${firmware} doesn't exist."
+ if [ -n "${firmware_pkg}" ]; then
+ echo " Try: pkg install ${firmware_pkg}"
fi
+ exit 1
fi
make_and_check_diskdev()
@@ -317,7 +349,7 @@
installer_opt=""
fi
- if [ ${efi_mode} -eq 0 ]; then
+ if [ ${platform} = amd64 -a ${efi_mode} -eq 0 ]; then
${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} \
${loader_opt} ${vmname}
bhyve_exit=$?
@@ -329,15 +361,19 @@
#
# Build up args for additional tap and disk devices now.
#
- nextslot=2 # slot 0 is hostbridge, slot 1 is lpc
- devargs="" # accumulate disk/tap args here
- i=0
- while [ $i -lt $tap_total ] ; do
- eval "tapname=\$tap_dev${i}"
- devargs="$devargs -s $nextslot:0,${nic},${tapname} "
- nextslot=$(($nextslot + 1))
- i=$(($i + 1))
- done
+ devargs="-s 0:0,hostbridge" # accumulate disk/tap args here
+ case ${platform} in
+ amd64)
+ console_opt="-l com1,${console}"
+ devargs="$devargs -s 1:0,lpc "
+ nextslot=2 # slot 0 is hostbridge, slot 1 is lpc
+ ;;
+ arm64)
+ console_opt="-o console=${console}"
+ devargs="$devargs -o bootrom=${firmware} "
+ nextslot=1 # slot 0 is hostbridge
+ ;;
+ esac
i=0
while [ $i -lt $disk_total ] ; do
@@ -349,6 +385,14 @@
i=$(($i + 1))
done
+ i=0
+ while [ $i -lt $tap_total ] ; do
+ eval "tapname=\$tap_dev${i}"
+ devargs="$devargs -s $nextslot:0,${nic},${tapname} "
+ nextslot=$(($nextslot + 1))
+ i=$(($i + 1))
+ done
+
i=0
while [ $i -lt $pass_total ] ; do
eval "pass=\$pass_dev${i}"
@@ -372,16 +416,14 @@
if [ ${efi_mode} -gt 0 ]; then
efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport},"
efiargs="${efiargs}${vncsize}${vncwait}"
- efiargs="${efiargs} -l bootrom,${efi_firmware}"
+ efiargs="${efiargs} -l bootrom,${firmware}"
efiargs="${efiargs} ${tablet}"
fi
${FBSDRUN} -c ${cpus} -m ${memsize} ${bhyverun_opt} \
- -s 0:0,hostbridge \
- -s 1:0,lpc \
${efiargs} \
${devargs} \
- -l com1,${console} \
+ ${console_opt} \
${installer_opt} \
${vmname}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 12:41 AM (20 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14687678
Default Alt Text
D44933.diff (5 KB)

Event Timeline