Skip to content

Instantly share code, notes, and snippets.

@tanb
Last active June 10, 2017 06:37
Show Gist options
  • Save tanb/339f2ffb59281812d766 to your computer and use it in GitHub Desktop.
Save tanb/339f2ffb59281812d766 to your computer and use it in GitHub Desktop.
NextBSD running on xhyve.

NextBSD Running on Xhyve.

  _   _           _   ____ ____  ____
 | \ | | _____  _| |_| __ ) ___||  _ \
 |  \| |/ _ \ \/ / __|  _ \___ \| | | |
 | |\  |  __/>  <| |_| |_) |__) | |_| |
 |_| \_|\___/_/\_\\__|____/____/|____/

                                              ```                        `
                                             s` `.....---.......--.```   -/
 +============Welcome to NextBSD===========+ +o   .--`         /y:`      +.
 |                                         |  yo`:.            :o      `+-
 |  1. Boot Multi User [Enter]             |   y/               -/`   -o/
 |  2. Boot [S]ingle User                  |  .-                  ::/sy+:.
 |  3. [Esc]ape to loader prompt           |  /                     `--  /
 |  4. Reboot                              | `:                          :`
 |                                         | `:                          :`
 |  Options:                               |  /                          /
 |  5. [K]ernel: kernel (1 of 2)           |  .-                        -.
 |  6. Configure Boot [O]ptions...         |   --                      -.
 |                                         |    `:`                  `:`
 |                                         |      .--             `--.
 |                                         |         .---.....----.
 +=========================================+¯

Requisites

$ brew install xhyve --HEAD

Instsall and Run NextBSD

Almost same as FreeBSD installation(tanb/xhyve-freebsd-tutorial).

Download NextBSD installer from build.nextbsd.org.

$ ls
disc1-201509240301.iso

Create image file.

$ mkfile 5g fbsdx.img

Create installer script(xhyverun-nbsdinstall.sh).

#!/bin/sh

UUID="-U deaddead-dead-dead-dead-deaddeaddead"

USERBOOT="/Library/Caches/Homebrew/xhyve--git/test/userboot.so"
BOOTVOLUME="disc1-201509240301.iso"
IMG="fbsdx.img"
KERNELENV=""

MEM="-m 2G"
SMP="-c 2"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3:0,ahci-cd,$BOOTVOLUME"
IMG_HDD="-s 4:0,virtio-blk,$IMG"
LPC_DEV="-l com1,stdio"
ACPI="-A"

xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f fbsd,$USERBOOT,$BOOTVOLUME,"$KERNELENV"

Run the script.

$ sudo xhyverun-nbsdinstall.sh

After finishing installation,

Create run script(xhyverun-fbsdx.sh).

#!/bin/sh

UUID="-U deaddead-dead-dead-dead-deaddeaddead"

USERBOOT="/Library/Caches/Homebrew/xhyve--git/test/userboot.so"
BOOTVOLUME="fbsdx.img"

KERNELENV=""

MEM="-m 2G"
SMP="-c 2"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
NET="-s 2:0,virtio-net"

IMG_HDD="-s 4:0,virtio-blk,$BOOTVOLUME"
LPC_DEV="-l com1,stdio"
ACPI="-A"

xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_HDD $UUID -f fbsd,$USERBOOT,$BOOTVOLUME,"$KERNELENV"

Run the scrpit.

$ sudo xhyverun-fbsdx.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment