summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-bsp/classes
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2018-02-01 02:20:19 +1000
committerManjukumar Matha <manjukumar.harthikote-matha@xilinx.com>2019-01-01 20:03:46 -0800
commit897edbbba3e444cca93ea9a76870fd1b8fa7272d (patch)
tree28d7712b9e184e9cf0bd6cb763a80ba442ae5019 /meta-xilinx-bsp/classes
parent85c9b317f7f7ca3c11a71c8083d83515aa602940 (diff)
downloadmeta-xilinx-897edbbba3e444cca93ea9a76870fd1b8fa7272d.tar.gz
u-boot-zynq-uenv.bb: Handle IMAGE_BOOT_FILES wildcard patterns
Handle IMAGE_BOOT_FILES having wildcard patterns for dtbs. This requires that the recipe depend on the deployment of the dtbs in order for the correct file names to be expanded. This change also improves the parsing of the IMAGE_BOOT_FILES variable and splits out the python functions for doing this into a separate image-wic-utils.bbclass file. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
Diffstat (limited to 'meta-xilinx-bsp/classes')
-rw-r--r--meta-xilinx-bsp/classes/image-wic-utils.bbclass51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta-xilinx-bsp/classes/image-wic-utils.bbclass b/meta-xilinx-bsp/classes/image-wic-utils.bbclass
new file mode 100644
index 00000000..6f66d553
--- /dev/null
+++ b/meta-xilinx-bsp/classes/image-wic-utils.bbclass
@@ -0,0 +1,51 @@
1# Helper/utility functions to work with the IMAGE_BOOT_FILES variable and its
2# expected behvaior with regards to the contents of the DEPLOY_DIR_IMAGE.
3#
4# The use of these functions assume that the deploy directory is populated with
5# any dependent files/etc. Such that the recipe using these functions depends
6# on the recipe that provides the files being used/queried.
7
8def boot_files_split_expand(d):
9 # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>'
10 for f in (d.getVar("IMAGE_BOOT_FILES") or "").split(" "):
11 parts = f.split(";", 1)
12 sources = [parts[0]]
13 if "*" in parts[0]:
14 # has glob part
15 import glob
16 deployroot = d.getVar("DEPLOY_DIR_IMAGE")
17 sources = []
18 for i in glob.glob(os.path.join(deployroot, parts[0])):
19 sources.append(os.path.basename(i))
20
21 # for all sources, yield an entry
22 for s in sources:
23 if len(parts) == 2:
24 yield s, parts[1]
25 yield s, s
26
27def boot_files_bitstream(d):
28 expectedfiles = [("bitstream", True)]
29 expectedexts = [(".bit", True), (".bin", False)]
30 # search for bitstream paths, use the renamed file. First matching is used
31 for source, target in boot_files_split_expand(d):
32 # skip boot.bin and u-boot.bin, it is not a bitstream
33 skip = ["boot.bin", "u-boot.bin"]
34 if source in skip or target in skip:
35 continue
36
37 for e, t in expectedfiles:
38 if source == e or target == e:
39 return target, t
40 for e, t in expectedexts:
41 if source.endswith(e) or target.endswith(e):
42 return target, t
43 return "", False
44
45def boot_files_dtb_filepath(d):
46 dtbs = (d.getVar("IMAGE_BOOT_FILES") or "").split(" ")
47 for source, target in boot_files_split_expand(d):
48 if target.endswith(".dtb"):
49 return target
50 return ""
51