1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-30 12:30:14 +00:00

Move TF-A recipes to meta-arm directory

The TF-A recipes should only be in meta-arm-integration after we have
submitted them for inclusion in Yocto git tree.  Move them to the proper
location until this occurs.

Change-Id: Ia2fa5c5a377392aa45b801bd1f2ae4ca0f056c34
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Jon Mason
2020-01-06 21:09:38 -05:00
parent aab12c535e
commit a3a41fc092
2 changed files with 0 additions and 0 deletions
@@ -0,0 +1,126 @@
DESCRIPTION = "Trusted Firmware-A"
LICENSE = "BSD & Apache-2.0"
PROVIDES = "virtual/trusted-firmware-a"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit deploy
COMPATIBLE_MACHINE ?= "invalid"
# Platform must be set for each machine
TFA_PLATFORM ?= "invalid"
# Build for debug (set TFA_DEBUG to 1 to activate)
TFA_DEBUG ?= "0"
# Sub-directory in which to build.
# This must be coherent with BUILD_PLAT make parameter so that deploy can find
# the produced binaries
TFA_BUILD_DIR ?= "build-${TFA_PLATFORM}"
# set BUILD_PLAT depending on configured BUILD_DIR
EXTRA_OEMAKE += "BUILD_PLAT=${TFA_BUILD_DIR}"
# mbed TLS support (set TFA_MBEDTLS to 1 to activate)
TFA_MBEDTLS ?= "0"
# sub-directory in which mbedtls will be downloaded
TFA_MBEDTLS_DIR ?= "mbedtls"
# This should be set to MBEDTLS download URL if MBEDTLS is needed
SRC_URI_MBEDTLS ??= ""
# This should be set to MBEDTLS LIC FILES checksum
LIC_FILES_CHKSUM_MBEDTLS ??= ""
# add MBEDTLS to our sources if activated
SRC_URI += "${@bb.utils.contains('TFA_MBEDTLS', '1', '${SRC_URI_MBEDTLS}', '', d)}"
# add mbed TLS chksum
LIC_FILES_CHKSUM += "${@bb.utils.contains('TFA_MBEDTLS', '1', '${LIC_FILES_CHKSUM_MBEDTLS}', '', d)}"
# add mbed TLS to version
SRCREV_FORMAT_append = "${@bb.utils.contains('TFA_MBEDTLS', '1', '_mbedtls', '', d)}"
# U-boot support (set TFA_UBOOT to 1 to activate)
# When U-Boot support is activated BL33 is activated with u-boot.bin file
TFA_UBOOT ?= "0"
# What to build
# By default we only build bl1, do_deploy will install
# everything listed in this variable (by default bl1.bin)
TFA_BUILD_TARGET ?= "bl1"
# What to install
# do_deploy will install everything listed in this
# variable. It is set by default to TFA_BUILD_TARGET
TFA_INSTALL_TARGET ?= "${TFA_BUILD_TARGET}"
# Requires CROSS_COMPILE set by hand as there is no configure script
export CROSS_COMPILE="${TARGET_PREFIX}"
# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
CFLAGS[unexport] = "1"
LDFLAGS[unexport] = "1"
AS[unexport] = "1"
LD[unexport] = "1"
# No configure or install
do_configure[noexec] = "1"
do_install[noexec] = "1"
# We need dtc for dtbs compilation
# We need openssl for fiptool
DEPENDS_append = " dtc-native openssl-native"
# Add platform parameter
EXTRA_OEMAKE += "PLAT=${TFA_PLATFORM}"
# Handle TFA_DEBUG parameter
EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', ' DEBUG=${TFA_DEBUG}', '', d)}"
# Handle MBEDTLS
EXTRA_OEMAKE += "${@bb.utils.contains('TFA_MBEDTLS', '1', ' MBEDTLS_DIR=${TFA_MBEDTLS_DIR}', '', d)}"
# Uboot support
DEPENDS += " ${@bb.utils.contains('TFA_UBOOT', '1', 'u-boot', '', d)}"
do_compile[depends] += " ${@bb.utils.contains('TFA_UBOOT', '1', 'u-boot:do_deploy', '', d)}"
EXTRA_OEMAKE += "${@bb.utils.contains('TFA_UBOOT', '1', ' BL33=${DEPLOY_DIR_IMAGE}/u-boot.bin', '',d)}"
do_clean() {
if [ -f ${S}/Makefile ]; then
oe_runmake -C ${S} distclean
fi
}
do_compile() {
oe_runmake ${TFA_BUILD_TARGET}
}
do_deploy() {
install -d -m 755 ${DEPLOYDIR}
for atfbin in ${TFA_INSTALL_TARGET}; do
if [ "$atfbin" = "all" ]; then
# Target all is not handled by default
bberror "all as TFA_INSTALL_TARGET is not handled by do_deploy"
bberror "Please specify valid targets in TFA_INSTALL_TARGET or"
bberror "rewrite or turn off do_deploy"
exit 1
elif [ -f ${S}/${TFA_BUILD_DIR}/$atfbin.bin ]; then
echo "Install $atfbin.bin"
install -m 0644 ${S}/${TFA_BUILD_DIR}/$atfbin.bin \
${DEPLOYDIR}/$atfbin-${TFA_PLATFORM}.bin
elif [ -f ${S}/${TFA_BUILD_DIR}/$atfbin.elf ]; then
echo "Install $atfbin.elf"
install -m 0644 ${S}/${TFA_BUILD_DIR}/$atfbin.elf \
${DEPLOYDIR}/$atfbin-${TFA_PLATFORM}.elf
elif [ -f ${S}/${TFA_BUILD_DIR}/$atfbin ]; then
echo "Install $atfbin"
install -m 0644 ${S}/${TFA_BUILD_DIR}/$atfbin \
${DEPLOYDIR}/$atfbin-${TFA_PLATFORM}
elif [ "$atfbin" = "dtbs" ]; then
echo "dtbs install, skipped"
elif [ -f ${S}/tools/$atfbin/$atfbin ]; then
echo "Tools $atfbin install, skipped"
else
bberror "Unsupported TFA_INSTALL_TARGET target $atfbin"
exit 1
fi
done
}
addtask deploy before do_build after do_compile
@@ -0,0 +1,52 @@
#
# Trusted firmware-A 2.1
#
SRC_URI = "git://git.trustedfirmware.org/TF-A/trusted-firmware-a.git;protocol=https;name=tfa"
# Use TF-A for version
SRCREV_FORMAT = "tfa"
# TF-A v2.1
SRCREV_tfa = "e1286bdb968ee74fc52f96cf303a4218e1ae2950"
S = "${WORKDIR}/git"
LIC_FILES_CHKSUM = "file://license.rst;md5=c709b197e22b81ede21109dbffd5f363"
SRC_URI[tfa.md5sum] = "75c8f4958fb493d9bd7a8e5a9636ec18"
SRC_URI[tfa.sha256sum] = "7c4c00a4f28d3cfbb235fd1a1fb28c4d2fc1d657c9301686e7d8824ef575d059"
#
# mbed TLS source
# Those are used in trusted-firmware-a.inc if TFA_MBEDTLS is set to 1
#
SRC_URI_MBEDTLS = "git://github.com/ARMmbed/mbedtls.git;name=mbedtls;protocol=https;destsuffix=git/mbedtls"
# mbed TLS v2.16.2
SRCREV_mbedtls = "d81c11b8ab61fd5b2da8133aa73c5fe33a0633eb"
LIC_FILES_CHKSUM_MBEDTLS += " \
file://mbedtls/apache-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
file://mbedtls/LICENSE;md5=302d50a6369f5f22efdb674db908167a \
"
SRC_URI[mbedtls.md5sum] = "37cdec398ae9ebdd4640df74af893c95"
SRC_URI[mbedtls.sha256sum] = "a6834fcd7b7e64b83dfaaa6ee695198cb5019a929b2806cb0162e049f98206a4"
require trusted-firmware-a.inc
# The following hack is needed to fit properly in yocto build environment
# TFA is forcing the host compiler and its flags in the Makefile using :=
# assignment for GCC and CFLAGS.
# To properly use the native toolchain of yocto and the right libraries we need
# to pass the proper flags to gcc. This is achieved here by creating a gcc
# script to force passing to gcc the right CFLAGS and LDFLAGS
do_compile_prepend() {
#Create an host gcc build parser to ensure the proper include path is used
mkdir -p bin
echo "#!/usr/bin/env bash" > bin/gcc
echo "$(which ${BUILD_CC}) ${BUILD_CFLAGS} ${BUILD_LDFLAGS} \$@" >> bin/gcc
chmod a+x bin/gcc
export PATH="$PWD/bin:$PATH"
}