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 --- meta-xilinx-core/classes/image-wic-utils.bbclass | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 meta-xilinx-core/classes/image-wic-utils.bbclass (limited to 'meta-xilinx-core/classes/image-wic-utils.bbclass') diff --git a/meta-xilinx-core/classes/image-wic-utils.bbclass b/meta-xilinx-core/classes/image-wic-utils.bbclass new file mode 100644 index 00000000..562f3263 --- /dev/null +++ b/meta-xilinx-core/classes/image-wic-utils.bbclass @@ -0,0 +1,51 @@ +# Helper/utility functions to work with the IMAGE_BOOT_FILES variable and its +# expected behvaior with regards to the contents of the DEPLOY_DIR_IMAGE. +# +# The use of these functions assume that the deploy directory is populated with +# any dependent files/etc. Such that the recipe using these functions depends +# on the recipe that provides the files being used/queried. + +def boot_files_split_expand(d): + # IMAGE_BOOT_FILES has extra renaming info in the format ';' + for f in (d.getVar("IMAGE_BOOT_FILES") or "").split(" "): + parts = f.split(";", 1) + sources = [parts[0].strip()] + if "*" in parts[0]: + # has glob part + import glob + deployroot = d.getVar("DEPLOY_DIR_IMAGE") + sources = [] + for i in glob.glob(os.path.join(deployroot, parts[0])): + sources.append(os.path.basename(i)) + + # for all sources, yield an entry + for s in sources: + if len(parts) == 2: + yield s, parts[1].strip() + yield s, s + +def boot_files_bitstream(d): + expectedfiles = [("bitstream", True)] + expectedexts = [(".bit", True), (".bin", False)] + # search for bitstream paths, use the renamed file. First matching is used + for source, target in boot_files_split_expand(d): + # skip boot.bin and u-boot.bin, it is not a bitstream + skip = ["boot.bin", "u-boot.bin"] + if source in skip or target in skip: + continue + + for e, t in expectedfiles: + if source == e or target == e: + return target, t + for e, t in expectedexts: + if source.endswith(e) or target.endswith(e): + return target, t + return "", False + +def boot_files_dtb_filepath(d): + dtbs = (d.getVar("IMAGE_BOOT_FILES") or "").split(" ") + for source, target in boot_files_split_expand(d): + if target.endswith(".dtb"): + return target + return "" + -- cgit v1.2.3-54-g00ecf