summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/recipes-bsp/bitstream/bitstream_1.0.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-core/recipes-bsp/bitstream/bitstream_1.0.bb')
-rw-r--r--meta-xilinx-core/recipes-bsp/bitstream/bitstream_1.0.bb76
1 files changed, 76 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-bsp/bitstream/bitstream_1.0.bb b/meta-xilinx-core/recipes-bsp/bitstream/bitstream_1.0.bb
new file mode 100644
index 00000000..97965279
--- /dev/null
+++ b/meta-xilinx-core/recipes-bsp/bitstream/bitstream_1.0.bb
@@ -0,0 +1,76 @@
1DESCRIPTION = "Recipe to provide a bitstream via virtual/bitstream"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
5
6INHIBIT_DEFAULT_DEPS = "1"
7
8BITSTREAM_PATH_DEPENDS ??= ""
9DEPENDS += "${BITSTREAM_PATH_DEPENDS}"
10
11# We never want to prefer this over another provider
12DEFAULT_PREFERENCE = "-1"
13
14PROVIDES = "virtual/bitstream"
15
16COMPATIBLE_MACHINE = "$^"
17COMPATIBLE_MACHINE:zynq = ".*"
18COMPATIBLE_MACHINE:zynqmp = ".*"
19
20# Since we're just copying, we can run any config
21COMPATIBLE_HOST = ".*"
22
23PACKAGE_ARCH = "${MACHINE_ARCH}"
24
25# Path where the bitstream can be found
26BITSTREAM_PATH ?= ""
27
28inherit deploy
29
30BITSTREAM_NAME ?= "download"
31BITSTREAM_NAME:microblaze ?= "system"
32
33BITSTREAM_BASE_NAME ?= "${BITSTREAM_NAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
34
35SYSROOT_DIRS += "/boot/bitstream"
36
37do_install() {
38 if [ ! -e ${BITSTREAM_PATH} ]; then
39 echo "Unable to find BITSTREAM_PATH (${BITSTREAM_PATH})"
40 exit 1
41 fi
42 install -d ${D}/boot/bitstream/
43 install -Dm 0644 ${BITSTREAM_PATH} ${D}/boot/bitstream/${BITSTREAM_BASE_NAME}.bit
44}
45
46# If the item is already in OUR deploy_image_dir, nothing to deploy!
47SHOULD_DEPLOY = "${@'false' if (d.getVar('BITSTREAM_PATH')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}"
48do_deploy() {
49 # If the item is already in OUR deploy_image_dir, nothing to deploy!
50 if ${SHOULD_DEPLOY}; then
51 install -Dm 0644 ${BITSTREAM_PATH} ${DEPLOYDIR}/${BITSTREAM_BASE_NAME}.bit
52 fi
53}
54
55addtask deploy before do_build after do_install
56
57FILES:${PN} += "/boot/bitstream/*.bit"
58
59def check_bitstream_vars(d):
60 # Assuming if BITSTREAM_PATH_DEPENDS exists, that the file will be available later.
61 if not d.getVar('BITSTREAM_PATH_DEPENDS'):
62 # Don't cache this, as the items on disk can change!
63 d.setVar('BB_DONT_CACHE', '1')
64
65 # If BITSTREAM_PATH is not found or defined, we error and instruct the user
66 if not d.getVar('BITSTREAM_PATH'):
67 raise bb.parse.SkipRecipe("Something is depending on virtual/bitstream and you have not provided a bitstream using BITSTREAM_PATH variable.\n See the meta-xilinx-core README.")
68
69 if d.getVar('BITSTREAM_PATH') and not os.path.exists(d.getVar('BITSTREAM_PATH')):
70 raise bb.parse.SkipRecipe("The expected bitstream file %s is not available.\nSee the meta-xilinx-core README." % d.getVar('BITSTREAM_PATH'))
71
72python() {
73 # Need to allow bbappends to change the check
74 check_bitstream_vars(d)
75}
76