2020-06-01 11:02:23 -07:00
|
|
|
|
#!/usr/local/bin/bash
|
|
|
|
|
|
2021-02-13 11:38:38 -08:00
|
|
|
|
# Copyright (c) 2018-2021, diyIT.org
|
2020-02-25 11:28:31 -08:00
|
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
|
|
|
|
|
# https://diyit.org/license/
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# ./r-windows.sh under tmux
|
|
|
|
|
|
2021-04-01 01:23:14 -07:00
|
|
|
|
# disabled for now
|
|
|
|
|
exit
|
|
|
|
|
|
2020-02-25 11:28:31 -08:00
|
|
|
|
# clean cached state
|
|
|
|
|
bhyvectl --destroy --vm=r-windows
|
|
|
|
|
|
|
|
|
|
while true
|
|
|
|
|
do
|
|
|
|
|
|
2021-04-01 01:23:14 -07:00
|
|
|
|
bhyve -c sockets=1,cores=2,threads=2 -m 8G -S -A -H -P \
|
2020-02-25 11:28:31 -08:00
|
|
|
|
-s 0,hostbridge \
|
2020-06-11 12:02:40 -07:00
|
|
|
|
-s 4,ahci-hd,/dev/zvol/ship/raw/r-windows,sectorsize=512 \
|
|
|
|
|
-s 5,virtio-net,tap85,mac=00:0A:0B:0C:0D:85 \
|
|
|
|
|
-s 6,ahci-hd,/dev/zvol/ship/raw/r-windows_data,sectorsize=512 \
|
|
|
|
|
-s 29,fbuf,tcp=0.0.0.0:5985,w=1600,h=900 \
|
2020-02-25 11:28:31 -08:00
|
|
|
|
-s 30,xhci,tablet \
|
2020-06-11 12:02:40 -07:00
|
|
|
|
-s 31,lpc -l com1,/dev/nmdm85A \
|
2020-02-25 11:28:31 -08:00
|
|
|
|
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
|
|
|
|
|
r-windows
|
|
|
|
|
|
|
|
|
|
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 r-windows in 5 seconds - press ctrl-c to stop
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
exit $?
|
|
|
|
|
|
|
|
|
|
# -s 3,ahci,cd:/mnt/windows/w10.iso,cd:/mnt/windows/virtio-win.iso \
|
|
|
|
|
# mounting the USB HDD as an attached drive to the system
|
2020-04-11 00:46:09 -07:00
|
|
|
|
#-s 3,ahci,cd:/mnt/windows/w10.iso,cd:/mnt/windows/virtio-win.iso,hd:/dev/daXp2 \
|
|
|
|
|
# daX being an NTFS drive
|
2020-02-25 11:28:31 -08:00
|
|
|
|
|
|
|
|
|
# bhyvectl --get-all --vm=r-windows
|
|
|
|
|
|
2020-06-11 12:02:40 -07:00
|
|
|
|
# cu -l /dev/nmdm85B
|
2020-02-25 11:28:31 -08:00
|
|
|
|
# (This uses cu() so press ~+Ctrl-D to exit)
|
|
|
|
|
|
|
|
|
|
#on base system:
|
|
|
|
|
#zfs create -V 32G -o refreservation=none ship/raw/r-windows
|
2020-06-11 12:02:40 -07:00
|
|
|
|
#zfs create -V 256G -o refreservation=none ship/raw/r-windows_data
|
2020-02-25 11:28:31 -08:00
|
|
|
|
# on boot
|
2020-06-11 12:02:40 -07:00
|
|
|
|
#ifconfig tap85 create
|
|
|
|
|
#ifconfig bridge1 addm tap85 up
|
|
|
|
|
#ifconfig tap85 up
|
|
|
|
|
#ifconfig tap85 inet6 auto_linklocal
|