Script which launches QEMU and runs robot CI test against it

This script will be run within automation to do a basic QEMU
CI test against the input openbmc build.

Change-Id: I6ffccd7f5767bec9bc673b1a41bd7bd1d960924c
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/scripts/boot-qemu.sh b/scripts/boot-qemu.sh
new file mode 100755
index 0000000..e0cd4de
--- /dev/null
+++ b/scripts/boot-qemu.sh
@@ -0,0 +1,43 @@
+#!/bin/bash -xe
+#
+# Launch QEMU using the raw commands
+#
+#  Parameters:
+#   parm1:  <optional, QEMU architecture to use >
+#            default is ${QEMU_ARCH} - ppc64le-linux or x86_64-linux
+#   parm2:  <optional, full path to base directory of qemu binary and images >
+#            default is ${HOME}
+
+set -uo pipefail
+
+QEMU_ARCH=${1:-$QEMU_ARCH}
+echo "QEMU_ARCH = $QEMU_ARCH"
+if [[ -z $QEMU_ARCH ]]; then
+    echo "Did not pass in required QEMU arch parameter"
+    exit -1
+fi
+
+BASE_DIR=${2:-$HOME}
+echo "BASE_DIR = $BASE_DIR"
+if [[ ! -d $BASE_DIR ]]; then
+    echo "No input directory and HOME not set!"
+    exit -1
+fi
+
+cd ${BASE_DIR}
+
+./tmp/sysroots/${QEMU_ARCH}/usr/bin/qemu-system-arm \
+    -nographic \
+    -kernel ./tmp/deploy/images/qemuarm/zImage-qemuarm.bin \
+    -machine versatilepb \
+    -drive file=./tmp/deploy/images/qemuarm/obmc-phosphor-image-qemuarm.ext4,format=raw \
+    -no-reboot \
+    -show-cursor \
+    -usb \
+    -usbdevice wacom-tablet \
+    -no-reboot -m 128 \
+    -redir tcp:22::22 \
+    -redir tcp:443::443 \
+    --append \
+    "root=/dev/sda rw console=ttyAMA0,115200 console=tty mem=128M highres=off \
+    rootfstype=ext4 console=ttyS0"