2020-06-01 11:02:23 -07:00
|
|
|
|
#!/usr/local/bin/bash
|
|
|
|
|
|
2022-04-19 13:46:35 -07:00
|
|
|
|
# Copyright (c) 2018-2022, 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/
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# ./freebsd.sh under tmux
|
|
|
|
|
|
|
|
|
|
# clean cached state
|
|
|
|
|
bhyvectl --destroy --vm=freebsd
|
|
|
|
|
|
|
|
|
|
while true
|
|
|
|
|
do
|
|
|
|
|
|
2021-04-01 01:23:14 -07:00
|
|
|
|
bhyve -c 2 -m 4G -A -H -P \
|
2020-02-25 11:28:31 -08:00
|
|
|
|
-s 0,hostbridge \
|
|
|
|
|
-s 3,ahci-cd \
|
2021-04-17 11:05:38 -07:00
|
|
|
|
-s 4,virtio-blk,/dev/zvol/ship/raw/freebsd_1 \
|
|
|
|
|
-s 5,virtio-blk,/dev/zvol/ship/raw/freebsd_2 \
|
|
|
|
|
-s 6,virtio-blk,/dev/zvol/ship/raw/freebsd_z1 \
|
|
|
|
|
-s 7,virtio-blk,/dev/zvol/ship/raw/freebsd_z2 \
|
|
|
|
|
-s 8,virtio-blk,/dev/zvol/ship/raw/freebsd_z3 \
|
|
|
|
|
-s 9,virtio-blk,/dev/zvol/ship/raw/freebsd \
|
|
|
|
|
-s 10,virtio-net,tap83,mac=00:0A:0B:0C:0D:83 \
|
2020-02-25 11:28:31 -08:00
|
|
|
|
-s 29,fbuf,tcp=0.0.0.0:5983,w=1600,h=900 \
|
|
|
|
|
-s 30,xhci,tablet \
|
|
|
|
|
-s 31,lpc -l com1,/dev/nmdm83A \
|
|
|
|
|
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
|
|
|
|
|
freebsd
|
|
|
|
|
|
|
|
|
|
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 freebsd in 5 seconds - press ctrl-c to stop
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
exit $?
|
|
|
|
|
|
|
|
|
|
#-s 3,ahci-cd \
|
2021-04-17 11:05:38 -07:00
|
|
|
|
#-s 3,ahci-cd,/mnt/freebsd/FreeBSD-12.2-RELEASE-amd64-disc1.iso \
|
2020-02-25 11:28:31 -08:00
|
|
|
|
# set boot_serial=NO
|
|
|
|
|
# first in boot menu option 3 and then /boot/loader.conf after install
|
|
|
|
|
|
|
|
|
|
# bhyvectl --get-all --vm=freebsd
|
|
|
|
|
|
|
|
|
|
# cu -l /dev/nmdm83B
|
|
|
|
|
# (This uses cu() so press ~+Ctrl-D to exit)
|
|
|
|
|
|
|
|
|
|
#on base system:
|
2021-04-18 01:07:42 -07:00
|
|
|
|
#zfs create -V 16G -o refreservation=none ship/raw/freebsd
|
2021-04-17 11:05:38 -07:00
|
|
|
|
#zfs create -V 16G -o refreservation=none ship/raw/freebsd_1
|
|
|
|
|
#zfs create -V 16G -o refreservation=none ship/raw/freebsd_2
|
|
|
|
|
#zfs create -V 16G -o refreservation=none ship/raw/freebsd_z1
|
|
|
|
|
#zfs create -V 16G -o refreservation=none ship/raw/freebsd_z2
|
|
|
|
|
#zfs create -V 16G -o refreservation=none ship/raw/freebsd_z3
|
2020-02-25 11:28:31 -08:00
|
|
|
|
# on boot
|
|
|
|
|
#ifconfig tap83 create
|
|
|
|
|
#ifconfig bridge1 addm tap83 up
|
|
|
|
|
#ifconfig tap83 up
|
|
|
|
|
#ifconfig tap83 inet6 auto_linklocal
|
2021-04-17 11:05:38 -07:00
|
|
|
|
#
|
|
|
|
|
#zroot mirror /dev/vtbd1 /dev/vtbd2 - created during zroot install
|
|
|
|
|
#zpool create -f ship /dev/vtbd2 /dev/vtbd3 /dev/vtbd4
|
|
|
|
|
#zpool create -f data /dev/vtbd5
|