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