blob: fffe82ccfcd40e361ac33f65ee0720ca2894c61f [file] [log] [blame]
Dean Birch62c4f082020-01-17 16:13:26 +00001#!/bin/bash
2#-------------------------------------------------------------------------------
3# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8
9#
10# Builds a single configuration on Trusted Firmware M.
11# Relies on environment variables pre-populated.
12# These variables can be obtained using configs.py.
13# Expected to have trusted-firmware-m cloned to same level as this git tree
14#
15
16set -ex
Dean Birchd0f9f8c2020-03-26 11:10:33 +000017
18if [ -z "$CONFIG_NAME" ] ; then
19 echo "Set CONFIG_NAME to run a build."
20 exit 1
21fi
22
Karl Zhang4a45dac2020-06-10 14:03:10 +080023set +e
24echo "output current build environment"
25cat /etc/issue
26uname -a
27grep -c ^processor /proc/cpuinfo
28armclang --version
29arm-none-eabi-gcc --version
30cmake --version
31python --version
32make --version
33
34set -ex
Dean Birchd0f9f8c2020-03-26 11:10:33 +000035build_commands=$(python3 tf-m-ci-scripts/configs.py -b -g all $CONFIG_NAME)
36
Karl Zhangf6f467e2020-07-10 16:24:45 +080037if [ $CODE_COVERAGE_EN = "TRUE" ] && [[ $CONFIG_NAME =~ "GNUARM" ]] ; then
38 build_commands=${build_commands/-DCOMPILER=GNUARM/-DCOMPILER=GNUARM -DCODE_COVERAGE_EN=TRUE}
39 echo "Flag: Add compiler flag for build with code coverage supported."
40 echo $build_commands
41fi
42
Dean Birchd0f9f8c2020-03-26 11:10:33 +000043if [ -z "$build_commands" ] ; then
44 echo "No build commands found."
45 exit 1
46fi
47
Xinyu Zhangb708f572020-09-15 11:43:46 +080048cd mbedtls
49git apply ../trusted-firmware-m/lib/ext/mbedcrypto/*.patch
50cd ../psa-arch-tests
51git apply ../trusted-firmware-m/lib/ext/psa_arch_tests/0001-Alter-asm-to-__asm-to-comply-with-C99.patch
52
53mkdir ../trusted-firmware-m/build
54cd ../trusted-firmware-m/build
Dean Birchd0f9f8c2020-03-26 11:10:33 +000055
56eval "set -ex ; $build_commands"
Xinyu Zhangb708f572020-09-15 11:43:46 +080057
Xinyu Zhang6db162c2020-09-29 10:52:19 +080058# TODO: Remove the copy logic when LAVA server could read artifacts directly generated by new build system
Xinyu Zhang0e334e32020-09-27 11:42:47 +080059set +e
60
Xinyu Zhangb708f572020-09-15 11:43:46 +080061mkdir install/outputs/fvp
Xinyu Zhang6db162c2020-09-29 10:52:19 +080062cp -r bin/* install/outputs/fvp/
Xinyu Zhang0e334e32020-09-27 11:42:47 +080063
64cd install/outputs
Xinyu Zhang6db162c2020-09-29 10:52:19 +080065cp -r CYPRESS/* .
66cp -r MPS2/* .
67cp -r MPS3/* .
Xinyu Zhang0e334e32020-09-27 11:42:47 +080068
69for file in `find | grep bl2`
Xinyu Zhangb708f572020-09-15 11:43:46 +080070do
71 newfile=`echo $file | sed "s/bl2/mcuboot/g"`
Xinyu Zhang6db162c2020-09-29 10:52:19 +080072 cp $file $newfile
73done
74
75for file in `find | grep s_ns_signed`
76do
77 newfile=`echo $file | sed "s/s_ns_signed/sign/g"`
78 cp $file $newfile
Xinyu Zhangb708f572020-09-15 11:43:46 +080079done
Xinyu Zhang0e334e32020-09-27 11:42:47 +080080
81set -e