From 286d45cc649a5b852a27b48e61b51bf75e9d1cee Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Tue, 2 Oct 2018 15:21:57 -0400 Subject: Add meta-xilinx subtree Import git://git.yoctoproject.org/meta-xilinx from 5fccc46503 as meta-xilinx subtree. Change-Id: I3d59bcf3a57cee588aab7f5cdd0287af66450c8a Signed-off-by: Brad Bishop --- .../classes/image-types-xilinx-qemu.bbclass | 10 ++ .../classes/qemuboot-xilinx.bbclass | 27 +++++ .../classes/xilinx-fetch-restricted.bbclass | 35 ++++++ .../classes/xilinx-platform-init.bbclass | 14 +++ .../meta-xilinx-bsp/classes/zynqmp-pmu.bbclass | 122 +++++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100644 meta-xilinx/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass create mode 100644 meta-xilinx/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass create mode 100644 meta-xilinx/meta-xilinx-bsp/classes/xilinx-fetch-restricted.bbclass create mode 100644 meta-xilinx/meta-xilinx-bsp/classes/xilinx-platform-init.bbclass create mode 100644 meta-xilinx/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass (limited to 'meta-xilinx/meta-xilinx-bsp/classes') diff --git a/meta-xilinx/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass b/meta-xilinx/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass new file mode 100644 index 000000000..59dfabfcc --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass @@ -0,0 +1,10 @@ +# Define the 'qemu-sd' conversion type +# +# This conversion type pads any image to the 256K boundary to ensure that the +# image file can be used directly with QEMU's SD emulation which requires the +# block device to match that of valid SD card sizes (which are multiples of +# 256K). + +CONVERSIONTYPES_append = " qemu-sd" +CONVERSION_CMD_qemu-sd = "cp ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd; truncate -s %256K ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd" +CONVERSION_DEPENDS_qemu-sd = "coreutils-native" diff --git a/meta-xilinx/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass b/meta-xilinx/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass new file mode 100644 index 000000000..024626cbf --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass @@ -0,0 +1,27 @@ + +# enable the overrides for the context of the conf only +OVERRIDES .= ":qemuboot-xilinx" + +# setup the target binary +QB_SYSTEM_NAME_prepend = "qemu-xilinx/" + +# Default machine targets for Xilinx QEMU (FDT Generic) +QB_MACHINE_aarch64 = "-machine arm-generic-fdt" +QB_MACHINE_arm = "-machine arm-generic-fdt-7series" +QB_MACHINE_microblaze = "-machine microblaze-generic-fdt-plnx" + +# defaults +QB_DEFAULT_KERNEL ?= "none" + +inherit qemuboot + +# rewrite the qemuboot with the custom sysroot bindir +python do_write_qemuboot_conf_append() { + val = os.path.join(d.getVar('BASE_WORKDIR'), d.getVar('BUILD_SYS'), 'qemu-xilinx-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/') + cf.set('config_bsp', 'STAGING_BINDIR_NATIVE', '%s' % val) + + # write out the updated version from this append + with open(qemuboot, 'w') as f: + cf.write(f) +} + diff --git a/meta-xilinx/meta-xilinx-bsp/classes/xilinx-fetch-restricted.bbclass b/meta-xilinx/meta-xilinx-bsp/classes/xilinx-fetch-restricted.bbclass new file mode 100644 index 000000000..a778ec7dc --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/classes/xilinx-fetch-restricted.bbclass @@ -0,0 +1,35 @@ +# This class is setup to override the default fetching for the target recipe. +# When fetching it forces PREMIRROR only fetching so that no attempts are made +# to fetch the Xilinx downloads that are restricted to authenticated users only. +# +# The purpose of this class is to allow for automatation with pre-downloaded +# content or content that is available with curated/user defined pre-mirrors +# and or pre-populated downloads/ directories. + +python do_fetch() { + xilinx_restricted_url = "xilinx.com/member/forms/download" + + src_uri = (d.getVar('SRC_URI') or "").split() + if len(src_uri) == 0: + return + + for i in src_uri: + if xilinx_restricted_url in i: + # force the use of premirrors only, do not attempt download from xilinx.com + d.setVar("BB_FETCH_PREMIRRORONLY", "1") + break + + try: + fetcher = bb.fetch2.Fetch(src_uri, d) + fetcher.download() + except bb.fetch2.NetworkAccess as e: + if xilinx_restricted_url in e.url: + # fatal on access to xilinx.com restricted downloads, print the url for manual download + bb.fatal("The following download cannot be fetched automatically. " \ + "Please manually download the file and place it in the 'downloads' directory (or on an available PREMIRROR).\n" \ + " %s" % (e.url.split(";")[0])) + else: + bb.fatal(str(e)) + except bb.fetch2.BBFetchException as e: + bb.fatal(str(e)) +} diff --git a/meta-xilinx/meta-xilinx-bsp/classes/xilinx-platform-init.bbclass b/meta-xilinx/meta-xilinx-bsp/classes/xilinx-platform-init.bbclass new file mode 100644 index 000000000..5d0995004 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/classes/xilinx-platform-init.bbclass @@ -0,0 +1,14 @@ +# This class should be included by any recipe that wants to access or provide +# the platform init source files which are used to initialize a Zynq or ZynqMP +# SoC. + +# Define the path to the xilinx platform init code/headers +PLATFORM_INIT_DIR ?= "/usr/src/xilinx-platform-init" + +PLATFORM_INIT_STAGE_DIR = "${STAGING_DIR_HOST}${PLATFORM_INIT_DIR}" + +# Target files use for platform init +PLATFORM_INIT_FILES ?= "" +PLATFORM_INIT_FILES_zynq = "ps7_init_gpl.c ps7_init_gpl.h" +PLATFORM_INIT_FILES_zynqmp = "psu_init_gpl.c psu_init_gpl.h" + diff --git a/meta-xilinx/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass b/meta-xilinx/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass new file mode 100644 index 000000000..714eb96a7 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass @@ -0,0 +1,122 @@ +# +# This class handles configuring a recipe to build for the ZynqMP PMU +# architecture. The reason for this class is due to limitations of multilib +# with regards to multiple architectures (which do not work correctly). +# +# This class is specifically intended to extend the binutils-cross, gcc-cross, +# newlib, libgloss and pmu-firmware recipes so that binaries can be emitted +# which target the PMU architecture alongside building for the APU architecture +# (ARM64). But the class can be applied globally via BBCLASSEXTEND in for +# example a .conf. +# +# This class is almost the same as a multilib variant with custom TUNE_* setup +# to allow for a switched TUNE_ARCH. +# + +ORIG_TARGET_ARCH := "${TARGET_ARCH}" + +# zynqmp-pmu target arch (hardcoded based on pre-gen data from arch-microblaze.inc) +DEFAULTTUNE = "microblaze" +ABIEXTENSION = "" +TUNE_ARCH = "microblazeel" +#TUNE_FEATURES_tune-microblaze += "v9.2 barrel-shift pattern-compare" +TUNE_CCARGS = "-mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-reorder -mcpu=v9.2 -mxl-soft-mul -mxl-soft-div" +TUNE_LDARGS = "" +TUNE_ASARGS = "" +TUNE_PKGARCH = "microblazeel-v9.2-bs-cmp" +TARGET_OS = "elf" +TARGET_FPU = "fpu-soft" + +# rebuild the MACHINE overrides +MACHINEOVERRIDES = "${MACHINE}${@':${SOC_FAMILY}' if d.getVar('SOC_FAMILY') else ''}:microblaze" + +# override tune provided archs +PACKAGE_EXTRA_ARCHS = "${TUNE_PKGARCH}" + +# baremetal equivalent config (note the tclibc is not included, this is purely +# for recipes/etc that check for the value) +TCLIBC = "baremetal" +LIBCEXTENSION = "" +LIBCOVERRIDE = ":libc-baremetal" +USE_NLS = "no" +IMAGE_LINGUAS = "" +LIBC_DEPENDENCIES = "" + +# gcc-cross specific baremetal setup (due to the override order this is important) +EXTRA_OECONF_pn-${MLPREFIX}gcc-cross-${TARGET_ARCH}_append = " --without-headers" + +EXTRA_OECONF_GCC_FLOAT = "" + +# Setup a multiarch like prefix. +prefix = "/usr/${TARGET_SYS}" +# Make sure GCC can search in the prefix dir (for libgcc) +TOOLCHAIN_OPTIONS += "-B${RECIPE_SYSROOT}${includedir}/ -B${RECIPE_SYSROOT}${libdir}/" +TOOLCHAIN_OPTIONS += "-I =${includedir} -L =${libdir}" + +python multitarget_zynqmp_pmu_virtclass_handler () { + variant = "zynqmp-pmu" + pn = d.getVar("PN") + if not (pn.startswith(variant + "-") or pn.endswith("-" + variant)): + return + + if bb.data.inherits_class('native', e.data) or bb.data.inherits_class('nativesdk', e.data) or bb.data.inherits_class('crosssdk', e.data): + raise bb.parse.SkipPackage("Can't extend native/nativesdk/crosssdk recipes") + + initialpn = e.data.getVar("PN").replace("-" + variant, "").replace(variant + "-", "") + e.data.setVar("MLPREFIX", variant + "-") + e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-" + variant) + + # hide multilib variants, this class is not one but this works around recipes thinking it is (due to MLPREFIX). + e.data.setVar("MULTILIB_VARIANTS", "") + + # work around for -cross recipes that embed the TARGET_ARCH value + if bb.data.inherits_class('cross', e.data): + if initialpn.endswith("-" + d.getVar("ORIG_TARGET_ARCH")): + initialpn = initialpn.replace("-" + d.getVar("ORIG_TARGET_ARCH"), "-" + d.getVar("TARGET_ARCH")) + + e.data.setVar("PN", variant + "-" + initialpn) +} + +addhandler multitarget_zynqmp_pmu_virtclass_handler +multitarget_zynqmp_pmu_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" + +python () { + variant = "zynqmp-pmu" + pn = d.getVar("PN") + if not pn.startswith(variant + "-"): + return + + if pn.endswith("gcc-cross-" + d.getVar("TARGET_ARCH")): + # work around, DEPENDS _remove being immediate in gcc-cross + d.setVar("DEPENDS_remove", "virtual/%slibc-for-gcc" % d.getVar("TARGET_PREFIX")) + + if pn.endswith("libgcc"): + # work around, strip depends on libc via do_package* tasks (this class cannot set ASSUME_PROVIDED += libc) + for i in ["do_package", "do_package_write_ipk", "do_package_write_deb", "do_package_write_rpm"]: + sanitized = " ".join([dep for dep in d.getVarFlag(i, "depends").split() if not dep.startswith("virtual/%s-libc" % variant)]) + d.setVarFlag(i, "depends", sanitized) + + import oe.classextend + + clsextend = oe.classextend.ClassExtender(variant, d) + + clsextend.map_depends_variable("DEPENDS") + clsextend.map_variable("PROVIDES") + + clsextend.rename_packages() + clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split()) + + clsextend.map_packagevars() + clsextend.map_regexp_variable("PACKAGES_DYNAMIC") + clsextend.map_variable("PACKAGE_INSTALL") +} + +# microblaze elf insane definitions not currently in insane.bbclass +PACKAGEQA_EXTRA_MACHDEFFUNCS += "package_qa_get_machine_dict_microblazeelf" +def package_qa_get_machine_dict_microblazeelf(machdata, d): + machdata["elf"] = { + "microblaze": (189, 0, 0, False, 32), + "microblazeeb":(189, 0, 0, False, 32), + "microblazeel":(189, 0, 0, True, 32), + } + return machdata -- cgit v1.2.3