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 ?= "" |
| 16 | ATF_VERSION ?= "1.4" |
| 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 | |
| 28 | COMPATIBLE_MACHINE = "zynqmp" |
| 29 | PLATFORM_zynqmp = "zynqmp" |
| 30 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 31 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 32 | # requires CROSS_COMPILE set by hand as there is no configure script |
| 33 | export CROSS_COMPILE="${TARGET_PREFIX}" |
| 34 | |
| 35 | # Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application |
| 36 | CFLAGS[unexport] = "1" |
| 37 | LDFLAGS[unexport] = "1" |
| 38 | AS[unexport] = "1" |
| 39 | LD[unexport] = "1" |
| 40 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 41 | ATF_CONSOLE ?= "" |
| 42 | ATF_CONSOLE_zynqmp = "cadence" |
| 43 | |
| 44 | DEBUG ?= "" |
| 45 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}" |
| 46 | EXTRA_OEMAKE_append = " ${@bb.utils.contains('DEBUG', '1', ' DEBUG=${DEBUG}', '', d)}" |
| 47 | |
| 48 | OUTPUT_DIR = "${@bb.utils.contains('DEBUG', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}" |
| 49 | |
| 50 | ATF_MEM_BASE ?= "" |
| 51 | ATF_MEM_SIZE ?= "" |
| 52 | |
| 53 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" |
| 54 | EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" |
| 55 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 56 | do_configure() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 57 | oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | do_compile() { |
| 61 | oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31 |
| 62 | } |
| 63 | |
| 64 | do_install() { |
| 65 | : |
| 66 | } |
| 67 | |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 68 | do_deploy() { |
| 69 | install -d ${DEPLOYDIR} |
| 70 | install -m 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${DEPLOYDIR}/${ATF_BASE_NAME}.elf |
| 71 | ln -sf ${ATF_BASE_NAME}.elf ${DEPLOYDIR}/${PN}.elf |
| 72 | install -m 0644 ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.bin |
| 73 | ln -sf ${ATF_BASE_NAME}.bin ${DEPLOYDIR}/${PN}.bin |
| 74 | |
| 75 | # Get the entry point address from the elf. |
| 76 | BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g') |
| 77 | mkimage -A arm64 -O arm-trusted-firmware -T kernel -C none \ |
| 78 | -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \ |
| 79 | -d ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.ub |
| 80 | ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/${PN}.ub |
| 81 | ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/atf-uboot.ub |
| 82 | } |
| 83 | addtask deploy before do_build after do_compile |