diff options
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.bb | 76 |
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 @@ | |||
| 1 | DESCRIPTION = "Recipe to provide a bitstream via virtual/bitstream" | ||
| 2 | |||
| 3 | LICENSE = "MIT" | ||
| 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
| 5 | |||
| 6 | INHIBIT_DEFAULT_DEPS = "1" | ||
| 7 | |||
| 8 | BITSTREAM_PATH_DEPENDS ??= "" | ||
| 9 | DEPENDS += "${BITSTREAM_PATH_DEPENDS}" | ||
| 10 | |||
| 11 | # We never want to prefer this over another provider | ||
| 12 | DEFAULT_PREFERENCE = "-1" | ||
| 13 | |||
| 14 | PROVIDES = "virtual/bitstream" | ||
| 15 | |||
| 16 | COMPATIBLE_MACHINE = "$^" | ||
| 17 | COMPATIBLE_MACHINE:zynq = ".*" | ||
| 18 | COMPATIBLE_MACHINE:zynqmp = ".*" | ||
| 19 | |||
| 20 | # Since we're just copying, we can run any config | ||
| 21 | COMPATIBLE_HOST = ".*" | ||
| 22 | |||
| 23 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 24 | |||
| 25 | # Path where the bitstream can be found | ||
| 26 | BITSTREAM_PATH ?= "" | ||
| 27 | |||
| 28 | inherit deploy | ||
| 29 | |||
| 30 | BITSTREAM_NAME ?= "download" | ||
| 31 | BITSTREAM_NAME:microblaze ?= "system" | ||
| 32 | |||
| 33 | BITSTREAM_BASE_NAME ?= "${BITSTREAM_NAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}" | ||
| 34 | |||
| 35 | SYSROOT_DIRS += "/boot/bitstream" | ||
| 36 | |||
| 37 | do_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! | ||
| 47 | SHOULD_DEPLOY = "${@'false' if (d.getVar('BITSTREAM_PATH')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}" | ||
| 48 | do_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 | |||
| 55 | addtask deploy before do_build after do_install | ||
| 56 | |||
| 57 | FILES:${PN} += "/boot/bitstream/*.bit" | ||
| 58 | |||
| 59 | def 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 | |||
| 72 | python() { | ||
| 73 | # Need to allow bbappends to change the check | ||
| 74 | check_bitstream_vars(d) | ||
| 75 | } | ||
| 76 | |||
