67 lines
1.6 KiB
Bash
Executable File
67 lines
1.6 KiB
Bash
Executable File
#!/usr/local/bin/bash
|
||
|
||
# Copyright (c) 2018-2021, diyIT.org
|
||
# All rights reserved.
|
||
#
|
||
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
|
||
# https://diyit.org/license/
|
||
#
|
||
#
|
||
|
||
# ./w2019.sh under tmux
|
||
|
||
# clean cached state
|
||
bhyvectl --destroy --vm=w2019
|
||
|
||
while true
|
||
do
|
||
|
||
bhyve -c sockets=1,cores=2,threads=2 -m 16G -S -A -H -P \
|
||
-s 0,hostbridge \
|
||
-s 4,ahci-hd,/dev/zvol/ship/raw/w2019,sectorsize=512 \
|
||
-s 5,virtio-net,tap84,mac=00:0A:0B:0C:0D:84 \
|
||
-s 6,ahci-hd,/dev/zvol/ship/raw/w2019_data,sectorsize=512 \
|
||
-s 29,fbuf,tcp=0.0.0.0:5984,w=1600,h=900 \
|
||
-s 30,xhci,tablet \
|
||
-s 31,lpc -l com1,/dev/nmdm84A \
|
||
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
|
||
w2019
|
||
|
||
bhyve_exit=$?
|
||
# bhyve returns the following status codes:
|
||
# 0 - VM has been reset
|
||
# 1 - VM has been powered off
|
||
# 2 - VM has been halted
|
||
# 3 - VM generated a triple fault
|
||
# all other non-zero status codes are errors
|
||
#
|
||
if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ]
|
||
then
|
||
break
|
||
fi
|
||
echo `date` - restarting w2019 in 5 seconds - press ctrl-c to stop
|
||
sleep 5
|
||
|
||
done
|
||
|
||
exit $?
|
||
|
||
# -s 3,ahci,cd:/mnt/windows/w2019.iso,cd:/mnt/windows/virtio-win.iso \
|
||
# mounting the USB HDD as an attached drive to the system
|
||
#-s 3,ahci,cd:/mnt/windows/w2019.iso,cd:/mnt/windows/virtio-win.iso,hd:/dev/daXp2 \
|
||
# daX being an NTFS drive
|
||
|
||
# bhyvectl --get-all --vm=w2109
|
||
|
||
# cu -l /dev/nmdm84B
|
||
# (This uses cu() so press ~+Ctrl-D to exit)
|
||
|
||
#on base system:
|
||
#zfs create -V 32G -o refreservation=none ship/raw/w2109
|
||
#zfs create -V 128G -o refreservation=none ship/raw/w2019_data
|
||
# on boot
|
||
#ifconfig tap84 create
|
||
#ifconfig bridge1 addm tap84 up
|
||
#ifconfig tap84 up
|
||
#ifconfig tap84 inet6 auto_linklocal
|