mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +00:00
Use moby run to run hyperkit in Makefile
- cut down the hyperkit script but leave as reference for now - an error left over after shutdown that needs removing at some point fix #1375 Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
6c1786dd79
commit
668408614f
28
Makefile
28
Makefile
@ -36,38 +36,18 @@ qemu-iso: alpine/mobylinux-bios.iso
|
||||
bin:
|
||||
mkdir -p $@
|
||||
|
||||
DOCKER_HYPERKIT=/Applications/Docker.app/Contents/MacOS/com.docker.hyperkit
|
||||
DOCKER_VPNKIT=/Applications/Docker.app/Contents/MacOS/vpnkit
|
||||
|
||||
bin/com.docker.hyperkit: | bin
|
||||
ifneq ("$(wildcard $(DOCKER_HYPERKIT))","")
|
||||
ln -s $(DOCKER_HYPERKIT) $@
|
||||
else
|
||||
curl -fsSL https://circleci.com/api/v1/project/docker/hyperkit/latest/artifacts/0//Users/distiller/hyperkit/build/com.docker.hyperkit > $@
|
||||
chmod a+x $@
|
||||
endif
|
||||
|
||||
bin/vpnkit: | bin
|
||||
ifneq ("$(wildcard $(DOCKER_VPNKIT))","")
|
||||
ln -s $(DOCKER_VPNKIT) $@
|
||||
else
|
||||
curl -fsSL https://circleci.com/api/v1/project/docker/vpnkit/latest/artifacts/0//Users/distiller/vpnkit/vpnkit.tgz \
|
||||
| tar xz --strip=2 -C $(dir $@) Contents/MacOS/vpnkit
|
||||
touch $@
|
||||
endif
|
||||
|
||||
.PHONY: hyperkit
|
||||
hyperkit: scripts/hyperkit.sh bin/com.docker.hyperkit bin/vpnkit moby-initrd.img moby-bzImage moby.yaml
|
||||
./scripts/hyperkit.sh moby
|
||||
hyperkit: bin/moby moby-initrd.img moby-bzImage moby.yaml
|
||||
bin/moby run moby
|
||||
|
||||
define check_test_log
|
||||
@cat $1 |grep -q 'Moby test suite PASSED'
|
||||
endef
|
||||
|
||||
.PHONY: hyperkit-test
|
||||
hyperkit-test: scripts/hyperkit.sh bin/com.docker.hyperkit bin/vpnkit test-initrd.img test-bzImage test-cmdline
|
||||
hyperkit-test: bin/moby test-initrd.img test-bzImage test-cmdline
|
||||
rm -f disk.img
|
||||
script -q /dev/null ./scripts/hyperkit.sh test | tee test.log
|
||||
script -q /dev/null bin/moby run test | tee test.log
|
||||
$(call check_test_log, test.log)
|
||||
|
||||
.PHONY: test
|
||||
|
@ -44,8 +44,8 @@ The Makefile also specifies a number of targets:
|
||||
## Customise
|
||||
|
||||
To customise, copy or modify the [`moby.yaml`](moby.yaml) to your own `file.yaml` or use on of the [examples](examples/) and then run `./bin/moby build file.yaml` to
|
||||
generate its specified output. You can run the output with `./scripts/qemu.sh` or `./scripts/hyperkit.sh`, or on other
|
||||
platforms.
|
||||
generate its specified output. You can run the output with `./scripts/qemu.sh` or on OSX with `./bin/moby run file`. `moby run` targets will be available for other
|
||||
platforms shortly.
|
||||
|
||||
### Yaml Specification
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
DOCKER_HYPERKIT=/Applications/Docker.app/Contents/MacOS/com.docker.hyperkit
|
||||
DOCKER_VPNKIT=/Applications/Docker.app/Contents/MacOS/vpnkit
|
||||
|
||||
[ -f bin/com.docker.hyperkit ] && HYPERKIT=bin/com.docker.hyperkit
|
||||
[ -f bin/vpnkit ] && VPNKIT=bin/vpnkit
|
||||
|
||||
[ -f "$DOCKER_HYPERKIT" ] && HYPERKIT="$DOCKER_HYPERKIT"
|
||||
[ -f "$DOCKER_VPNKIT" ] && VPNKIT="$DOCKER_VPNKIT"
|
||||
|
||||
command -v com.docker.hyperkit > /dev/null && HYPERKIT="$(command -v com.docker.hyperkit)"
|
||||
command -v hyperkit > /dev/null && HYPERKIT="$(command -v hyperkit)"
|
||||
command -v vpnkit > /dev/null && VPNKIT="$(command -v vpnkit)"
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
PREFIX="moby"
|
||||
KERNEL="$PREFIX-bzImage"
|
||||
INITRD="$PREFIX-initrd.img"
|
||||
CMDLINE="$(cat $PREFIX-cmdline)"
|
||||
elif [ $# -eq 1 ]
|
||||
then
|
||||
PREFIX="$1"
|
||||
KERNEL="$PREFIX-bzImage"
|
||||
INITRD="$PREFIX-initrd.img"
|
||||
CMDLINE="$(cat $PREFIX-cmdline)"
|
||||
else
|
||||
KERNEL=$1
|
||||
INITRD=$2
|
||||
CMDLINE=$3
|
||||
fi
|
||||
|
||||
# TODO start vpnkit if Docker for Mac not running
|
||||
SLIRP_SOCK="$HOME/Library/Containers/com.docker.docker/Data/s50"
|
||||
|
||||
[ -f disk.img ] || dd if=/dev/zero of=disk.img bs=1048576 count=256
|
||||
|
||||
MEM="-m 1G"
|
||||
SMP="-c 1"
|
||||
NET="-s 2:0,virtio-vpnkit,path=$SLIRP_SOCK"
|
||||
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"
|
||||
|
||||
#$VPNKIT --ethernet $SLIRP_SOCK &>/dev/null &
|
||||
#trap "kill $!; rm $SLIRP_SOCK" EXIT
|
||||
|
||||
$HYPERKIT -A $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_HDD $RND -u -f "kexec,$KERNEL,$INITRD,$CMDLINE"
|
Loading…
Reference in New Issue
Block a user