blob: 7b2e4eb1a1ce0d5cb21a8180d4e131672f0d861c [file] [log] [blame]
Fathi Boudra9e402bf2019-12-05 11:16:41 +02001#!/bin/bash
2
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -05003set -ex
4
Fathi Boudra9e402bf2019-12-05 11:16:41 +02005sudo apt update -q=2
6sudo apt install -q=2 --yes --no-install-recommends build-essential device-tree-compiler git libssl-dev
7
Fathi Boudra7975ca72020-01-28 16:48:40 +02008# FIXME workaround clone_repos.sh script when using gerrit
9unset GERRIT_PROJECT
10unset GERRIT_BRANCH
11unset GERRIT_REFSPEC
12
Fathi Boudra9e402bf2019-12-05 11:16:41 +020013if [ -z "${WORKSPACE}" ]; then
14 ## Local build
15 export WORKSPACE=${PWD}
16fi
17
18# Toolchain from Arm Developer page: https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050019TC_VERSION="9.2-2019.12"
20TC_URL="https://developer.arm.com/-/media/Files/downloads/gnu-a/${TC_VERSION}/binrel"
21TC_AARCH64="gcc-arm-${TC_VERSION}-x86_64-aarch64-none-elf.tar.xz"
22TC_ARM="gcc-arm-${TC_VERSION}-x86_64-arm-none-eabi.tar.xz"
Fathi Boudra9e402bf2019-12-05 11:16:41 +020023
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050024# install toolchains
25for TC in ${TC_AARCH64} ${TC_ARM}; do
26 cd ${WORKSPACE}
27 curl -sLSO -C - ${TC_URL}/${TC}
28 tar -Jxf ${TC}
29 cd ${WORKSPACE}/${TC%.tar.xz}/bin
30 export PATH=${PWD}:${PATH}
31done
Fathi Boudra9e402bf2019-12-05 11:16:41 +020032
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050033# Basic TC checks
34for param in -dumpmachine --version -v; do
35 aarch64-none-elf-gcc ${param}
36 arm-none-eabi-gcc ${param}
37done
Fathi Boudra9e402bf2019-12-05 11:16:41 +020038
39# Additional binaries required (rootfs, etc...)
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050040LINARO_VERSION=19.06
Fathi Boudra9e402bf2019-12-05 11:16:41 +020041mkdir -p \
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050042 ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION} \
Fathi Boudra9e402bf2019-12-05 11:16:41 +020043 ${WORKSPACE}/nfs/downloads/mbedtls
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050044
45cd ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION}
46wget -q -c -m -A .zip -np -nd https://releases.linaro.org/members/arm/platforms/${LINARO_VERSION}/
47for file in *.zip; do
Fathi Boudra9e402bf2019-12-05 11:16:41 +020048 unzip -q ${file} -d $(basename ${file} .zip)
49done
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -050050
Fathi Boudra9e402bf2019-12-05 11:16:41 +020051cd ${WORKSPACE}/nfs/downloads/mbedtls
Fathi Boudrafb2127a2020-02-27 11:45:18 +020052curl -sLSO -k -C - https://tls.mbed.org/download/start/mbedtls-2.16.0-apache.tgz
Fathi Boudra9e402bf2019-12-05 11:16:41 +020053cp -a mbedtls-2.16.0-apache.tgz mbedtls-2.16.0.tar.gz
54
55cd ${WORKSPACE}
56
57# Path to root of CI repository
58ci_root="${WORKSPACE}/tf-a-ci-scripts"
59
60export nfs_volume="${WORKSPACE}/nfs"
61export tfa_downloads="file://${nfs_volume}/downloads"
62
63# Mandatory workspace
64export workspace="${workspace:-${WORKSPACE}/workspace}"
65
66# During feature development, we need incremental build, so don't run
67# 'distlcean' on every invocation.
68export dont_clean="${dont_clean:-1}"
69
70# During feature development, we typically only build in debug mode.
71export bin_mode="${bin_mode:-debug}"
72
73# Local paths to TF and TFTF repositories
74export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}"
75export tftf_root="${tftf_root:-${WORKSPACE}/tf-a-tests}"
76
77# We'd need to see the terminals during development runs, so no need for
78# automation.
79export test_run="${test_run:-1}"
80
81# Run this script bash -x, and it gets passed downstream for debugging
82if echo "$-" | grep -q "x"; then
83 bash_opts="-x"
84fi
85
86bash $bash_opts "$ci_root/script/run_local_ci.sh"
87
88cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/