Skip to content

install and alpine virt 3.7 in xhyve

Eric Hao edited this page Feb 4, 2018 · 1 revision
  1. run latest alpine in the xhyve
  1. install the xhyve
    follow the instruction to install the xhyve from xhyve.org
    or brew install —HEAD xhyve
  1. download the alpine from the alpinelinux.org
    you may find the your fast mirrors near you, I prefer the virt version of the image.

curl -LO http://dl-3.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-virt-3.7.0-x86_64.iso

  1. extract the kernel from the images
    extract kernel and initramfs
    brew install cdrtools
    isoinfo -i alpine-virt-3.7.0-x86_64.iso -J -x /boot/initramfs-* > initramfs
    isoinfo -i alpine-virt-3.7.0-x86_64.iso -J -x /boot/vmlinuz-* > vmlinuz
  1. boot to install
    sudo install.sh
    login as root
    prepare the harddisk
    setup-alpine
    follow the install process
    finish…
    And hold on,
    we need grap the uuid from the environment

`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

  1. replace {UUID} in run.sh with UUID from above

`sudo ./run.sh

  1. the install.sh script

#!/bin/sh

  1. Linux
    KERNEL=“vmlinuz”
    INITRD=“initramfs”
    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.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”

  1. UUID=“-U deadbeef-dead-dead-dead-deaddeafbeef”
  1. Linux
    xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,“$CMDLINE

and the run.sh
UUID was grap from the installed boot configuration.

#!/bin/bash
KERNEL=“vmlinuz”
INITRD=“initramfs”
CMDLINE=“root=UUID=6d5a1c0d-366f-418a-a232-fbe8be6968de modules=sd-mod,ext4,console quite console=ttyS0 acpi=on”

MEM=“-m 1G”
NET=“-s 2:0,virtio-net”

  1. CD=“-s 3,ahci-cd,alpine.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 6d5a1c0d-366f-418a-a232-fbe8be6968de”
#Linux
xhyve $ACPI $MEM $PCI_DEV $LPC_DEV $NET $CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,“$CMDLINE

Clone this wiki locally