Last active
August 29, 2015 14:19
-
-
Save pr1ntf/f5080ecffff1085a1447 to your computer and use it in GitHub Desktop.
bhyve notepad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires tap interface networking !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# https://www.freebsd.org/doc/en/books/handbook/virtualization-host-bhyve.html !! | |
# requires virtio and vmm kernel mods !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# null modem requires nmdm kernel mod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# if your console session prints 'OK' kill off any /dev/nmdmN(A|B) sessions. !!!! | |
# create new disk | |
truncate -s 16G butts.img | |
# nullmodem loader | |
bhyveload -m 512M -d butts.img -c /dev/nmdm0A bhyvebutts & | |
# nullmodem linux installer loader | |
grub-bhyve -m device.map -r cd0 -c /dev/nmdm1A -M 512M linux | |
# nullmodem linux loader | |
grub-bhyve -m device.map -r hd0,msdos1 -c /dev/nmdm1A -M 512M linux | |
# GRUB for CentOS [NEED CUSTOM grub.cfg AT BOOT] | |
linux (hd0,msdos1)/vmlinuz-2.6.32-504.el6.x86_64 root=/dev/mapper/VolGroup-lv_root | |
initrd (hd0,msdos1)/initramfs-2.6.32-504.el6.x86_64.img | |
/usr/local/sbin/grub-mkconfig -o /boot/grub/grub.cfg | |
/usr/local/sbin/grub-install /dev/sda | |
mv -v /boot/grub/grub.conf /boot/ (Can be removed too) | |
# nullmodem FreeBSD CD loader | |
bhyveload -m 512M -d ISO/FreeBSD-10.1-RELEASE-amd64-bootonly.iso -c /dev/nmdm0A bhyvebutts & | |
# nullmodem console | |
bhyve -c 1 -A -H -P -m 512M -s0,hostbridge -s1,lpc -s2,virtio-blk,butts.img -s3,virtio-net,tap0 -lcom1,/dev/nmdm0A bhyvebutts & | |
# nullmodem console with FreeBSD CD attached [BROKEN/USE stdio] | |
bhyve -c 1 -A -H -P -m 512M -s0,hostbridge -s1,lpc -s2,virtio-blk,butts.img -s3,virtio-net,tap0 -s4,ahci-cd,ISO/FreeBSD-10.1-RELEASE-amd64-bootonly.iso -lcom1,/dev/nmdm0A bhyvebutts & | |
# call up the remote null console | |
cu -l /dev/nmdm0B -s 9600 | |
# list vms loaded | |
ls -l /dev/vmm | |
# kill it | |
bhyvectl --destroy --vm=bhyvebutts | |
# device.map for grub2-bhyve | |
(hd0) ./linux.img | |
(cd0) ISO/CentOS-6.6-x86_64-netinstall.iso | |
#### Xterm consoles and no console ##### | |
# installer attached xterm | |
bhyveload -m 512M -d ISO/FreeBSD-10.1-RELEASE-amd64-bootonly.iso bhyvebutts | |
bhyve -c 1 -A -H -P -m 512M -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,butts.img -s3,virtio-net,tap0 -s4,ahci-cd,ISO/FreeBSD-10.1-RELEASE-amd64-bootonly.iso -lcom1,stdio bhyvebutts | |
# loader | |
bhyveload -m 512M -d butts.img bhyvebutts | |
# with console over terminal | |
bhyve -c 1 -A -H -P -m 512M -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,butts.img -s3,virtio-net,tap0 -lcom1,stdio bhyvebutts | |
# no console | |
bhyve -c 1 -A -H -P -m 512M -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,butts.img -s3,virtio-net,tap0 bhyvebutts & | |
# l33t haxors [BROKEN NEEDS WAIT I THINK] | |
bhyveload -m 512M -d bhyve1.img bhyvebutts && bhyve -c 1 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,bhyve1.img -s3,virtio-net,tap0 -A -H -P -m 512M bhyvebutts & | |
bhyveload -m 512M -d bhyve1.img -c /dev/nmdm0A bhyvebutts && sleep 15 && bhyve -c 1 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,bhyve1.img -s3,virtio-net,tap0 -A -H -P -m 512M bhyvebutts & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FreeBSD, HardenedBSD, Debian 8, CentOS 6 have been fully tested using these methods. (4-27-15)