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 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 27 | ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 28 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 29 | COMPATIBLE_MACHINE ?= "^$" |
| 30 | COMPATIBLE_MACHINE_zynqmp = ".*" |
| 31 | COMPATIBLE_MACHINE_versal = ".*" |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 32 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 33 | PLATFORM_zynqmp = "zynqmp" |
| 34 | PLATFORM_versal = "versal" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 35 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 36 | # requires CROSS_COMPILE set by hand as there is no configure script |
| 37 | export CROSS_COMPILE="${TARGET_PREFIX}" |
| 38 | |
| 39 | # Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application |
| 40 | CFLAGS[unexport] = "1" |
| 41 | LDFLAGS[unexport] = "1" |
| 42 | AS[unexport] = "1" |
| 43 | LD[unexport] = "1" |
| 44 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 45 | ATF_CONSOLE ?= "" |
| 46 | ATF_CONSOLE_zynqmp = "cadence" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 47 | ATF_CONSOLE_versal ?= "pl011" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 48 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 49 | DEBUG_ATF ?= "" |
| 50 | DEBUG_ATF_versal ?= "1" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 51 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 52 | 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] | 53 | 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] | 54 | 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] | 55 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 56 | 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] | 57 | |
| 58 | ATF_MEM_BASE ?= "" |
| 59 | ATF_MEM_SIZE ?= "" |
| 60 | |
| 61 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" |
| 62 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" |
| 63 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 64 | EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" |
| 65 | 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] | 66 | EXTRA_OEMAKE_append_vc-p-a2197-00-versal =" VERSAL_PLATFORM=silicon" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 67 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 68 | do_configure() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 69 | oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | do_compile() { |
| 73 | oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31 |
| 74 | } |
| 75 | |
| 76 | do_install() { |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 77 | install -d ${D}/boot |
| 78 | 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] | 79 | } |
| 80 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 81 | do_deploy() { |
| 82 | install -d ${DEPLOYDIR} |
| 83 | install -m 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${DEPLOYDIR}/${ATF_BASE_NAME}.elf |
| 84 | ln -sf ${ATF_BASE_NAME}.elf ${DEPLOYDIR}/${PN}.elf |
| 85 | install -m 0644 ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.bin |
| 86 | ln -sf ${ATF_BASE_NAME}.bin ${DEPLOYDIR}/${PN}.bin |
| 87 | |
| 88 | # Get the entry point address from the elf. |
| 89 | BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g') |
| 90 | mkimage -A arm64 -O arm-trusted-firmware -T kernel -C none \ |
| 91 | -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \ |
| 92 | -d ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.ub |
| 93 | ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/${PN}.ub |
| 94 | ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/atf-uboot.ub |
| 95 | } |
| 96 | addtask deploy before do_build after do_compile |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 97 | FILES_${PN} += "/boot/${PN}-${SRCPV}.elf" |