-
Notifications
You must be signed in to change notification settings - Fork 354
Home
hepengfei edited this page Apr 6, 2016
·
7 revisions
安装仅210K的极小虚拟机xhyve
https://github.com/mist64/xhyve/blob/master/xhyve_logo.png
源码安装
git clone https://github.com/mist64/xhyve
cd xhyve
make
ls -lh build/xhyve
cp build/xhyve /usr/local/bin/
brew安装
brew install --HEAD xhyve
下载仅83MB的极小linux发行版alpine
mkdir alpine
cd alpine
wget http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.3-x86_64.iso
cd alpine
dd if=/dev/zero bs=2k count=1 of=alpine-tmp.iso
dd if=alpine-3.3.3-x86_64.iso bs=2k skip=1 >> alpine-tmp.iso
MOUNT_INFO=$(hdiutil mount alpine-tmp.iso)
cp $(echo $MOUNT_INFO|gawk '{print $2}')/boot/[iv]*grsec .
hdiutil unmount $(echo $MOUNT_INFO|gawk '{print $1}')
rm -f alpine-tmp.iso
cat > run.sh << EOF
#!/bin/bash
# Linux
KERNEL="vmlinuz-grsec"
INITRD="initramfs-grsec"
CMDLINE="earlyprintk=serial console=ttyS0"
MEM="-m 512M"
#SMP="-c 2"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3,ahci-cd,alpine-3.3.3-x86_64.iso"
#IMG_HDD="-s 4,virtio-blk,hdd-alpine.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
ACPI="-A"
# Linux
xhyve \$ACPI \$MEM \$SMP \$PCI_DEV \$LPC_DEV \$NET \$IMG_CD \$IMG_HDD \$UUID -f kexec,\$KERNEL,\$INITRD,"\$CMDLINE"
EOF
chmod +x run.sh
sudo ./run.sh