Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 3 | set -ex |
| 4 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 5 | sudo apt update -q=2 |
| 6 | sudo apt install -q=2 --yes --no-install-recommends build-essential device-tree-compiler git libssl-dev |
| 7 | |
Fathi Boudra | 7975ca7 | 2020-01-28 16:48:40 +0200 | [diff] [blame] | 8 | # FIXME workaround clone_repos.sh script when using gerrit |
| 9 | unset GERRIT_PROJECT |
| 10 | unset GERRIT_BRANCH |
| 11 | unset GERRIT_REFSPEC |
| 12 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 13 | if [ -z "${WORKSPACE}" ]; then |
| 14 | ## Local build |
| 15 | export WORKSPACE=${PWD} |
| 16 | fi |
| 17 | |
| 18 | # Toolchain from Arm Developer page: https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 19 | TC_VERSION="9.2-2019.12" |
| 20 | TC_URL="https://developer.arm.com/-/media/Files/downloads/gnu-a/${TC_VERSION}/binrel" |
| 21 | TC_AARCH64="gcc-arm-${TC_VERSION}-x86_64-aarch64-none-elf.tar.xz" |
| 22 | TC_ARM="gcc-arm-${TC_VERSION}-x86_64-arm-none-eabi.tar.xz" |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 23 | |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 24 | # install toolchains |
| 25 | for 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} |
| 31 | done |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 32 | |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 33 | # Basic TC checks |
| 34 | for param in -dumpmachine --version -v; do |
| 35 | aarch64-none-elf-gcc ${param} |
| 36 | arm-none-eabi-gcc ${param} |
| 37 | done |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 38 | |
| 39 | # Additional binaries required (rootfs, etc...) |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 40 | LINARO_VERSION=19.06 |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 41 | mkdir -p \ |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 42 | ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION} \ |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 43 | ${WORKSPACE}/nfs/downloads/mbedtls |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 44 | |
| 45 | cd ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION} |
| 46 | wget -q -c -m -A .zip -np -nd https://releases.linaro.org/members/arm/platforms/${LINARO_VERSION}/ |
| 47 | for file in *.zip; do |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 48 | unzip -q ${file} -d $(basename ${file} .zip) |
| 49 | done |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame^] | 50 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 51 | cd ${WORKSPACE}/nfs/downloads/mbedtls |
Fathi Boudra | fb2127a | 2020-02-27 11:45:18 +0200 | [diff] [blame] | 52 | curl -sLSO -k -C - https://tls.mbed.org/download/start/mbedtls-2.16.0-apache.tgz |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 53 | cp -a mbedtls-2.16.0-apache.tgz mbedtls-2.16.0.tar.gz |
| 54 | |
| 55 | cd ${WORKSPACE} |
| 56 | |
| 57 | # Path to root of CI repository |
| 58 | ci_root="${WORKSPACE}/tf-a-ci-scripts" |
| 59 | |
| 60 | export nfs_volume="${WORKSPACE}/nfs" |
| 61 | export tfa_downloads="file://${nfs_volume}/downloads" |
| 62 | |
| 63 | # Mandatory workspace |
| 64 | export workspace="${workspace:-${WORKSPACE}/workspace}" |
| 65 | |
| 66 | # During feature development, we need incremental build, so don't run |
| 67 | # 'distlcean' on every invocation. |
| 68 | export dont_clean="${dont_clean:-1}" |
| 69 | |
| 70 | # During feature development, we typically only build in debug mode. |
| 71 | export bin_mode="${bin_mode:-debug}" |
| 72 | |
| 73 | # Local paths to TF and TFTF repositories |
| 74 | export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}" |
| 75 | export 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. |
| 79 | export test_run="${test_run:-1}" |
| 80 | |
| 81 | # Run this script bash -x, and it gets passed downstream for debugging |
| 82 | if echo "$-" | grep -q "x"; then |
| 83 | bash_opts="-x" |
| 84 | fi |
| 85 | |
| 86 | bash $bash_opts "$ci_root/script/run_local_ci.sh" |
| 87 | |
| 88 | cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/ |