blob: 785f915eabb69dd9eff61b1152a8d1f50afb35b3 [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 ?= ""
Brad Bishop754b8fa2019-08-20 09:16:20 -040016ATF_VERSION ?= "2.0"
Brad Bishop286d45c2018-10-02 15:21:57 -040017ATF_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
Brad Bishop26bdd442019-08-16 17:08:17 -040028COMPATIBLE_MACHINE ?= "^$"
29COMPATIBLE_MACHINE_zynqmp = ".*"
30COMPATIBLE_MACHINE_versal = ".*"
Brad Bishop286d45c2018-10-02 15:21:57 -040031
Brad Bishop26bdd442019-08-16 17:08:17 -040032PLATFORM_zynqmp = "zynqmp"
33PLATFORM_versal = "versal"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034
Brad Bishop286d45c2018-10-02 15:21:57 -040035# requires CROSS_COMPILE set by hand as there is no configure script
36export CROSS_COMPILE="${TARGET_PREFIX}"
37
38# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
39CFLAGS[unexport] = "1"
40LDFLAGS[unexport] = "1"
41AS[unexport] = "1"
42LD[unexport] = "1"
43
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080044ATF_CONSOLE ?= ""
45ATF_CONSOLE_zynqmp = "cadence"
Brad Bishop26bdd442019-08-16 17:08:17 -040046ATF_CONSOLE_versal ?= "pl011"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080047
48DEBUG ?= ""
Brad Bishop26bdd442019-08-16 17:08:17 -040049DEBUG_versal ?= "1"
50
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
Brad Bishop26bdd442019-08-16 17:08:17 -040052EXTRA_OEMAKE_append_versal = "${@' VERSAL_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053EXTRA_OEMAKE_append = " ${@bb.utils.contains('DEBUG', '1', ' DEBUG=${DEBUG}', '', d)}"
54
55OUTPUT_DIR = "${@bb.utils.contains('DEBUG', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}"
56
57ATF_MEM_BASE ?= ""
58ATF_MEM_SIZE ?= ""
59
60EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
61EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}"
62
Brad Bishop26bdd442019-08-16 17:08:17 -040063EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
64EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}"
65
Brad Bishop286d45c2018-10-02 15:21:57 -040066do_configure() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080067 oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM}
Brad Bishop286d45c2018-10-02 15:21:57 -040068}
69
70do_compile() {
71 oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31
72}
73
74do_install() {
75 :
76}
77
Brad Bishop286d45c2018-10-02 15:21:57 -040078do_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}
93addtask deploy before do_build after do_compile