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 | |
Leonardo Sandoval | 03d9e71 | 2020-07-28 13:48:59 -0500 | [diff] [blame] | 5 | # Toolchains from Linaro Releases: https://releases.linaro.org/components/toolchain/binaries |
| 6 | function 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 |
| 37 | function 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 Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 59 | sudo apt update -q=2 |
| 60 | sudo apt install -q=2 --yes --no-install-recommends build-essential device-tree-compiler git libssl-dev |
| 61 | |
Fathi Boudra | 7975ca7 | 2020-01-28 16:48:40 +0200 | [diff] [blame] | 62 | # FIXME workaround clone_repos.sh script when using gerrit |
| 63 | unset GERRIT_PROJECT |
| 64 | unset GERRIT_BRANCH |
| 65 | unset GERRIT_REFSPEC |
| 66 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 67 | if [ -z "${WORKSPACE}" ]; then |
| 68 | ## Local build |
| 69 | export WORKSPACE=${PWD} |
| 70 | fi |
| 71 | |
Leonardo Sandoval | 03d9e71 | 2020-07-28 13:48:59 -0500 | [diff] [blame] | 72 | # Install toolchains |
| 73 | install-linaro-toolchains |
| 74 | install-arm-toolchains |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 75 | |
| 76 | # Additional binaries required (rootfs, etc...) |
Leonardo Sandoval | 77b30f5 | 2020-10-22 13:53:07 -0500 | [diff] [blame] | 77 | LINARO_VERSION=20.01 |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 78 | mkdir -p \ |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame] | 79 | ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION} \ |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 80 | ${WORKSPACE}/nfs/downloads/mbedtls |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame] | 81 | |
| 82 | cd ${WORKSPACE}/nfs/downloads/linaro/${LINARO_VERSION} |
| 83 | wget -q -c -m -A .zip -np -nd https://releases.linaro.org/members/arm/platforms/${LINARO_VERSION}/ |
| 84 | for file in *.zip; do |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 85 | unzip -q ${file} -d $(basename ${file} .zip) |
| 86 | done |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame] | 87 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 88 | cd ${WORKSPACE}/nfs/downloads/mbedtls |
Fathi Boudra | fb2127a | 2020-02-27 11:45:18 +0200 | [diff] [blame] | 89 | 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] | 90 | cp -a mbedtls-2.16.0-apache.tgz mbedtls-2.16.0.tar.gz |
| 91 | |
| 92 | cd ${WORKSPACE} |
| 93 | |
| 94 | # Path to root of CI repository |
| 95 | ci_root="${WORKSPACE}/tf-a-ci-scripts" |
| 96 | |
| 97 | export nfs_volume="${WORKSPACE}/nfs" |
| 98 | export tfa_downloads="file://${nfs_volume}/downloads" |
| 99 | |
| 100 | # Mandatory workspace |
| 101 | export workspace="${workspace:-${WORKSPACE}/workspace}" |
| 102 | |
| 103 | # During feature development, we need incremental build, so don't run |
| 104 | # 'distlcean' on every invocation. |
| 105 | export dont_clean="${dont_clean:-1}" |
| 106 | |
| 107 | # During feature development, we typically only build in debug mode. |
| 108 | export bin_mode="${bin_mode:-debug}" |
| 109 | |
| 110 | # Local paths to TF and TFTF repositories |
| 111 | export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}" |
| 112 | export 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. |
| 116 | export test_run="${test_run:-1}" |
| 117 | |
| 118 | # Run this script bash -x, and it gets passed downstream for debugging |
| 119 | if echo "$-" | grep -q "x"; then |
| 120 | bash_opts="-x" |
| 121 | fi |
| 122 | |
| 123 | bash $bash_opts "$ci_root/script/run_local_ci.sh" |
| 124 | |
| 125 | cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/ |