blob: 220d503cf69c1cb3ad9aca008558fb54161c2370 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval579c7372020-10-23 15:23:32 -05003# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
Leonardo Sandovaled5da5b2020-11-18 12:02:14 -06008export CROSS_COMPILE=aarch64-none-elf-
9
10# We need to clean the platform build between each configuration because Trusted
11# Firmware's build system doesn't track build options dependencies and won't
12# rebuild the files affected by build options changes.
13clean_build()
14{
15 local flags="$*"
16 echo "Building TF with the following build flags:"
17 echo " $flags"
18 make $flags clean
19 make $flags all
20 echo "Build config complete."
21 echo
22}
23
24# Defines common flags between platforms
25common_flags() {
26 local release="${1:-}"
27 local num_cpus="$(/usr/bin/getconf _NPROCESSORS_ONLN)"
28 local parallel_make="-j $num_cpus"
29
30 # default to debug mode, unless a parameter is passed to the function
31 debug="DEBUG=1"
32 [ -n "$release" ] && debug=""
33
34 echo " $parallel_make $debug -s "
35}
36
37# Check if execution environment is ARM's jenkins (Jenkins running under ARM
38# infraestructure)
39is_arm_jenkins_env() {
40 if [ "$JENKINS_HOME" ]; then
41 if echo "$JENKINS_URL" | grep -q "arm.com"; then
42 return 0;
43 fi
44 fi
45 return 1
46}
47
48# Provide correct linaro cross toolchain based on environment
49set_cross_compile_gcc_linaro_toolchain() {
50 local cross_compile_path="/home/buildslave/tools"
51
52 # if under arm enviroment, overide cross-compilation path
53 is_arm_jenkins_env && cross_compile_path="/arm/pdsw/tools"
54
55 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
56}
57
58# Provide correct armclang toolchain based on environment
59set_armclang_toolchain() {
60 local armclang_path="/home/buildslave/tools/armclang-6.8/bin"
61
62 # if under arm enviroment, overide cross-compilation path
63 is_arm_jenkins_env && armclang_path="/arm/warehouse/Distributions/FA/ARMCompiler/6.8/25/standalone-linux-x86_64-rel/bin"
64
65 echo "${armclang_path}/armclang"
66}
Fathi Boudra422bf772019-12-02 11:10:16 +020067
Leonardo Sandovalc4dfbb02020-08-17 10:21:44 -050068# mbed TLS variables
69MBED_TLS_DIR=mbedtls
70MBED_TLS_URL_REPO=https://github.com/ARMmbed/mbedtls.git
71
Fathi Boudra422bf772019-12-02 11:10:16 +020072# mbed TLS source tag to checkout when building Trusted Firmware with Trusted
73# Board Boot support.
Alexei Fedorovf9dccd32020-09-21 13:21:04 +010074MBED_TLS_SOURCES_TAG="mbedtls-2.24.0"
Fathi Boudra422bf772019-12-02 11:10:16 +020075
Leonardo Sandovaled5da5b2020-11-18 12:02:14 -060076ARMCLANG_PATH="$(set_armclang_toolchain)"
77
Fathi Boudra422bf772019-12-02 11:10:16 +020078CRYPTOCELL_LIB_PATH=/arm/projectscratch/ssg/trusted-fw/dummy-crypto-lib
Leonardo Sandovaled5da5b2020-11-18 12:02:14 -060079
80TBB_OPTIONS="TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=$(pwd)/mbedtls"
81ARM_TBB_OPTIONS="$TBB_OPTIONS ARM_ROTPK_LOCATION=devel_rsa"