blob: b086f8ca2ea87a32429601633e9fd51cb253df28 [file] [log] [blame]
Brad Bishop286d45c2018-10-02 15:21:57 -04001DESCRIPTION = "ARM Trusted Firmware"
2
3LICENSE = "BSD"
Andrew Geissler84ad7c52020-06-27 00:00:16 -05004LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031"
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
Andrew Geissler84ad7c52020-06-27 00:00:16 -050015SYSROOT_DIRS += "/boot"
16
Brad Bishop286d45c2018-10-02 15:21:57 -040017XILINX_RELEASE_VERSION ?= ""
Andrew Geissler84ad7c52020-06-27 00:00:16 -050018ATF_VERSION ?= "2.2"
Brad Bishop286d45c2018-10-02 15:21:57 -040019ATF_VERSION_EXTENSION ?= "-xilinx-${XILINX_RELEASE_VERSION}"
20PV = "${ATF_VERSION}${ATF_VERSION_EXTENSION}+git${SRCPV}"
21
22BRANCH ?= ""
23REPO ?= "git://github.com/Xilinx/arm-trusted-firmware.git;protocol=https"
24BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
25SRC_URI = "${REPO};${BRANCHARG}"
26
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050027ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}"
Brad Bishop286d45c2018-10-02 15:21:57 -040028
Brad Bishop26bdd442019-08-16 17:08:17 -040029COMPATIBLE_MACHINE ?= "^$"
30COMPATIBLE_MACHINE_zynqmp = ".*"
31COMPATIBLE_MACHINE_versal = ".*"
Brad Bishop286d45c2018-10-02 15:21:57 -040032
Brad Bishop26bdd442019-08-16 17:08:17 -040033PLATFORM_zynqmp = "zynqmp"
34PLATFORM_versal = "versal"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080035
Brad Bishop286d45c2018-10-02 15:21:57 -040036# requires CROSS_COMPILE set by hand as there is no configure script
37export CROSS_COMPILE="${TARGET_PREFIX}"
38
39# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
40CFLAGS[unexport] = "1"
41LDFLAGS[unexport] = "1"
42AS[unexport] = "1"
43LD[unexport] = "1"
44
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045ATF_CONSOLE ?= ""
46ATF_CONSOLE_zynqmp = "cadence"
Brad Bishop26bdd442019-08-16 17:08:17 -040047ATF_CONSOLE_versal ?= "pl011"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080048
Andrew Geissler84ad7c52020-06-27 00:00:16 -050049DEBUG_ATF ?= ""
50DEBUG_ATF_versal ?= "1"
Brad Bishop26bdd442019-08-16 17:08:17 -040051
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080052EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
Brad Bishop26bdd442019-08-16 17:08:17 -040053EXTRA_OEMAKE_append_versal = "${@' VERSAL_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050054EXTRA_OEMAKE_append = " ${@bb.utils.contains('DEBUG_ATF', '1', ' DEBUG=${DEBUG_ATF}', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080055
Andrew Geissler84ad7c52020-06-27 00:00:16 -050056OUTPUT_DIR = "${@bb.utils.contains('DEBUG_ATF', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057
58ATF_MEM_BASE ?= ""
59ATF_MEM_SIZE ?= ""
60
61EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
62EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}"
63
Brad Bishop26bdd442019-08-16 17:08:17 -040064EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
65EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050066EXTRA_OEMAKE_append_vc-p-a2197-00-versal =" VERSAL_PLATFORM=silicon"
Brad Bishop26bdd442019-08-16 17:08:17 -040067
Brad Bishop286d45c2018-10-02 15:21:57 -040068do_configure() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080069 oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM}
Brad Bishop286d45c2018-10-02 15:21:57 -040070}
71
72do_compile() {
73 oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31
74}
75
76do_install() {
Andrew Geissler84ad7c52020-06-27 00:00:16 -050077 install -d ${D}/boot
78 install -Dm 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${D}/boot/${PN}-${SRCPV}.elf
Brad Bishop286d45c2018-10-02 15:21:57 -040079}
80
Brad Bishop286d45c2018-10-02 15:21:57 -040081do_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}
96addtask deploy before do_build after do_compile
Andrew Geissler84ad7c52020-06-27 00:00:16 -050097FILES_${PN} += "/boot/${PN}-${SRCPV}.elf"