[meta-xilinx] [PATCH 2/5] qemu-xilinx-multiarch-helper-native: Recipe to provide a helper script

Nathan Rossi nathan at nathanrossi.com
Wed May 24 08:47:54 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>
---
 .../qemu/files/qemu-system-aarch64-multiarch       | 23 ++++++++++++++++++++++
 .../qemu-xilinx-multiarch-helper-native_1.0.bb     | 20 +++++++++++++++++++
 2 files changed, 43 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..7bd976b25e
--- /dev/null
+++ b/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+BINPATH=$(dirname $0)
+MACHINE_PATH=$(mktemp -d)
+DTB_DIR=$(dirname $(echo $* | grep -Po "\-hw-dtb.*?\.dtb" | sed 's/-hw-dtb\s*//'))
+DEPLOY_DIR=$DTB_DIR/../../
+MACHINE_NAME=$(basename $(readlink -f $DEPLOY_DIR))
+
+# start the microblaze instance
+$BINPATH/qemu-system-microblazeel \
+	-M microblaze-fdt \
+	-display none \
+	-hw-dtb $DTB_DIR/zynqmp-pmu.dtb \
+	-kernel $DEPLOY_DIR/pmu-rom.elf \
+	-device loader,file=$DEPLOY_DIR/pmu-$MACHINE_NAME.elf \
+	-machine-path $MACHINE_PATH \
+	-device loader,addr=0xfd1a0074,data=0x1011003,data-len=4 \
+	-device loader,addr=0xfd1a007C,data=0x1010f03,data-len=4 \
+	&
+
+# replace with the primary QEMU instance
+$BINPATH/qemu-system-aarch64 $* -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