| @@ -29,24 +29,24 @@ Hope this helps others! | |||
| ## NetBSD | |||
| 1. Install `grub2-bhyve`: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| pkg install grub2-bhyve | |||
| ``` | |||
| </code></pre> | |||
| 2. Create a file called `instdev.map` containing: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| (cd0) NetBSD-6.1.5-amd64.iso | |||
| (hd1) netbsd.img | |||
| ``` | |||
| </code></pre> | |||
| 3. Create the file `netbsd.img` with the correct size: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| truncate -s 3g netbsd.img | |||
| ``` | |||
| </code></pre> | |||
| 4. Run the following commands (or put into a script file) under `sh`: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| MEM=512M | |||
| VM=nbsd615 | |||
| bhyvectl --destroy --vm=$VM | |||
| grub-bhyve -r cd0 -M $MEM -m instdev.map $VM <<EOF | |||
| grub-bhyve -r cd0 -M $MEM -m instdev.map $VM <<EOF | |||
| knetbsd -h -r cd0a | |||
| (cd0)/netbsdboot | |||
| EOF | |||
| @@ -54,48 +54,48 @@ Hope this helps others! | |||
| -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./netbsd.img \ | |||
| -s 4:0,ahci-cd,./NetBSD-6.1.5-amd64.iso \ | |||
| -l com1,stdio -c 2 -m $MEM $VM | |||
| ``` | |||
| </code></pre> | |||
| 5. This will run the installer, complete the installation. | |||
| 6. Create a file called `dev.map` containing: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| (hd1) netbsd.img | |||
| ``` | |||
| </code></pre> | |||
| 7. Now in the future, to run NetBSD from the image, run the following commands: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| MEM=512M | |||
| VM=nbsd615 | |||
| bhyvectl --destroy --vm=$VM | |||
| grub-bhyve -r cd0 -M $MEM -m dev.map $VM <<EOF | |||
| grub-bhyve -r cd0 -M $MEM -m dev.map $VM <<EOF | |||
| knetbsd -h -r ld0a | |||
| (hd1,msdos1)/netbsdboot | |||
| EOF | |||
| bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc \ | |||
| -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./netbsd.img \ | |||
| -l com1,stdio -c 2 -m $MEM $VM | |||
| ``` | |||
| </code></pre> | |||
| 8. Profit! | |||
| ## OpenBSD | |||
| 1. Install `grub2-bhyve`: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| pkg install grub2-bhyve | |||
| ``` | |||
| </code></pre> | |||
| 2. Create a file called `instdev.map` containing: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| (cd0) install57.iso | |||
| (hd1) openbsd.img | |||
| ``` | |||
| </code></pre> | |||
| 3. Create the file `openbsd.img` with the correct size: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| truncate -s 3g openbsd.img | |||
| ``` | |||
| </code></pre> | |||
| 4. Run the following commands (or put into a script file) under `sh`: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| MEM=512M | |||
| VM=obsd57 | |||
| bhyvectl --destroy --vm=$VM | |||
| grub-bhyve -r cd0 -M $MEM -m instdev.map $VM <<EOF | |||
| grub-bhyve -r cd0 -M $MEM -m instdev.map $VM <<EOF | |||
| kopenbsd -h com0 | |||
| (cd0)/5.7/amd64/bsd.rdboot | |||
| EOF | |||
| @@ -103,17 +103,18 @@ Hope this helps others! | |||
| -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./openbsd.img \ | |||
| -s 4:0,ahci-cd,./install57.iso \ | |||
| -l com1,stdio -c 2 -m $MEM $VM | |||
| </code></pre> | |||
| 5. This will run the installer, complete the installation. | |||
| 6. Create a file called `dev.map` containing: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| (hd1) netbsd.img | |||
| ``` | |||
| </code></pre> | |||
| 7. Now in the future, to run OpenBSD from the image, run the following commands: | |||
| ``` | |||
| <pre class="fullwidth"><code> | |||
| MEM=512M | |||
| VM=obsd57 | |||
| bhyvectl --destroy --vm=$VM | |||
| grub-bhyve -r hd1 -M $MEM -m dev.map $VM <<EOF | |||
| grub-bhyve -r hd1 -M $MEM -m dev.map $VM <<EOF | |||
| kopenbsd -h com0 -r sd0a | |||
| (hd1,openbsd1)/bsdboot | |||
| EOF | |||
| @@ -121,4 +122,5 @@ Hope this helps others! | |||
| -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./openbsd.img \ | |||
| -s 4:0,ahci-cd,./install57.iso \ | |||
| -l com1,stdio -c 2 -m $MEM $VM | |||
| </code></pre> | |||
| 8. Profit! | |||