Skip to content

Instantly share code, notes, and snippets.

@jkuri
Forked from rkusa/README
Created October 20, 2017 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkuri/120e6dd7faeab10c9734083f89f95251 to your computer and use it in GitHub Desktop.
Save jkuri/120e6dd7faeab10c9734083f89f95251 to your computer and use it in GitHub Desktop.
Install alpine linux on xhyve VM
# curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.1-x86_64.iso
curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86/alpine-3.3.1-x86.iso
# create hdd image (8GB)
dd if=/dev/zero of=hdd.img bs=1g count=8
# extract kernel and initramfs
brew install cdrtools
isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/initramfs-grsec > initramfs-grsec
isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/vmlinuz-grsec > vmlinuz-grsec
sudo ./install.sh
# login: root (no password)
setup-alpine # follow instructions
mkdir /mnt/vda1
mount -t ext4 /dev/vda1 /mnt/vda1
cat /mnt/vda1/extlinux.conf | grep APPEND
# e.g. result:
# APPEND root=UUID=19023208-f0f5-4c34-b27c-9f011ba78c5e modules=sd-mod,usb-storage,ext4 quiet
halt
# replace {UUID} in run.sh with UUID from above
sudo ./run.sh
#!/bin/sh
# Linux
KERNEL="vmlinuz-grsec"
INITRD="initramfs-grsec"
CMDLINE="modules=sd-mod,ext4,console quiet console=ttyS0"
MEM="-m 1G"
#SMP="-c 2"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3,ahci-cd,alpine-3.3.1-x86.iso"
IMG_HDD="-s 4,virtio-blk,hdd.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
ACPI="-A"
# UUID="-U deadbeef-dead-dead-dead-deaddeafbeef"
# Linux
xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,"$CMDLINE"
#!/bin/sh
# Linux
KERNEL="vmlinuz-grsec"
INITRD="initramfs-grsec"
CMDLINE="root=UUID={UUID} modules=sd-mod,ext4,console quiet console=ttyS0 acpi=on"
MEM="-m 1G"
#SMP="-c 2"
NET="-s 2:0,virtio-net"
# IMG_CD="-s 3,ahci-cd,alpine-3.3.1-x86.iso"
IMG_HDD="-s 4,virtio-blk,hdd.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
ACPI="-A"
# UUID="-U deadbeef-dead-dead-dead-deaddeafbeef"
# Linux
xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,"$CMDLINE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment