blob: 3d0932c17f2c5ba3666562828d7cd408d9ee0bea [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 \
33 ARM_BL2_SP_LIST_DTS=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/sp_list_fragment.dts \
34 all fip -j8
35}
36
37# Copy the generated FIP image from TF-A project.
38# Argument $1 contains the output file.
39copy_tfa_fip() {
40 cp ${WORKSPACE}/trusted-firmware-a/build/fvp/debug/fip.bin $1
41}
42
43# Builds the ACS suite, assuming the repo has been setup.
44# Argument $1 contains the exception level for the SPs, which should be 0 or 1.
45build_acs() {
46 cd ${WORKSPACE}/ff-a-acs/build
47 cmake ../ -G"Unix Makefiles" \
48 -DCROSS_COMPILE=aarch64-none-elf- \
49 -DTARGET=tgt_tfa_fvp \
50 -DPLATFORM_FFA_V_ALL=1 \
51 -DPLATFORM_NS_HYPERVISOR_PRESENT=0 \
52 -DPLATFORM_SP_EL=$1 \
53 -DENABLE_BTI=ON \
54 -DCMAKE_BUILD_TYPE=Debug \
55 -DSUITE=all
56 make
57}
58
59# Build Hafnium.
60export PATH=${WORKSPACE}/hafnium/prebuilts/linux-x64/dtc:$PATH
61echo "Building Hafnium."
62make -C ${WORKSPACE}/hafnium PLATFORM=secure_aem_v8a_fvp_vhe
63
64# Setup the ACS test suite.
J-Alvesb5b652b2024-07-09 12:18:37 +010065pushd ${WORKSPACE}/ff-a-acs
Maksims Svecovs308bb342022-06-28 14:27:07 +010066mkdir build
J-Alvesb5b652b2024-07-09 12:18:37 +010067popd
68
69FFA_ACS_MANIFEST_FOLDER=${WORKSPACE}/ff-a-acs/platform/manifest/tgt_tfa_fvp
J-Alvesaaece902024-07-09 09:55:28 +010070
J-Alvesa00cb202024-07-09 11:42:45 +010071echo "Building ACS test suite (S-EL1 targets)."
72build_acs 1
J-Alvesb5b652b2024-07-09 12:18:37 +010073build_tfa ${FFA_ACS_MANIFEST_FOLDER}/sp_layout.json ${FFA_ACS_MANIFEST_FOLDER}/fvp_spmc_manifest.dts
J-Alvesa00cb202024-07-09 11:42:45 +010074copy_tfa_fip ${WORKSPACE}/fip_sp_sel1.bin
Maksims Svecovs308bb342022-06-28 14:27:07 +010075
J-Alvesb5b652b2024-07-09 12:18:37 +010076make -C ${WORKSPACE}/trusted-firmware-a realclean
77
78# Clean ACS output folder.
79pushd ${WORKSPACE}/ff-a-acs
80rm -r build/*
81popd
82
83echo "Building ACS test suite (S-EL0 targets)."
84build_acs 0
85build_tfa ${FFA_ACS_MANIFEST_FOLDER}/sp_layout_el0.json ${FFA_ACS_MANIFEST_FOLDER}/fvp_spmc_manifest_el0.dts
86copy_tfa_fip ${WORKSPACE}/fip_sp_sel0.bin
87
Maksims Svecovs308bb342022-06-28 14:27:07 +010088echo "Finished building all targets."
89cd ${WORKSPACE}