workstation/roles/home-cli/files/bhyve-vm

41 lines
1.2 KiB
Text
Raw Normal View History

2022-09-05 15:41:54 +00:00
#!/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