[meta-xilinx] [PATCH v2 3/6] qemu-xilinx-multiarch-helper-native: Recipe to provide a helper script

Nathan Rossi nathan at nathanrossi.com
Tue May 30 04:45:36 PDT 2017


This recipe provides a helper script which is executed instead of the
main qemu-system-aarch64 binary. This script is used to configure a
multiarch QEMU setup where a MicroBlaze PMU instance is running along
side the ZynqMP AArch64 instance.

Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
---
Changes in v2:
  * Rework the script to accept '--pmu-args', passed in the single set
    of args from runqemu and split into APU/PMU specific args
  * Handle PMU ROM missing and generate an informative error pointing
    users at README.qemu.md
---
 .../qemu/files/qemu-system-aarch64-multiarch       | 32 ++++++++++++++++++++++
 .../qemu-xilinx-multiarch-helper-native_1.0.bb     | 20 ++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
 create mode 100644 recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb

diff --git a/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch b/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
new file mode 100644
index 0000000000..15124c1b7e
--- /dev/null
+++ b/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+BINPATH=$(dirname $0)
+MACHINE_PATH=$(mktemp -d)
+
+APU_ARGS=
+PMU_ARGS=
+
+while [ ! -z "$1" ]; do
+	if [ "$1" = "-pmu-args" ]; then
+		PMU_ARGS+=" $2"
+		shift
+	else
+		APU_ARGS+=" $1"
+	fi
+	shift
+done
+
+PMU_ROM=$(last=; for i in $PMU_ARGS; do if [ "$last" = "-kernel" ]; then echo "$i"; break; fi; last=$i; done)
+if [ ! -e $PMU_ROM ]; then
+	echo "------"
+	echo "Error: Missing PMU ROM - $PMU_ROM"
+	echo "    See 'meta-xilinx/README.qemu.md' for more information on accquiring the PMU ROM."
+	echo "------"
+	exit 255
+fi
+
+# start the PMU instance
+$BINPATH/qemu-system-microblazeel $PMU_ARGS -machine-path $MACHINE_PATH &
+# start the APU instance
+$BINPATH/qemu-system-aarch64 $APU_ARGS -machine-path $MACHINE_PATH
+
diff --git a/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb b/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb
new file mode 100644
index 0000000000..a9b11c6c67
--- /dev/null
+++ b/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Helper scripts for executing a multi-arch instance of Xilinx QEMU"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+RDEPENDS_${PN} = "qemu-xilinx-native"
+
+inherit native
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI = "file://qemu-system-aarch64-multiarch"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+SYSROOT_DIRS += "${bindir}/qemu-xilinx"
+
+do_install() {
+	install -Dm 0755 ${WORKDIR}/qemu-system-aarch64-multiarch ${D}${bindir}/qemu-xilinx/qemu-system-aarch64-multiarch
+}
+
-- 
2.11.0




More information about the meta-xilinx mailing list