diff options
| author | Jaewon Lee <jaewon.lee@xilinx.com> | 2021-06-21 14:46:05 -0700 |
|---|---|---|
| committer | Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | 2021-09-27 21:34:01 -0700 |
| commit | e0718bdb5b141438b6f21911a48f00f6e470736f (patch) | |
| tree | 51fda0477b8ebbc5b6445c11fc010417d081c01e | |
| parent | fd4359c8b1604745b1dbf28376fad13666e53d7d (diff) | |
| download | meta-xilinx-e0718bdb5b141438b6f21911a48f00f6e470736f.tar.gz | |
Adding bootbin as is from xilinx-tools
Signed-off-by: Jaewon Lee <jaewon.lee@xilinx.com>
5 files changed, 363 insertions, 0 deletions
diff --git a/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-versal.inc b/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-versal.inc new file mode 100644 index 00000000..e10339dd --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-versal.inc | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #Extra args for versal | ||
| 2 | BOOTGEN_EXTRA_ARGS += "-dump bh" | ||
| 3 | |||
| 4 | #Add pdi dependency for versal | ||
| 5 | DEPENDS += "virtual/base-pdi" | ||
| 6 | |||
| 7 | # specify BIF common attribute for FSBL | ||
| 8 | BIF_COMMON_ATTR ?= "" | ||
| 9 | |||
| 10 | # specify BIF partition attributes required for BOOT.bin | ||
| 11 | BIF_PARTITION_ATTR ?= "pdi plm psm dtb atf u-boot" | ||
| 12 | |||
| 13 | # specify BIF partition attributes for pdi | ||
| 14 | BIF_PARTITION_ATTR[pdi] ?= "type=bootimage" | ||
| 15 | BIF_PARTITION_IMAGE[pdi] ?= "${RECIPE_SYSROOT}/boot/base-design.pdi" | ||
| 16 | BIF_PARTITION_DEPENDS[pdi] ?= "virtual/base-pdi:do_populate_sysroot" | ||
| 17 | |||
| 18 | # specify BIF partition attributes for plm | ||
| 19 | PLM_IMAGE_NAME ??= "plm-${MACHINE}" | ||
| 20 | BIF_PARTITION_ATTR[plm] ?= "type=bootloader" | ||
| 21 | BIF_PARTITION_IMAGE[plm] ?= "${DEPLOY_DIR_IMAGE}/${PLM_IMAGE_NAME}.elf" | ||
| 22 | BIF_PARTITION_DEPENDS[plm] ?= "virtual/plm:do_deploy" | ||
| 23 | |||
| 24 | # specify BIF partition attributes for psm | ||
| 25 | PSM_FIRMWARE_IMAGE_NAME ??= "psm-firmware-${MACHINE}" | ||
| 26 | BIF_PARTITION_ATTR[psm] ?= "core=psm" | ||
| 27 | BIF_PARTITION_IMAGE[psm] ?= "${DEPLOY_DIR_IMAGE}/${PSM_FIRMWARE_IMAGE_NAME}.elf" | ||
| 28 | BIF_PARTITION_DEPENDS[psm] ?= "virtual/psm-firmware:do_deploy" | ||
| 29 | |||
| 30 | # specify BIF partition attributes for dtb | ||
| 31 | BIF_PARTITION_ATTR[dtb] ?= "type=raw, load=0x1000" | ||
| 32 | BIF_PARTITION_IMAGE[dtb] ?= "${DEPLOY_DIR_IMAGE}/system.dtb" | ||
| 33 | BIF_PARTITION_DEPENDS[dtb] ?= "virtual/dtb:do_deploy" | ||
| 34 | BIF_PARTITION_ID[dtb] ?= "0x1c000000" | ||
| 35 | |||
| 36 | # specify BIF partition attributes for u-boot | ||
| 37 | BIF_PARTITION_ATTR[u-boot] ?= "core=a72-0, exception_level = el-2" | ||
| 38 | BIF_PARTITION_IMAGE[u-boot] ?= "${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.elf" | ||
| 39 | BIF_PARTITION_DEPENDS[u-boot] ?= "virtual/bootloader:do_deploy u-boot-zynq-scr:do_deploy" | ||
| 40 | BIF_PARTITION_ID[u-boot] ?= "0x1c000000" | ||
| 41 | |||
| 42 | # specify BIF partition attributes for atf | ||
| 43 | BIF_PARTITION_ATTR[atf] ?= "core=a72-0, exception_level = el-3, trustzone" | ||
| 44 | BIF_PARTITION_IMAGE[atf] ?= "${DEPLOY_DIR_IMAGE}/arm-trusted-firmware.elf" | ||
| 45 | BIF_PARTITION_DEPENDS[atf] ?= "virtual/arm-trusted-firmware:do_deploy" | ||
| 46 | BIF_PARTITION_ID[atf] ?= "0x1c000000" | ||
diff --git a/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-zynq.inc b/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-zynq.inc new file mode 100644 index 00000000..b8d75c4f --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-zynq.inc | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #specify BIF partition attributes required for BOOT.bin | ||
| 2 | BIF_PARTITION_ATTR ?= "fsbl bitstream u-boot" | ||
| 3 | |||
| 4 | #specify BIF partition attributes for FSBL | ||
| 5 | #bootloader is FSBL. Location where FSBL binary is present and dependency to build FSBL | ||
| 6 | BIF_PARTITION_ATTR[fsbl] ?= "bootloader" | ||
| 7 | BIF_PARTITION_IMAGE[fsbl] ?= "${DEPLOY_DIR_IMAGE}/fsbl-${MACHINE}.elf" | ||
| 8 | BIF_PARTITION_DEPENDS[fsbl] ?= "virtual/fsbl:do_deploy" | ||
| 9 | |||
| 10 | #specify BIF partition attributes for u-boot | ||
| 11 | #Location where u-boot binary is present | ||
| 12 | BIF_PARTITION_IMAGE[u-boot] ?= "${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.elf" | ||
| 13 | BIF_PARTITION_DEPENDS[u-boot] ?= "virtual/bootloader:do_deploy" | ||
| 14 | |||
| 15 | # enable bitstream-Note this is not enabled by default (missing in BIF_PARTITION_ATTR) | ||
| 16 | BIF_PARTITION_IMAGE[bitstream] ?= "${DEPLOY_DIR_IMAGE}/download-${MACHINE}.bit" | ||
| 17 | BIF_PARTITION_DEPENDS[bitstream] ?= "virtual/bitstream:do_deploy" | ||
diff --git a/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc b/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc new file mode 100644 index 00000000..cd2026ad --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # specify BIF common attribute for FSBL | ||
| 2 | BIF_COMMON_ATTR ?= "" | ||
| 3 | |||
| 4 | # specify BIF partition attributes required for BOOT.bin | ||
| 5 | BIF_PARTITION_ATTR ?= "fsbl pmu atf u-boot" | ||
| 6 | |||
| 7 | # specify BIF partition attributes for FSBL | ||
| 8 | # bootloader is FSBL. Location where FSBL binary is present and dependency to build FSBL | ||
| 9 | BIF_PARTITION_ATTR[fsbl] ?= "bootloader, destination_cpu=a53-0" | ||
| 10 | BIF_PARTITION_IMAGE[fsbl] ?= "${DEPLOY_DIR_IMAGE}/fsbl-${MACHINE}.elf" | ||
| 11 | BIF_PARTITION_DEPENDS[fsbl] ?= "virtual/fsbl:do_deploy" | ||
| 12 | |||
| 13 | # specify BIF partition attributes for PMU Firmware | ||
| 14 | # destination cpu for PMU. Location where PMU binary is present and dependency to build PMU Firmware | ||
| 15 | PMU_FIRMWARE_IMAGE_NAME ??= "pmu-firmware-${MACHINE}" | ||
| 16 | BIF_PARTITION_ATTR[pmu] ?= "destination_cpu=pmu" | ||
| 17 | BIF_PARTITION_IMAGE[pmu] ?= "${DEPLOY_DIR_IMAGE}/${PMU_FIRMWARE_IMAGE_NAME}.elf" | ||
| 18 | BIF_PARTITION_DEPENDS[pmu] ?= "virtual/pmu-firmware:do_deploy" | ||
| 19 | |||
| 20 | # specify BIF partition attributes for ATF | ||
| 21 | # destination cpu for ATF, security levels. Location where ATF binary is present (dependency is not required as ATF is always built for ZU+, see zcu102-zynqmp.conf) | ||
| 22 | BIF_PARTITION_ATTR[atf] ?= "destination_cpu=a53-0,exception_level=el-3,trustzone" | ||
| 23 | BIF_PARTITION_IMAGE[atf] ?= "${DEPLOY_DIR_IMAGE}/arm-trusted-firmware.elf" | ||
| 24 | BIF_PARTITION_DEPENDS[atf] ?= "arm-trusted-firmware:do_deploy" | ||
| 25 | |||
| 26 | # specify BIF partition attributes for u-boot | ||
| 27 | # destination cpu for u-boot, security levels. Location where u-boot binary is present (dependency is not required as u-boot is always built for ZU+, see zcu102-zynqmp.conf) | ||
| 28 | BIF_PARTITION_ATTR[u-boot] ?= "destination_cpu=a53-0,exception_level=el-2" | ||
| 29 | BIF_PARTITION_IMAGE[u-boot] ?= "${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.elf" | ||
| 30 | BIF_PARTITION_DEPENDS[u-boot] ?= "virtual/bootloader:do_deploy" | ||
| 31 | |||
| 32 | # specify BIF partition attributes for dtb | ||
| 33 | BIF_PARTITION_ATTR[dtb] ?= "load=0x100000" | ||
| 34 | BIF_PARTITION_IMAGE[dtb] ?= "${DEPLOY_DIR_IMAGE}/system.dtb" | ||
| 35 | BIF_PARTITION_DEPENDS[dtb] ?= "virtual/dtb:do_deploy" | ||
| 36 | |||
| 37 | # enable bitstream-Note this is not enabled by default (missing in BIF_PARTITION_ATTR) | ||
| 38 | BIF_PARTITION_ATTR[bitstream] ?= "destination_device=pl" | ||
| 39 | BIF_PARTITION_IMAGE[bitstream] ?= "${DEPLOY_DIR_IMAGE}/download-${MACHINE}.bit" | ||
| 40 | BIF_PARTITION_DEPENDS[bitstream] ?= "virtual/bitstream:do_deploy" | ||
diff --git a/meta-xilinx-bsp/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb b/meta-xilinx-bsp/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb new file mode 100644 index 00000000..3a0535b7 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb | |||
| @@ -0,0 +1,190 @@ | |||
| 1 | SUMMARY = "Generates boot.bin using bootgen tool" | ||
| 2 | DESCRIPTION = "Manages task dependencies and creation of boot.bin. Use the \ | ||
| 3 | BIF_PARTITION_xyz global variables and flags to determine what makes it into \ | ||
| 4 | the image." | ||
| 5 | |||
| 6 | LICENSE = "BSD" | ||
| 7 | |||
| 8 | include machine-xilinx-${SOC_FAMILY}.inc | ||
| 9 | |||
| 10 | inherit deploy | ||
| 11 | |||
| 12 | PROVIDES = "virtual/boot-bin" | ||
| 13 | |||
| 14 | DEPENDS += "bootgen-native" | ||
| 15 | |||
| 16 | do_configure[depends] += "${@get_bootbin_depends(d)}" | ||
| 17 | |||
| 18 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 19 | |||
| 20 | BIF_FILE_PATH ?= "${B}/bootgen.bif" | ||
| 21 | |||
| 22 | LICENSE = "MIT" | ||
| 23 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
| 24 | |||
| 25 | SRC_URI += "${@('file://' + d.getVar("BIF_FILE_PATH")) if d.getVar("BIF_FILE_PATH") != (d.getVar('B') + '/bootgen.bif') else ''}" | ||
| 26 | |||
| 27 | BOOTGEN_EXTRA_ARGS ?= "" | ||
| 28 | |||
| 29 | BIF_PARTITION_ATTR_zynqmp = "${@'fsbl pmu atf dtb u-boot' if d.getVar('FPGA_MNGR_RECONFIG_ENABLE') == '1' else 'fsbl bitstream pmu atf dtb u-boot'}" | ||
| 30 | |||
| 31 | do_patch[noexec] = "1" | ||
| 32 | |||
| 33 | def get_bootbin_depends(d): | ||
| 34 | bootbindeps = "" | ||
| 35 | bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split() | ||
| 36 | attrdepends = d.getVarFlags("BIF_PARTITION_DEPENDS") or {} | ||
| 37 | for cfg in bifpartition: | ||
| 38 | if cfg in attrdepends: | ||
| 39 | bootbindeps = bootbindeps + " " + attrdepends[cfg] | ||
| 40 | |||
| 41 | return bootbindeps | ||
| 42 | |||
| 43 | def create_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): | ||
| 44 | import re, os | ||
| 45 | for cfg in config: | ||
| 46 | if cfg not in attrflags and common_attr: | ||
| 47 | error_msg = "%s: invalid ATTRIBUTE" % (cfg) | ||
| 48 | bb.error("BIF attribute Error: %s " % (error_msg)) | ||
| 49 | else: | ||
| 50 | if common_attr: | ||
| 51 | cfgval = d.expand(attrflags[cfg]).split(',') | ||
| 52 | cfgstr = "\t [%s] %s\n" % (cfg,', '.join(cfgval)) | ||
| 53 | else: | ||
| 54 | if cfg not in attrimage: | ||
| 55 | error_msg = "%s: invalid or missing elf or image" % (cfg) | ||
| 56 | bb.error("BIF atrribute Error: %s " % (error_msg)) | ||
| 57 | imagestr = d.expand(attrimage[cfg]) | ||
| 58 | if os.stat(imagestr).st_size == 0: | ||
| 59 | bb.warn("Empty file %s, excluding from bif file" %(imagestr)) | ||
| 60 | continue | ||
| 61 | if cfg in attrflags: | ||
| 62 | cfgval = d.expand(attrflags[cfg]).split(',') | ||
| 63 | cfgstr = "\t [%s] %s\n" % (', '.join(cfgval), imagestr) | ||
| 64 | else: | ||
| 65 | cfgstr = "\t %s\n" % (imagestr) | ||
| 66 | biffd.write(cfgstr) | ||
| 67 | |||
| 68 | return | ||
| 69 | |||
| 70 | def create_versal_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): | ||
| 71 | import re, os | ||
| 72 | id_dict = {} | ||
| 73 | for cfg in config: | ||
| 74 | if cfg not in attrflags and common_attr: | ||
| 75 | error_msg = "%s: invalid ATTRIBUTE" % (cfg) | ||
| 76 | bb.error("BIF attribute Error: %s " % (error_msg)) | ||
| 77 | else: | ||
| 78 | if common_attr: | ||
| 79 | cfgval = d.expand(attrflags[cfg]).split(',') | ||
| 80 | #TODO: Does common attribute syntax change in similar way for versal? | ||
| 81 | cfgstr = "\t { %s %s }\n" % (cfg,', '.join(cfgval)) | ||
| 82 | biffd.write(cfgstr) | ||
| 83 | else: | ||
| 84 | if cfg not in attrimage: | ||
| 85 | error_msg = "%s: invalid or missing elf or image" % (cfg) | ||
| 86 | bb.error("BIF atrribute Error: %s " % (error_msg)) | ||
| 87 | imagestr = d.expand(attrimage[cfg]) | ||
| 88 | if os.stat(imagestr).st_size == 0: | ||
| 89 | bb.warn("Empty file %s, excluding from bif file" %(imagestr)) | ||
| 90 | continue | ||
| 91 | if cfg in attrflags: | ||
| 92 | cfgval = d.expand(attrflags[cfg]).split(',') | ||
| 93 | try: | ||
| 94 | id = d.expand(ids[cfg]) | ||
| 95 | except: | ||
| 96 | id = '0' | ||
| 97 | cfgstr = "\t { %s, file=%s }\n" % (', '.join(cfgval), imagestr) | ||
| 98 | try: | ||
| 99 | id_dict[id] += cfgstr | ||
| 100 | except: | ||
| 101 | id_dict[id] = cfgstr | ||
| 102 | else: | ||
| 103 | cfgstr = "\t %s\n" % (imagestr) | ||
| 104 | for id, string in id_dict.items(): | ||
| 105 | biffd.write("\timage {\n") | ||
| 106 | if id != '0': | ||
| 107 | biffd.write("\t id = " + id + "\n") | ||
| 108 | biffd.write(string) | ||
| 109 | biffd.write("\t}\n") | ||
| 110 | return | ||
| 111 | |||
| 112 | python do_configure() { | ||
| 113 | fp = d.getVar("BIF_FILE_PATH") | ||
| 114 | if fp == (d.getVar('B') + '/bootgen.bif'): | ||
| 115 | arch = d.getVar("SOC_FAMILY") | ||
| 116 | biffunc = {'versal':create_versal_bif, 'zynq':create_bif, 'zynqmp':create_bif} | ||
| 117 | biffd = open(fp, 'w') | ||
| 118 | biffd.write("the_ROM_image:\n") | ||
| 119 | biffd.write("{\n") | ||
| 120 | |||
| 121 | bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split() | ||
| 122 | if bifattr: | ||
| 123 | attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {} | ||
| 124 | biffunc[arch](bifattr, attrflags,'','', 1, biffd, d) | ||
| 125 | |||
| 126 | bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split() | ||
| 127 | if bifpartition: | ||
| 128 | attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {} | ||
| 129 | attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {} | ||
| 130 | ids = d.getVarFlags("BIF_PARTITION_ID") or {} | ||
| 131 | biffunc[arch](bifpartition, attrflags, attrimage, ids, 0, biffd, d) | ||
| 132 | |||
| 133 | biffd.write("}") | ||
| 134 | biffd.close() | ||
| 135 | else: | ||
| 136 | print("Using custom BIF file: " + d.getVar("BIF_FILE_PATH") ) | ||
| 137 | } | ||
| 138 | |||
| 139 | do_configure[vardeps] += "BIF_PARTITION_ATTR BIF_PARTITION_IMAGE BIF_COMMON_ATTR" | ||
| 140 | |||
| 141 | do_compile() { | ||
| 142 | cd ${WORKDIR} | ||
| 143 | rm -f ${B}/BOOT.bin | ||
| 144 | if [ "${BIF_FILE_PATH}" != "${B}/bootgen.bif" ];then | ||
| 145 | BIF_FILE_PATH="${WORKDIR}${BIF_FILE_PATH}" | ||
| 146 | fi | ||
| 147 | bootgen -image ${BIF_FILE_PATH} -arch ${SOC_FAMILY} ${BOOTGEN_EXTRA_ARGS} -w -o ${B}/BOOT.bin | ||
| 148 | if [ ! -e ${B}/BOOT.bin ]; then | ||
| 149 | bbfatal "bootgen failed. See log" | ||
| 150 | fi | ||
| 151 | } | ||
| 152 | |||
| 153 | do_compile_append_versal() { | ||
| 154 | dd if=/dev/zero bs=256M count=1 > ${B}/QEMU_qspi.bin | ||
| 155 | dd if=${B}/BOOT.bin of=${B}/QEMU_qspi.bin bs=1 seek=0 conv=notrunc | ||
| 156 | dd if=${DEPLOY_DIR_IMAGE}/boot.scr of=${B}/QEMU_qspi.bin bs=1 seek=66584576 conv=notrunc | ||
| 157 | } | ||
| 158 | |||
| 159 | do_install() { | ||
| 160 | install -d ${D}/boot | ||
| 161 | install -m 0644 ${B}/BOOT.bin ${D}/boot/BOOT.bin | ||
| 162 | } | ||
| 163 | |||
| 164 | inherit image-artifact-names | ||
| 165 | |||
| 166 | QEMUQSPI_BASE_NAME ?= "QEMU_qspi-${MACHINE}${IMAGE_VERSION_SUFFIX}" | ||
| 167 | |||
| 168 | BOOTBIN_BASE_NAME ?= "BOOT-${MACHINE}${IMAGE_VERSION_SUFFIX}" | ||
| 169 | |||
| 170 | do_deploy() { | ||
| 171 | install -d ${DEPLOYDIR} | ||
| 172 | install -m 0644 ${B}/BOOT.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}.bin | ||
| 173 | ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/BOOT-${MACHINE}.bin | ||
| 174 | ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/boot.bin | ||
| 175 | } | ||
| 176 | |||
| 177 | do_deploy_append_versal () { | ||
| 178 | |||
| 179 | install -m 0644 ${B}/BOOT_bh.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}_bh.bin | ||
| 180 | ln -sf ${BOOTBIN_BASE_NAME}_bh.bin ${DEPLOYDIR}/BOOT-${MACHINE}_bh.bin | ||
| 181 | |||
| 182 | install -m 0644 ${B}/QEMU_qspi.bin ${DEPLOYDIR}/${QEMUQSPI_BASE_NAME}.bin | ||
| 183 | ln -sf ${QEMUQSPI_BASE_NAME}.bin ${DEPLOYDIR}/QEMU_qspi-${MACHINE}.bin | ||
| 184 | } | ||
| 185 | |||
| 186 | FILES_${PN} += "/boot/BOOT.bin" | ||
| 187 | SYSROOT_DIRS += "/boot" | ||
| 188 | |||
| 189 | addtask do_deploy before do_build after do_compile | ||
| 190 | |||
diff --git a/meta-xilinx-bsp/recipes-bsp/bootbin/xilinx-mcs_1.0.bb b/meta-xilinx-bsp/recipes-bsp/bootbin/xilinx-mcs_1.0.bb new file mode 100644 index 00000000..4e3b11db --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/bootbin/xilinx-mcs_1.0.bb | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | SUMMARY = "Generates boot.mcs using vivado" | ||
| 2 | DESCRIPTION = "Manages task dependencies and creation of boot.mcs for microblaze" | ||
| 3 | |||
| 4 | LICENSE = "BSD" | ||
| 5 | |||
| 6 | PROVIDES = "virtual/boot-bin" | ||
| 7 | |||
| 8 | DEPENDS = "bitstream-microblaze" | ||
| 9 | |||
| 10 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 11 | |||
| 12 | COMPATIBLE_MACHINE ?= "^$" | ||
| 13 | COMPATIBLE_MACHINE_microblaze = ".*" | ||
| 14 | |||
| 15 | inherit deploy image-artifact-names | ||
| 16 | |||
| 17 | do_fetch[noexec] = "1" | ||
| 18 | do_unpack[noexec] = "1" | ||
| 19 | do_patch[noexec] = "1" | ||
| 20 | |||
| 21 | PROC ??= "kc705_i/microblaze_0" | ||
| 22 | PROC_kc705 = "kc705_i/microblaze_0" | ||
| 23 | |||
| 24 | FLASH_SIZE ??= "0x80" | ||
| 25 | FLASH_INTERFACE ??= "BPIx16" | ||
| 26 | MB_OUT_FORMAT ??= "mcs" | ||
| 27 | BOOT_EXT = "${@d.getVar('MB_OUT_FORMAT').lower()}" | ||
| 28 | |||
| 29 | BITSTREAM_FILE ?= "${RECIPE_SYSROOT}/boot/bitstream/download.bit" | ||
| 30 | B = "${WORKDIR}/build" | ||
| 31 | WR_CFGMEM_MISC ?= "-loadbit \" up 0 ${BITSTREAM_FILE}\"" | ||
| 32 | |||
| 33 | do_check_for_vivado() { | ||
| 34 | bbnote "Checking Vivado install path" | ||
| 35 | which "vivado" 2>/dev/null || { | ||
| 36 | bbfatal "Vivado not found! Please add \"INHERIT += \"vivado\"\" to your local.conf" | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | addtask do_check_for_vivado before do_configure | ||
| 41 | |||
| 42 | do_configure() { | ||
| 43 | echo " write_cfgmem -force -format ${MB_OUT_FORMAT} -size ${FLASH_SIZE} -interface ${FLASH_INTERFACE} ${WR_CFGMEM_MISC} ${B}/BOOT.${BOOT_EXT} " > ${B}/write_cfgmem_boot_mcs.tcl | ||
| 44 | if [ ! -e ${B}/write_cfgmem_boot_mcs.tcl ]; then | ||
| 45 | bbfatal "write_cfgmem_boot_mcs.tcl creation failed. See log for details" | ||
| 46 | fi | ||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | do_compile() { | ||
| 51 | vivado -log "${B}/cfgmem_mcs.log" -jou "${B}/cfgmem_mcs.jou" -mode batch -s ${B}/write_cfgmem_boot_mcs.tcl | ||
| 52 | if [ ! -e ${B}/BOOT.${BOOT_EXT} ]; then | ||
| 53 | bbfatal "BOOT.${BOOT_EXT} failed. See log" | ||
| 54 | fi | ||
| 55 | } | ||
| 56 | |||
| 57 | do_install() { | ||
| 58 | : | ||
| 59 | } | ||
| 60 | |||
| 61 | BOOT_BASE_NAME ?= "BOOT-${MACHINE}${IMAGE_VERSION_SUFFIX}" | ||
| 62 | |||
| 63 | do_deploy() { | ||
| 64 | #install BOOT.mcs | ||
| 65 | if [ -e ${B}/BOOT.${BOOT_EXT} ]; then | ||
| 66 | install -Dm 0644 ${B}/BOOT.${BOOT_EXT} ${DEPLOYDIR}/${BOOT_BASE_NAME}.${BOOT_EXT} | ||
| 67 | ln -sf ${BOOT_BASE_NAME}.${BOOT_EXT} ${DEPLOYDIR}/BOOT-${MACHINE}.${BOOT_EXT} | ||
| 68 | fi | ||
| 69 | } | ||
| 70 | addtask do_deploy before do_build after do_compile | ||
