From 322e23dc213d51a12345ca705b3776f189dc413f Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Wed, 15 Dec 2021 13:52:16 -0800 Subject: Initial restructure/split of meta-xilinx-bsp Create a new meta-xilinx-core, move core functionality to the core, keeping board specific files in the bsp layer. zynqmp-generic changed from require to include, so if meta-xilinx-bsp is not available it will not fail. Signed-off-by: Mark Hatle --- .../python/python3-anytree_2.8.0.bb | 22 +++ .../python/python3-flask-restful_%.bbappend | 1 + .../python/python3-flask_%.bbappend | 1 + .../python/python3-itsdangerous_%.bbappend | 1 + .../python/python3-pandas_%.bbappend | 1 + .../python/python3-werkzeug_%.bbappend | 1 + ...ure-Add-pkg-config-handling-for-libgcrypt.patch | 29 ++++ .../recipes-devtools/qemu/files/cross.patch | 40 +++++ .../recipes-devtools/qemu/files/flash_stripe.c | 176 +++++++++++++++++++++ .../qemu/files/qemu-system-aarch64-multiarch | 68 ++++++++ .../recipes-devtools/qemu/flashstrip_1.0.bb | 27 ++++ .../recipes-devtools/qemu/qemu-devicetrees.inc | 39 +++++ ...01-Makefile-Use-python3-instead-of-python.patch | 37 +++++ .../qemu/qemu-devicetrees_2022.1.bb | 5 + .../qemu/qemu-xilinx-helper-native_1.0.bb | 34 ++++ .../qemu-xilinx-multiarch-helper-native_1.0.bb | 20 +++ .../recipes-devtools/qemu/qemu-xilinx-native.inc | 11 ++ .../qemu/qemu-xilinx-native_2022.1.bb | 7 + .../qemu/qemu-xilinx-system-native_2022.1.bb | 18 +++ .../recipes-devtools/qemu/qemu-xilinx.inc | 48 ++++++ .../recipes-devtools/qemu/qemu-xilinx_2022.1.bb | 17 ++ .../recipes-devtools/qemu/qemu_%.bbappend | 2 + .../run-postinsts/run-postinsts_%.bbappend | 7 + 23 files changed, 612 insertions(+) create mode 100644 meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb create mode 100644 meta-xilinx-core/recipes-devtools/python/python3-flask-restful_%.bbappend create mode 100644 meta-xilinx-core/recipes-devtools/python/python3-flask_%.bbappend create mode 100644 meta-xilinx-core/recipes-devtools/python/python3-itsdangerous_%.bbappend create mode 100644 meta-xilinx-core/recipes-devtools/python/python3-pandas_%.bbappend create mode 100644 meta-xilinx-core/recipes-devtools/python/python3-werkzeug_%.bbappend create mode 100644 meta-xilinx-core/recipes-devtools/qemu/files/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch create mode 100644 meta-xilinx-core/recipes-devtools/qemu/files/cross.patch create mode 100644 meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c create mode 100644 meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch create mode 100644 meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees.inc create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native.inc create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx.inc create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb create mode 100644 meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend create mode 100644 meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend (limited to 'meta-xilinx-core/recipes-devtools') diff --git a/meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb b/meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb new file mode 100644 index 00000000..f5070be7 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Powerful and Lightweight Python Tree Data Structure" + +HOMEPAGE = "https://github.com/c0fec0de/anytree" +LICENSE = "Apache-2.0" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" + +DEPENDS += "python3-six" + +SRC_URI = "git://github.com/c0fec0de/anytree.git;protocol=https" +SRCREV = "75c0198636f8997967ba00df5077cd21350f68ce" + +S = "${WORKDIR}/git" + +inherit setuptools3 + +do_install:append() { + rm -f ${D}/${datadir}/LICENSE + rmdir ${D}/${datadir} || : +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/python/python3-flask-restful_%.bbappend b/meta-xilinx-core/recipes-devtools/python/python3-flask-restful_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-flask-restful_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/python/python3-flask_%.bbappend b/meta-xilinx-core/recipes-devtools/python/python3-flask_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-flask_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/python/python3-itsdangerous_%.bbappend b/meta-xilinx-core/recipes-devtools/python/python3-itsdangerous_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-itsdangerous_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/python/python3-pandas_%.bbappend b/meta-xilinx-core/recipes-devtools/python/python3-pandas_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-pandas_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/python/python3-werkzeug_%.bbappend b/meta-xilinx-core/recipes-devtools/python/python3-werkzeug_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-werkzeug_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch b/meta-xilinx-core/recipes-devtools/qemu/files/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch new file mode 100644 index 00000000..4298964d --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/files/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch @@ -0,0 +1,29 @@ +From b51e6dd833172954c718bd600d846540eeb07220 Mon Sep 17 00:00:00 2001 +From: He Zhe +Date: Wed, 28 Aug 2019 19:56:28 +0800 +Subject: [PATCH] configure: Add pkg-config handling for libgcrypt + +libgcrypt may also be controlled by pkg-config, this patch adds pkg-config +handling for libgcrypt. + +Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html] + +Signed-off-by: He Zhe + +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index b3e7ec0e9..4cbe715b7 100644 +--- a/meson.build ++++ b/meson.build +@@ -874,7 +874,7 @@ endif + if not gnutls_crypto.found() + if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() + gcrypt = dependency('libgcrypt', version: '>=1.8', +- method: 'config-tool', ++ method: 'pkg-config', + required: get_option('gcrypt'), + kwargs: static_kwargs) + # Debian has removed -lgpg-error from libgcrypt-config diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/cross.patch b/meta-xilinx-core/recipes-devtools/qemu/files/cross.patch new file mode 100644 index 00000000..bdb77ec7 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/files/cross.patch @@ -0,0 +1,40 @@ +From f51ece86f84c877f255746cba22a6745f37d2b7f Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Tue, 5 Jan 2021 23:00:14 +0000 +Subject: [PATCH] qemu: Upgrade 5.1.0->5.2.0 + +We need to be able to trigger configure's cross code but we don't want +to set cross_prefix as it does other things we don't want. Patch things +so we can do what we need in the target config case. + +Upstream-Status: Inappropriate [may be rewritten in a way upstream may accept?] +Signed-off-by: Richard Purdie +--- + configure | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/configure b/configure +index 9a79a004d..563b7827f 100755 +--- a/configure ++++ b/configure +@@ -5128,7 +5128,6 @@ if test "$skip_meson" = no; then + fi + echo "strip = [$(meson_quote $strip)]" >> $cross + echo "windres = [$(meson_quote $windres)]" >> $cross +- if test "$cross_compile" = "yes"; then + cross_arg="--cross-file config-meson.cross" + echo "[host_machine]" >> $cross + if test "$mingw32" = "yes" ; then +@@ -5160,9 +5159,6 @@ if test "$skip_meson" = no; then + else + echo "endian = 'little'" >> $cross + fi +- else +- cross_arg="--native-file config-meson.cross" +- fi + mv $cross config-meson.cross + + rm -rf meson-private meson-info meson-logs +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c b/meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c new file mode 100644 index 00000000..a9a6e76a --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c @@ -0,0 +1,176 @@ +/* + * Stripe a flash image across multiple files. + * + * Copyright (C) 2019 Xilinx, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* N way (num) in place bit striper. Lay out row wise bits column wise + * (from element 0 to N-1). num is the length of x, and dir reverses the + * direction of the transform. be determines the bit endianess scheme. + * false to lay out bits LSB to MSB (little endian) and true for big endian. + * + * Best illustrated by examples: + * Each digit in the below array is a single bit (num == 3, be == false): + * + * {{ 76543210, } ----- stripe (dir == false) -----> {{ FCheb630, } + * { hgfedcba, } { GDAfc741, } + * { HGFEDCBA, }} <---- upstripe (dir == true) ----- { HEBgda52, }} + * + * Same but with be == true: + * + * {{ 76543210, } ----- stripe (dir == false) -----> {{ 741gdaFC, } + * { hgfedcba, } { 630fcHEB, } + * { HGFEDCBA, }} <---- upstripe (dir == true) ----- { 52hebGDA, }} + */ + +static inline void stripe8(uint8_t *x, int num, bool dir, bool be) +{ + uint8_t r[num]; + memset(r, 0, sizeof(uint8_t) * num); + int idx[2] = {0, 0}; + int bit[2] = {0, be ? 7 : 0}; + int d = dir; + + for (idx[0] = 0; idx[0] < num; ++idx[0]) { + for (bit[0] = be ? 7 : 0; bit[0] != (be ? -1 : 8); bit[0] += be ? -1 : 1) { + r[idx[!d]] |= x[idx[d]] & 1 << bit[d] ? 1 << bit[!d] : 0; + idx[1] = (idx[1] + 1) % num; + if (!idx[1]) { + bit[1] += be ? -1 : 1; + } + } + } + memcpy(x, r, sizeof(uint8_t) * num); +} + +int main (int argc, char *argv []) { +#ifdef UNSTRIPE + bool unstripe = true; +#else + bool unstripe = false; +#endif + +#ifdef FLASH_STRIPE_BE + bool be = true; +#else + bool be = false; +#endif + + int i; + + const char *exe_name = argv[0]; + argc--; + argv++; + + if (argc < 2) { + fprintf(stderr, "ERROR: %s requires at least two args\n", exe_name); + return 1; + } + + const char *single_f = argv[0]; + int single; + + if (unstripe) { + single = creat(single_f, 0644); + } else { + single = open(single_f, 0); + } + if (single == -1) { + perror(argv[0]); + return 1; + } + + argv++; + argc--; + + int multiple[argc]; + + for (i = 0; i < argc; ++i) { + if (unstripe) { + multiple[i] = open(argv[i], 0); + } else { + multiple[i] = creat(argv[i], 0644); + } + if (multiple[i] == -1) { + perror(argv[i]); + return 1; + } + } + + while (true) { + uint8_t buf[argc]; + for (i = 0; i < argc; ++i) { + switch (read(!unstripe ? single : multiple[ +#if defined(FLASH_STRIPE_BW) && defined (FLASH_STRIPE_BE) + argc - 1 - +#endif + i], &buf[i], 1)) { + case 0: + if (i == 0) { + goto done; + } else if (!unstripe) { + fprintf(stderr, "WARNING:input file %s is not multiple of " + "%d bytes, padding with garbage byte\n", single_f, + argc); + } + break; + case -1: + perror(unstripe ? argv[i] : single_f); + return 1; + } + } + +#ifndef FLASH_STRIPE_BW + stripe8(buf, argc, unstripe, be); +#endif + + for (i = 0; i < argc; ++i) { + switch (write(unstripe ? single : multiple[ +#if defined(FLASH_STRIPE_BW) && defined (FLASH_STRIPE_BE) + argc - 1 - +#endif + i], &buf[i], 1)) { + case -1: + perror(unstripe ? single_f : argv[i]); + return 1; + case 0: + i--; /* try again */ + } + } + } + +done: + close(single); + for (i = 0; i < argc; ++i) { + close(multiple[argc]); + } + return 0; +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch new file mode 100644 index 00000000..6f7fb522 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +# Xilinx QEMU wrapper to launch both PMU and APU instances (multiarch) +import os +import subprocess +import sys +import tempfile +import shutil + +binpath = os.path.dirname(os.path.abspath(__file__)) +mach_path = tempfile.mkdtemp() + + +# Separate PMU and APU arguments +APU_args = sys.argv[1:] +mbtype='' + +if '-pmu-args' in APU_args: + MB_args = APU_args[APU_args.index('-pmu-args')+1] + APU_args.remove('-pmu-args') + APU_args.remove(MB_args) + MB_args = MB_args.split() + PMU_rom = MB_args[MB_args.index('-kernel')+1] + mbtype='PMU' +elif '-plm-args' in APU_args: + MB_args = APU_args[APU_args.index('-plm-args')+1] + APU_args.remove('-plm-args') + APU_args.remove(MB_args) + MB_args = MB_args.split() + mbtype='PLM' +else: + error_msg = '\nMultiarch not setup properly.' + sys.exit(error_msg) + +error_msg = None +if (mbtype == 'PMU' and os.path.exists(PMU_rom)) or mbtype == 'PLM': + + # We need to switch tcp serial arguments (if they exist, e.g. qemurunner) to get the output correctly + tcp_serial_ports = [i for i, s in enumerate(APU_args) if 'tcp:127.0.0.1:' in s] + + #NEED TO FIX for next yocto release (dont need to switch ports anymore, they will be provided correctly upstream + # We can only switch these if there are exactly two, otherwise we can't assume what is being executed so we leave it as is + if len(tcp_serial_ports) == 2: + APU_args[tcp_serial_ports[0]],APU_args[tcp_serial_ports[1]] = APU_args[tcp_serial_ports[1]],APU_args[tcp_serial_ports[0]] + + mb_cmd = binpath + '/qemu-system-microblazeel ' + ' '.join(MB_args) + ' -machine-path ' + mach_path + apu_cmd = binpath + '/qemu-system-aarch64 ' + ' '.join(APU_args) + ' -machine-path ' + mach_path + + # Debug prints + print('\n%s instance cmd: %s\n' % (mbtype, mb_cmd)) + print('APU instance cmd: %s\n' % apu_cmd) + + + # Invoke QEMU pmu instance + process_pmu = subprocess.Popen(mb_cmd, shell=True, stderr=subprocess.PIPE) + + # Invoke QEMU APU instance + process_apu = subprocess.Popen(apu_cmd, shell=True, stderr=subprocess.PIPE) + if process_apu.wait(): + error_msg = '\nQEMU APU instance failed:\n%s' % process_apu.stderr.read().decode() + +else: + if mbtype == 'PMU': + error_msg = '\nError: Missing PMU ROM: %s' % PMU_rom + error_msg += '\nSee "meta-xilinx/README.qemu.md" for more information on accquiring the PMU ROM.\n' + +shutil.rmtree(mach_path) +sys.exit(error_msg) diff --git a/meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb b/meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb new file mode 100644 index 00000000..e1dcc5ae --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb @@ -0,0 +1,27 @@ +SUMMARY = "Building and installing flash strip utility" +DESCRIPTION = "Building and installing flash strip utility" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://../flash_stripe.c;beginline=1;endline=23;md5=abb859d98b7c4eede655e1b71824125a" + +B = "${WORKDIR}/build" + +SRC_URI += "file://flash_stripe.c" + +TARGET_CC_ARCH += "${LDFLAGS}" + +do_compile() { + ${CC} ${WORKDIR}/flash_stripe.c -o flash_strip + ${CC} ${WORKDIR}/flash_stripe.c -o flash_unstrip + ${CC} ${WORKDIR}/flash_stripe.c -o flash_strip_bw -DFLASH_STRIPE_BW + ${CC} ${WORKDIR}/flash_stripe.c -o flash_unstrip_bw -DUNSTRIP -DFLASH_STRIPE_BW +} + +do_install() { + install -d ${D}${bindir} + install -Dm 0755 ${B}/* ${D}${bindir}/ +} + +FILES:${PN} = "${bindir}/*" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees.inc new file mode 100644 index 00000000..6d834297 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees.inc @@ -0,0 +1,39 @@ +SUMMARY = "Xilinx's hardware device trees required for QEMU" +HOMEPAGE = "https://github.com/xilinx/qemu-devicetrees/" +LICENSE = "BSD" +DEPENDS += "dtc-native" + +inherit deploy + +LIC_FILES_CHKSUM = "file://Makefile;beginline=1;endline=27;md5=7348b6cbcae69912cb1dee68d6c68d99" + +PV = "xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI:append = " file://0001-Makefile-Use-python3-instead-of-python.patch" + +REPO ?= "git://github.com/Xilinx/qemu-devicetrees.git;protocol=https" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +S = "${WORKDIR}/git" + +# Don't need to do anything +do_install() { + : +} + +do_deploy() { + # single-arch dtbs + for DTS_FILE in ${S}/LATEST/SINGLE_ARCH/*.dtb; do + install -Dm 0644 $DTS_FILE ${DEPLOYDIR}/qemu-hw-devicetrees/$(basename $DTS_FILE .dtb).dtb + done + + # multi-arch dtbs + for DTS_FILE in ${S}/LATEST/MULTI_ARCH/*.dtb; do + install -Dm 0644 $DTS_FILE ${DEPLOYDIR}/qemu-hw-devicetrees/multiarch/$(basename $DTS_FILE .dtb).dtb + done +} + +addtask deploy after do_install diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch new file mode 100644 index 00000000..425145d0 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch @@ -0,0 +1,37 @@ +From e80324e3497e5768c9fdbde3c0660a03d0dcc3ee Mon Sep 17 00:00:00 2001 +From: Sai Hari Chandana Kalluri +Date: Mon, 8 Feb 2021 16:32:34 -0800 +Subject: [PATCH] Makefile:Use python3 instead of python + +Signed-off-by: Sai Hari Chandana Kalluri +--- + Makefile | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index a110483..fd8868c 100644 +--- a/Makefile ++++ b/Makefile +@@ -91,13 +91,13 @@ $(LQSPI_XIP_OUTDIR)/%.dts: %.dts $(DTSI_FILES) $(HEADER_FILES) + # TODO: Add support for auto-generated dependency list + versal-pmc-npi.dtsi: versal-pmc-npi-nxx.dtsi versal-h10-pmc-npi-nxx.dtsi + versal-pmc-npi-nxx.dtsi: Makefile +- @python -c 'for a in range(0, 54): print("\tGEN_NMU(" + str(a) + ")")' > $@ +- @python -c 'for a in range(0, 50): print("\tGEN_NSU(" + str(a) + ")")' >> $@ +- @python -c 'for a in range(0, 146): print("\tGEN_NPS(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 54): print("\tGEN_NMU(" + str(a) + ")")' > $@ ++ @python3 -c 'for a in range(0, 50): print("\tGEN_NSU(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 146): print("\tGEN_NPS(" + str(a) + ")")' >> $@ + versal-h10-pmc-npi-nxx.dtsi: Makefile +- @python -c 'for a in range(0, 37): print("\tGEN_NMU(" + str(a) + ")")' > $@ +- @python -c 'for a in range(0, 33): print("\tGEN_NSU(" + str(a) + ")")' >> $@ +- @python -c 'for a in range(0, 135): print("\tGEN_NPS(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 37): print("\tGEN_NMU(" + str(a) + ")")' > $@ ++ @python3 -c 'for a in range(0, 33): print("\tGEN_NSU(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 135): print("\tGEN_NPS(" + str(a) + ")")' >> $@ + + clean: + $(RM) versal-pmc-npi-nxx.dtsi +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb new file mode 100644 index 00000000..3b4e0263 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb @@ -0,0 +1,5 @@ + +require qemu-devicetrees.inc + +BRANCH ?= "master" +SRCREV ?= "a224c69f66ebd4cd705b6f1b319c2db0dbd602b9" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb new file mode 100644 index 00000000..eb14c0c1 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb @@ -0,0 +1,34 @@ +FILESEXTRAPATHS:prepend := "${COREBASE}/meta/recipes-devtools/qemu/qemu-helper:" + +# provide it, to replace the existing +PROVIDES = "qemu-helper-native" + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999" + +SRC_URI = "\ + file://tunctl.c \ + " + +S = "${WORKDIR}" + +inherit native + +do_compile() { + ${CC} ${CFLAGS} ${LDFLAGS} -Wall tunctl.c -o tunctl +} +# replace qemu with qemu-xilinx +DEPENDS:remove = "qemu-system-native" +DEPENDS:append = " \ + qemu-xilinx-system-native \ + qemu-xilinx-multiarch-helper-native \ + " + +RDEPENDS:${PN}:remove = "qemu-system-native" +RDEPENDS:${PN}:append = " qemu-xilinx-system-native" + +do_install() { + install -d ${STAGING_BINDIR_NATIVE} + install tunctl ${STAGING_BINDIR_NATIVE} + +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb new file mode 100644 index 00000000..1eec0163 --- /dev/null +++ b/meta-xilinx-core/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-system-aarch64-multiarch +} + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native.inc new file mode 100644 index 00000000..3faabe5b --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native.inc @@ -0,0 +1,11 @@ +require recipes-devtools/qemu/qemu-native.inc +require qemu-xilinx.inc + +DEPENDS = "glib-2.0-native zlib-native" + +SRC_URI:remove = "file://0012-fix-libcap-header-issue-on-some-distro.patch" +SRC_URI:remove = "file://0013-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch" + +do_install:append(){ + rm -rf ${D}${datadir}/icons +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb new file mode 100644 index 00000000..5e6c2d28 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb @@ -0,0 +1,7 @@ +require qemu-xilinx-native.inc +BPN = "qemu-xilinx" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PROVIDES = "qemu-native" +PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb new file mode 100644 index 00000000..f5b89f05 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb @@ -0,0 +1,18 @@ +require qemu-xilinx-native.inc + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm pie" + +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" + +do_install:append() { + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons + rm -rf ${D}${includedir}/qemu-plugin.h +} + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx.inc new file mode 100644 index 00000000..d268f3e7 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx.inc @@ -0,0 +1,48 @@ +SUMMARY = "Xilinx's fork of a fast open source processor emulator" +HOMEPAGE = "https://github.com/xilinx/qemu/" + +# x86_64 is needed to build nativesdks +QEMU_TARGETS = "aarch64 arm microblaze microblazeel x86_64" + +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ + file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f \ + " +DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" + +XILINX_QEMU_VERSION ?= "v6.1.0" +BRANCH ?= "master" +SRCREV = "8dd1b8cabff3e3e5b965d7a60472278ca4e27ceb" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +PV = "${XILINX_QEMU_VERSION}-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}" +REPO ?= "gitsm://github.com/Xilinx/qemu.git;protocol=https" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +SRC_URI:append = " file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch" + +S = "${WORKDIR}/git" + +# Disable KVM completely +PACKAGECONFIG:remove = "kvm" +PACKAGECONFIG:append = " fdt sdl gcrypt pie" + +PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," +PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" +PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," + +DISABLE_STATIC:pn-${PN} = "" +EXTRA_OECONF:remove = " --with-git=/bin/false --with-git-submodules=ignore" + +PTEST_ENABLED = "" + +do_install:append() { + # Prevent QA warnings about installed ${localstatedir}/run + if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi +} + +FILES:${PN} += "${datadir}/qemu/" +FILES:${PN}:append:class-nativesdk:mingw32 = " ${SDKPATHNATIVE}" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb new file mode 100644 index 00000000..4983b4df --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb @@ -0,0 +1,17 @@ +require recipes-devtools/qemu/qemu.inc +require qemu-xilinx.inc + +BBCLASSEXTEND = "nativesdk" + +RDEPENDS:${PN}:class-target += "bash" + +PROVIDES:class-nativesdk = "nativesdk-qemu" +RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" + +do_install:append:class-nativesdk() { + ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend b/meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend new file mode 100644 index 00000000..bb792de2 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend @@ -0,0 +1,2 @@ +# Has a dependency on libmali +PACKAGE_ARCH:mali400 = "${SOC_VARIANT_ARCH}" diff --git a/meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend b/meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend new file mode 100644 index 00000000..cb5a912b --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend @@ -0,0 +1,7 @@ +# Update-alternatives is not able to find stdout when using JTAG boot mode on +# our devices, exits ungracefully without performing the required work (symbolic +# linking), pass kmsg to it as output to achieve proper behavior. + +do_install:append(){ + sed -i "s/sh -c \$i \$append_log/sh -c \$i > \/dev\/kmsg/" ${D}${sbindir}/run-postinsts +} -- cgit v1.2.3-54-g00ecf