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