From b6c6ec8905084ab89bec2b0bf531735c4f1109cf Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Mon, 31 Oct 2016 15:33:30 +0000 Subject: [PATCH] Add hyperkit build Useful for local performance tests Fix #443 Signed-off-by: Justin Cormack --- .gitignore | 2 ++ Makefile | 8 ++++++++ hyperkit.sh | 24 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100755 hyperkit.sh diff --git a/.gitignore b/.gitignore index d4b066b0a..1cc7ae843 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ test.log *.swp +/hyperkit.git +/disk.img diff --git a/Makefile b/Makefile index 9588de2bf..7fd9e51e5 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,13 @@ qemu-iso: Dockerfile.qemuiso alpine/mobylinux-bios.iso tar cf - $^ | docker build -f Dockerfile.qemuiso -t mobyqemuiso:build - docker run -it --rm mobyqemuiso:build +hyperkit.git: + git clone https://github.com/docker/hyperkit.git hyperkit.git + +hyperkit: hyperkit.git hyperkit.sh alpine/initrd.img alpine/kernel/x86_64/vmlinuz64 + cd hyperkit.git && make + sh hyperkit.sh + test: Dockerfile.test alpine/initrd.img alpine/kernel/x86_64/vmlinuz64 $(MAKE) -C alpine BUILD=$$( tar cf - $^ | docker build -f Dockerfile.test -q - ) && \ @@ -46,3 +53,4 @@ endif clean: $(MAKE) -C alpine clean + rm -rf hyperkit.git disk.img diff --git a/hyperkit.sh b/hyperkit.sh new file mode 100755 index 000000000..d63450a50 --- /dev/null +++ b/hyperkit.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +KERNEL="alpine/kernel/x86_64/vmlinuz64" +INITRD="alpine/initrd.img" +CMDLINE="earlyprintk=serial console=ttyS0" + +[ -f disk.img ] || dd if=/dev/zero of=disk.img bs=1m count=100 + +MEM="-m 1G" +SMP="-c 1" +NET="" +if (( $EUID != 0 )); then + printf "Need to run as root to get networking!\n\n" + exit 1 +fi +NET="-s 2:0,virtio-net" +IMG_HDD="-s 4,virtio-blk,disk.img" +PCI_DEV="-s 0:0,hostbridge -s 31,lpc" +RND="-s 5,virtio-rnd" +LPC_DEV="-l com1,stdio" + +hyperkit.git/build/com.docker.hyperkit -A $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_HDD $RND -u -f kexec,$KERNEL,$INITRD,"$CMDLINE"