blob: d64fad9cc6deb44fff19f304fc5a5dca25e5929a [file] [log] [blame]
Brad Bishop286d45c2018-10-02 15:21:57 -04001DESCRIPTION = "ARM Trusted Firmware"
2
3LICENSE = "BSD"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08004LIC_FILES_CHKSUM = "file://license.rst;md5=e927e02bca647e14efd87e9e914b2443"
Brad Bishop286d45c2018-10-02 15:21:57 -04005
6PROVIDES = "virtual/arm-trusted-firmware"
7
8inherit deploy
9
10DEPENDS += "u-boot-mkimage-native"
11
12S = "${WORKDIR}/git"
13B = "${WORKDIR}/build"
14
15XILINX_RELEASE_VERSION ?= ""
16ATF_VERSION ?= "1.4"
17ATF_VERSION_EXTENSION ?= "-xilinx-${XILINX_RELEASE_VERSION}"
18PV = "${ATF_VERSION}${ATF_VERSION_EXTENSION}+git${SRCPV}"
19
20BRANCH ?= ""
21REPO ?= "git://github.com/Xilinx/arm-trusted-firmware.git;protocol=https"
22BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
23SRC_URI = "${REPO};${BRANCHARG}"
24
25ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}"
26ATF_BASE_NAME[vardepsexclude] = "DATETIME"
27
28COMPATIBLE_MACHINE = "zynqmp"
29PLATFORM_zynqmp = "zynqmp"
30
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080031
Brad Bishop286d45c2018-10-02 15:21:57 -040032# requires CROSS_COMPILE set by hand as there is no configure script
33export CROSS_COMPILE="${TARGET_PREFIX}"
34
35# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
36CFLAGS[unexport] = "1"
37LDFLAGS[unexport] = "1"
38AS[unexport] = "1"
39LD[unexport] = "1"
40
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080041ATF_CONSOLE ?= ""
42ATF_CONSOLE_zynqmp = "cadence"
43
44DEBUG ?= ""
45EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
46EXTRA_OEMAKE_append = " ${@bb.utils.contains('DEBUG', '1', ' DEBUG=${DEBUG}', '', d)}"
47
48OUTPUT_DIR = "${@bb.utils.contains('DEBUG', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}"
49
50ATF_MEM_BASE ?= ""
51ATF_MEM_SIZE ?= ""
52
53EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
54EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}"
55
Brad Bishop286d45c2018-10-02 15:21:57 -040056do_configure() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057 oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM}
Brad Bishop286d45c2018-10-02 15:21:57 -040058}
59
60do_compile() {
61 oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31
62}
63
64do_install() {
65 :
66}
67
Brad Bishop286d45c2018-10-02 15:21:57 -040068do_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}
83addtask deploy before do_build after do_compile