blob: 40a3d75d098123b544e49a7ced73eb176a8b73e4 [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
27ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}"
28ATF_BASE_NAME[vardepsexclude] = "DATETIME"
29
Brad Bishop26bdd442019-08-16 17:08:17 -040030COMPATIBLE_MACHINE ?= "^$"
31COMPATIBLE_MACHINE_zynqmp = ".*"
32COMPATIBLE_MACHINE_versal = ".*"
Brad Bishop286d45c2018-10-02 15:21:57 -040033
Brad Bishop26bdd442019-08-16 17:08:17 -040034PLATFORM_zynqmp = "zynqmp"
35PLATFORM_versal = "versal"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036
Brad Bishop286d45c2018-10-02 15:21:57 -040037# requires CROSS_COMPILE set by hand as there is no configure script
38export CROSS_COMPILE="${TARGET_PREFIX}"
39
40# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
41CFLAGS[unexport] = "1"
42LDFLAGS[unexport] = "1"
43AS[unexport] = "1"
44LD[unexport] = "1"
45
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046ATF_CONSOLE ?= ""
47ATF_CONSOLE_zynqmp = "cadence"
Brad Bishop26bdd442019-08-16 17:08:17 -040048ATF_CONSOLE_versal ?= "pl011"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080049
Andrew Geissler84ad7c52020-06-27 00:00:16 -050050DEBUG_ATF ?= ""
51DEBUG_ATF_versal ?= "1"
Brad Bishop26bdd442019-08-16 17:08:17 -040052
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
Brad Bishop26bdd442019-08-16 17:08:17 -040054EXTRA_OEMAKE_append_versal = "${@' VERSAL_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050055EXTRA_OEMAKE_append = " ${@bb.utils.contains('DEBUG_ATF', '1', ' DEBUG=${DEBUG_ATF}', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080056
Andrew Geissler84ad7c52020-06-27 00:00:16 -050057OUTPUT_DIR = "${@bb.utils.contains('DEBUG_ATF', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080058
59ATF_MEM_BASE ?= ""
60ATF_MEM_SIZE ?= ""
61
62EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
63EXTRA_OEMAKE_zynqmp_append = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}"
64
Brad Bishop26bdd442019-08-16 17:08:17 -040065EXTRA_OEMAKE_append_versal = "${@' VERSAL_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}"
66EXTRA_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 -050067EXTRA_OEMAKE_append_vc-p-a2197-00-versal =" VERSAL_PLATFORM=silicon"
Brad Bishop26bdd442019-08-16 17:08:17 -040068
Brad Bishop286d45c2018-10-02 15:21:57 -040069do_configure() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080070 oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM}
Brad Bishop286d45c2018-10-02 15:21:57 -040071}
72
73do_compile() {
74 oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31
75}
76
77do_install() {
Andrew Geissler84ad7c52020-06-27 00:00:16 -050078 install -d ${D}/boot
79 install -Dm 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${D}/boot/${PN}-${SRCPV}.elf
Brad Bishop286d45c2018-10-02 15:21:57 -040080}
81
Brad Bishop286d45c2018-10-02 15:21:57 -040082do_deploy() {
83 install -d ${DEPLOYDIR}
84 install -m 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${DEPLOYDIR}/${ATF_BASE_NAME}.elf
85 ln -sf ${ATF_BASE_NAME}.elf ${DEPLOYDIR}/${PN}.elf
86 install -m 0644 ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.bin
87 ln -sf ${ATF_BASE_NAME}.bin ${DEPLOYDIR}/${PN}.bin
88
89 # Get the entry point address from the elf.
90 BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g')
91 mkimage -A arm64 -O arm-trusted-firmware -T kernel -C none \
92 -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \
93 -d ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.ub
94 ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/${PN}.ub
95 ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/atf-uboot.ub
96}
97addtask deploy before do_build after do_compile
Andrew Geissler84ad7c52020-06-27 00:00:16 -050098FILES_${PN} += "/boot/${PN}-${SRCPV}.elf"