From 6684c5e8c6859db1db9134a56d073beebe3dac95 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 5 Sep 2022 16:41:54 +0100 Subject: [PATCH] Add script to start UEFI bhyve VM --- roles/home-cli/files/bhyve-vm | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 roles/home-cli/files/bhyve-vm diff --git a/roles/home-cli/files/bhyve-vm b/roles/home-cli/files/bhyve-vm new file mode 100755 index 0000000..28a7430 --- /dev/null +++ b/roles/home-cli/files/bhyve-vm @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright 2022 Anthony Perkins +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +vmname=$(basename $0) +vmpath=$(dirname $0) +cpucores=1 +ram=1G +vncport=0 # Default VNC port is 5900. +comoutput=stdio # Change to /dev/nmdm0A for the first null-modem. + +cdrom="-s 3,ahci-cd,$vmpath/$vmname/install.iso" # Comment out for no CD-ROM. + +/usr/sbin/bhyve \ + -c sockets=1,cores=$cpucores,threads=1 \ + -m $ram \ + -w \ + -H \ + -s 0,hostbridge \ + -s 1,virtio-blk,$vmpath/$vmname/${vmname}0.img \ + -s 2,virtio-net,tap0 \ + ${cdrom:-""} \ + -s 29,fbuf,tcp=localhost:$vncport,w=1024,h=768 \ + -s 30,xhci,tablet \ + -s 31,lpc -l com1,stdio \ + -l com1,$comoutput \ + -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ + $vmname