blob: bab1272b28a6c531b28f86f38610b4f4244b73e8 [file] [log] [blame]
Fathi Boudra9e402bf2019-12-05 11:16:41 +02001#!/bin/bash
2
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -05003set -ex
4
Leonardo Sandoval03d9e712020-07-28 13:48:59 -05005# Toolchains from Linaro Releases: https://releases.linaro.org/components/toolchain/binaries
6function install-linaro-toolchains() {
7 local TC_VERSION="6.2-2016.11"
8 local TC_FULL_VERSION="6.2.1-2016.11"
9 local TC_URL="https://releases.linaro.org/components/toolchain/binaries/${TC_VERSION}"
10 local TC_AARCH64="gcc-linaro-${TC_FULL_VERSION}-x86_64_aarch64-linux-gnu.tar.xz"
11
12 # Install toolchains
13 for TC in ${TC_AARCH64}; do
14 cd ${WORKSPACE}
15 case $TC in
16 *aarch64-linux-gnu*)
17 TC_URL_INFIX=aarch64-linux-gnu
18 ;;
19 *)
20 echo "Invalid Toolchain \"$TC\" and not appended in PATH"
21 continue
22 ;;
23 esac
24 curl -sLSO -C - ${TC_URL}/${TC_URL_INFIX}/${TC}
25 tar -Jxf ${TC}
26 cd ${WORKSPACE}/${TC%.tar.xz}/bin
27 export PATH=${PWD}:${PATH}
28 done
29
30 # Basic TC checks
31 for param in -dumpmachine --version -v; do
32 aarch64-linux-gnu-gcc ${param}
33 done
34}
35
36# Toolchains from Arm Developer page: https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads
37function install-arm-toolchains() {
38 local TC_VERSION="9.2-2019.12"
39 local TC_URL="https://developer.arm.com/-/media/Files/downloads/gnu-a/${TC_VERSION}/binrel"
40 local TC_AARCH64="gcc-arm-${TC_VERSION}-x86_64-aarch64-none-elf.tar.xz"
41 local TC_ARM="gcc-arm-${TC_VERSION}-x86_64-arm-none-eabi.tar.xz"
42
43 # Install toolchains
44 for TC in ${TC_AARCH64} ${TC_ARM}; do
45 cd ${WORKSPACE}
46 curl -sLSO -C - ${TC_URL}/${TC}
47 tar -Jxf ${TC}
48 cd ${WORKSPACE}/${TC%.tar.xz}/bin
49 export PATH=${PWD}:${PATH}
50 done
51
52 # Basic TC checks
53 for param in -dumpmachine --version -v; do
54 aarch64-none-elf-gcc ${param}
55 arm-none-eabi-gcc ${param}
56 done
57}
58
Fathi Boudra9e402bf2019-12-05 11:16:41 +020059sudo apt update -q=2
60sudo apt install -q=2 --yes --no-install-recommends build-essential device-tree-compiler git libssl-dev
61
Fathi Boudra7975ca72020-01-28 16:48:40 +020062# FIXME workaround clone_repos.sh script when using gerrit
63unset GERRIT_PROJECT
64unset GERRIT_BRANCH
65unset GERRIT_REFSPEC
66
Fathi Boudra9e402bf2019-12-05 11:16:41 +020067if [ -z "${WORKSPACE}" ]; then
68 ## Local build
69 export WORKSPACE=${PWD}
70fi
71
Leonardo Sandoval03d9e712020-07-28 13:48:59 -050072# Install toolchains
73install-linaro-toolchains
74install-arm-toolchains
Fathi Boudra9e402bf2019-12-05 11:16:41 +020075
76# Additional binaries required (rootfs, etc...)
Leonardo Sandoval77b30f52020-10-22 13:53:07 -050077LINARO_VERSION=20.01
Fathi Boudra9e402bf2019-12-05 11:16:41 +020078mkdir -p \
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050079 ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION} \
Fathi Boudra9e402bf2019-12-05 11:16:41 +020080 ${WORKSPACE}/nfs/downloads/mbedtls
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050081
82cd ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION}
83wget -q -c -m -A .zip -np -nd https://releases.linaro.org/members/arm/platforms/${LINARO_VERSION}/
84for file in *.zip; do
Fathi Boudra9e402bf2019-12-05 11:16:41 +020085 unzip -q ${file} -d $(basename ${file} .zip)
86done
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050087
Fathi Boudra9e402bf2019-12-05 11:16:41 +020088cd ${WORKSPACE}/nfs/downloads/mbedtls
Fathi Boudrafb2127a2020-02-27 11:45:18 +020089curl -sLSO -k -C - https://tls.mbed.org/download/start/mbedtls-2.16.0-apache.tgz
Fathi Boudra9e402bf2019-12-05 11:16:41 +020090cp -a mbedtls-2.16.0-apache.tgz mbedtls-2.16.0.tar.gz
91
92cd ${WORKSPACE}
93
94# Path to root of CI repository
95ci_root="${WORKSPACE}/tf-a-ci-scripts"
96
97export nfs_volume="${WORKSPACE}/nfs"
98export tfa_downloads="file://${nfs_volume}/downloads"
99
100# Mandatory workspace
101export workspace="${workspace:-${WORKSPACE}/workspace}"
102
103# During feature development, we need incremental build, so don't run
104# 'distlcean' on every invocation.
105export dont_clean="${dont_clean:-1}"
106
107# During feature development, we typically only build in debug mode.
108export bin_mode="${bin_mode:-debug}"
109
110# Local paths to TF and TFTF repositories
111export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}"
112export tftf_root="${tftf_root:-${WORKSPACE}/tf-a-tests}"
113
114# We'd need to see the terminals during development runs, so no need for
115# automation.
116export test_run="${test_run:-1}"
117
118# Run this script bash -x, and it gets passed downstream for debugging
119if echo "$-" | grep -q "x"; then
120 bash_opts="-x"
121fi
122
123bash $bash_opts "$ci_root/script/run_local_ci.sh"
124
125cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/