Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 1 | DESCRIPTION = "ARM Trusted Firmware" |
| 2 | |
| 3 | LICENSE = "BSD" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 4 | LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 5 | |
| 6 | PROVIDES = "virtual/arm-trusted-firmware" |
| 7 | |
| 8 | inherit deploy |
| 9 | |
| 10 | DEPENDS += "u-boot-mkimage-native" |
| 11 | |
| 12 | S = "${WORKDIR}/git" |
| 13 | B = "${WORKDIR}/build" |
| 14 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 15 | SYSROOT_DIRS += "/boot" |
| 16 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 17 | XILINX_RELEASE_VERSION ?= "" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 18 | ATF_VERSION ?= "2.2" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 19 | ATF_VERSION_EXTENSION ?= "-xilinx-${XILINX_RELEASE_VERSION}" |
| 20 | PV = "${ATF_VERSION}${ATF_VERSION_EXTENSION}+git${SRCPV}" |
| 21 | |
| 22 | BRANCH ?= "" |
| 23 | REPO ?= "git://github.com/Xilinx/arm-trusted-firmware.git;protocol=https" |
| 24 | BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" |
| 25 | SRC_URI = "${REPO};${BRANCHARG}" |
| 26 | |
| 27 | ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}" |
| 28 | ATF_BASE_NAME[vardepsexclude] = "DATETIME" |
| 29 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 30 | COMPATIBLE_MACHINE ?= "^$" |
| 31 | COMPATIBLE_MACHINE_zynqmp = ".*" |
| 32 | COMPATIBLE_MACHINE_versal = ".*" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 33 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 34 | PLATFORM_zynqmp = "zynqmp" |
| 35 | PLATFORM_versal = "versal" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 36 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 37 | # requires CROSS_COMPILE set by hand as there is no configure script |
| 38 | export CROSS_COMPILE="${TARGET_PREFIX}" |
| 39 | |
| 40 | # Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application |
| 41 | CFLAGS[unexport] = "1" |
| 42 | LDFLAGS[unexport] = "1" |
| 43 | AS[unexport] = "1" |
| 44 | LD[unexport] = "1" |
| 45 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 46 | ATF_CONSOLE ?= "" |
| 47 | ATF_CONSOLE_zynqmp = "cadence" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 48 | ATF_CONSOLE_versal ?= "pl011" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 49 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 50 | DEBUG_ATF ?= "" |
| 51 | DEBUG_ATF_versal ?= "1" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 52 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 53 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 54 | EXTRA_OEMAKE_append_versal = "${@' VERSAL_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 55 | EXTRA_OEMAKE_append = " ${@bb.utils.contains('DEBUG_ATF', '1', ' DEBUG=${DEBUG_ATF}', '', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 56 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 57 | OUTPUT_DIR = "${@bb.utils.contains('DEBUG_ATF', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 58 | |
| 59 | ATF_MEM_BASE ?= "" |
| 60 | ATF_MEM_SIZE ?= "" |
| 61 | |
| 62 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" |
| 63 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" |
| 64 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 65 | EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" |
| 66 | EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 67 | EXTRA_OEMAKE_append_vc-p-a2197-00-versal =" VERSAL_PLATFORM=silicon" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 68 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 69 | do_configure() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 70 | oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | do_compile() { |
| 74 | oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31 |
| 75 | } |
| 76 | |
| 77 | do_install() { |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 78 | install -d ${D}/boot |
| 79 | install -Dm 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${D}/boot/${PN}-${SRCPV}.elf |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 80 | } |
| 81 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 82 | do_deploy() { |
| 83 | install -d ${DEPLOYDIR} |
| 84 | install -m 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${DEPLOYDIR}/${ATF_BASE_NAME}.elf |
| 85 | ln -sf ${ATF_BASE_NAME}.elf ${DEPLOYDIR}/${PN}.elf |
| 86 | install -m 0644 ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.bin |
| 87 | ln -sf ${ATF_BASE_NAME}.bin ${DEPLOYDIR}/${PN}.bin |
| 88 | |
| 89 | # Get the entry point address from the elf. |
| 90 | BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g') |
| 91 | mkimage -A arm64 -O arm-trusted-firmware -T kernel -C none \ |
| 92 | -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \ |
| 93 | -d ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.ub |
| 94 | ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/${PN}.ub |
| 95 | ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/atf-uboot.ub |
| 96 | } |
| 97 | addtask deploy before do_build after do_compile |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 98 | FILES_${PN} += "/boot/${PN}-${SRCPV}.elf" |