blob: 4e1660b754de3e74dc53a64869c655d6a2194525 [file] [log] [blame]
Maksims Svecovs308bb342022-06-28 14:27:07 +01001#!/bin/bash
2#
3# Copyright (c) 2022 Arm Limited. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
Maksims Svecovs308bb342022-06-28 14:27:07 +01007
J-Alvesa00cb202024-07-09 11:42:45 +01008set -ex
9
10# Build TF-A project.
11# Argument $1 provides the sp layout file to be used.
12# Argument $2 provides the spmc manifest to be used.
13build_tfa() {
14 local SP_LAYOUT=$1
15 local SPMC_MANIFEST=$2
16
17 echo "Building TF-A."
18 make -C ${WORKSPACE}/trusted-firmware-a \
19 CROSS_COMPILE=aarch64-none-elf- \
20 PLAT=fvp \
21 DEBUG=1 \
22 BL33=${WORKSPACE}/ff-a-acs/build/output/vm1.bin \
23 BL32=${WORKSPACE}/hafnium/out/reference/secure_aem_v8a_fvp_vhe_clang/hafnium.bin \
24 SP_LAYOUT_FILE=${SP_LAYOUT} \
25 ARM_SPMC_MANIFEST_DTS=${SPMC_MANIFEST} \
26 ARM_ARCH_MAJOR=8 \
27 ARM_ARCH_MINOR=5 \
28 BRANCH_PROTECTION=1 \
29 GIC_EXT_INTID=1 \
30 PLAT_TEST_SPM=1 \
31 ENABLE_FEAT_MTE2=1 \
32 SPD=spmd \
rahulg-arme92be1b2025-01-02 16:19:31 +053033 ENABLE_SPMD_LP=1\
J-Alvesa00cb202024-07-09 11:42:45 +010034 ARM_BL2_SP_LIST_DTS=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/sp_list_fragment.dts \
Kathleen Capellae0c7b992025-03-06 10:57:58 -060035 POETRY= \
J-Alvesa00cb202024-07-09 11:42:45 +010036 all fip -j8
37}
38
39# Copy the generated FIP image from TF-A project.
40# Argument $1 contains the output file.
41copy_tfa_fip() {
42 cp ${WORKSPACE}/trusted-firmware-a/build/fvp/debug/fip.bin $1
43}
44
45# Builds the ACS suite, assuming the repo has been setup.
46# Argument $1 contains the exception level for the SPs, which should be 0 or 1.
47build_acs() {
48 cd ${WORKSPACE}/ff-a-acs/build
49 cmake ../ -G"Unix Makefiles" \
50 -DCROSS_COMPILE=aarch64-none-elf- \
51 -DTARGET=tgt_tfa_fvp \
52 -DPLATFORM_FFA_V_ALL=1 \
53 -DPLATFORM_NS_HYPERVISOR_PRESENT=0 \
54 -DPLATFORM_SP_EL=$1 \
55 -DENABLE_BTI=ON \
56 -DCMAKE_BUILD_TYPE=Debug \
57 -DSUITE=all
58 make
59}
60
61# Build Hafnium.
62export PATH=${WORKSPACE}/hafnium/prebuilts/linux-x64/dtc:$PATH
63echo "Building Hafnium."
64make -C ${WORKSPACE}/hafnium PLATFORM=secure_aem_v8a_fvp_vhe
65
66# Setup the ACS test suite.
J-Alvesb5b652b2024-07-09 12:18:37 +010067pushd ${WORKSPACE}/ff-a-acs
Maksims Svecovs308bb342022-06-28 14:27:07 +010068mkdir build
J-Alvesb5b652b2024-07-09 12:18:37 +010069popd
70
71FFA_ACS_MANIFEST_FOLDER=${WORKSPACE}/ff-a-acs/platform/manifest/tgt_tfa_fvp
J-Alvesaaece902024-07-09 09:55:28 +010072
J-Alvesa00cb202024-07-09 11:42:45 +010073echo "Building ACS test suite (S-EL1 targets)."
74build_acs 1
rahulg-arme92be1b2025-01-02 16:19:31 +053075build_tfa ${FFA_ACS_MANIFEST_FOLDER}/sp_layout_v12.json ${FFA_ACS_MANIFEST_FOLDER}/fvp_spmc_manifest.dts
J-Alvesa00cb202024-07-09 11:42:45 +010076copy_tfa_fip ${WORKSPACE}/fip_sp_sel1.bin
Maksims Svecovs308bb342022-06-28 14:27:07 +010077
J-Alvesb5b652b2024-07-09 12:18:37 +010078make -C ${WORKSPACE}/trusted-firmware-a realclean
79
80# Clean ACS output folder.
81pushd ${WORKSPACE}/ff-a-acs
82rm -r build/*
83popd
84
85echo "Building ACS test suite (S-EL0 targets)."
86build_acs 0
rahulg-arme92be1b2025-01-02 16:19:31 +053087build_tfa ${FFA_ACS_MANIFEST_FOLDER}/sp_layout_el0_v12.json ${FFA_ACS_MANIFEST_FOLDER}/fvp_spmc_manifest_el0.dts
J-Alvesb5b652b2024-07-09 12:18:37 +010088copy_tfa_fip ${WORKSPACE}/fip_sp_sel0.bin
89
Maksims Svecovs308bb342022-06-28 14:27:07 +010090echo "Finished building all targets."
91cd ${WORKSPACE}