From 0ba381c77a740cd34a7de545b4b1a4dfd6947201 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 20 Apr 2017 13:31:48 +0100
Subject: [PATCH] tools: Change qemu image for use with moby run
- Remove the qemu.sh entrypoint
- This means that any qemu command can be used (e.g qemu.img)
Signed-off-by: Dave Tucker
---
tools/qemu/Dockerfile | 1 -
tools/qemu/Makefile | 4 +--
tools/qemu/qemu.sh | 62 -------------------------------------------
3 files changed, 2 insertions(+), 65 deletions(-)
delete mode 100755 tools/qemu/qemu.sh
diff --git a/tools/qemu/Dockerfile b/tools/qemu/Dockerfile
index 8bd33fd64..fdf734836 100644
--- a/tools/qemu/Dockerfile
+++ b/tools/qemu/Dockerfile
@@ -13,4 +13,3 @@ RUN \
&& true
COPY . .
-ENTRYPOINT ["/qemu.sh"]
diff --git a/tools/qemu/Makefile b/tools/qemu/Makefile
index d28f5c113..081ab654f 100644
--- a/tools/qemu/Makefile
+++ b/tools/qemu/Makefile
@@ -5,10 +5,10 @@ IMAGE=qemu
default: push
-hash: Dockerfile qemu.sh repositories
+hash: Dockerfile repositories
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
- docker run --rm --entrypoint /bin/sh $(IMAGE):build -c 'cat Dockerfile qemu.sh /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@
+ docker run --rm --entrypoint /bin/sh $(IMAGE):build -c 'cat Dockerfile /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@
push: hash
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
diff --git a/tools/qemu/qemu.sh b/tools/qemu/qemu.sh
deleted file mode 100755
index a301e38de..000000000
--- a/tools/qemu/qemu.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-set -e
-
-cd /tmp
-
-# extract. BSD tar auto recognises compression, unlike GNU tar
-# only if stdin is a tty, if so need files volume mounted...
-[ -t 0 ] || bsdtar xzf -
-
-TGZ="$(find . -name '*.tgz' -or -name '*.tar.gz')"
-[ -n "$TGZ" ] && bsdtar xzf "$TGZ"
-
-EFI_ISO="$(find . -name '*efi.iso')"
-ISO="$(find . -name '*.iso')"
-RAW="$(find . -name '*.raw')"
-INITRD="$(find . -name '*.img')"
-KERNEL="$(find . -name vmlinuz64 -or -name '*bzImage')"
-CMDLINE="$(find . -name '*-cmdline')"
-
-if [ -n "$EFI_ISO" ]
-then
- ARGS="-pflash /usr/share/ovmf/bios.bin -usbdevice tablet -cdrom $EFI_ISO -boot d -drive file=systemdisk.img,format=raw"
-elif [ -n "$ISO" ]
-then
- ARGS="-cdrom $ISO -drive file=systemdisk.img,format=raw"
-elif [ -n "$RAW" ]
-then
- # should test with more drives
- ARGS="-drive file=$RAW,format=raw"
-elif [ -n "$KERNEL" ]
-then
- ARGS="-kernel $KERNEL"
- if [ -n "$INITRD" ]
- then
- ARGS="$ARGS -initrd $INITRD"
- fi
- ARGS="$ARGS -drive file=systemdisk.img,format=raw"
-else
- echo "no recognised boot media" >2
- exit 1
-fi
-
-echo "$ARGS" | grep -q systemdisk && qemu-img create -f raw systemdisk.img 256M
-
-if [ -n "${CMDLINE}" ]
-then
- APPEND="$(cat $CMDLINE)"
-else
- APPEND="$*"
-fi
-if [ -z "${APPEND}" ]
-then
- APPEND="console=ttyS0"
-fi
-
-if [ -z "$EFI_ISO" ] && [ -z "$ISO" ]
-then
- ARGS="-append \"${APPEND}\" ${ARGS}"
-fi
-
-eval qemu-system-x86_64 -machine q35,accel=kvm:tcg -device virtio-rng-pci -nographic -vnc none -m 1024 $ARGS