Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | sudo apt update -q=2 |
| 4 | sudo apt install -q=2 --yes --no-install-recommends build-essential device-tree-compiler git libssl-dev |
| 5 | |
| 6 | set -ex |
| 7 | |
| 8 | if [ -z "${WORKSPACE}" ]; then |
| 9 | ## Local build |
| 10 | export WORKSPACE=${PWD} |
| 11 | fi |
| 12 | |
| 13 | # Toolchain from Arm Developer page: https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads |
| 14 | TC_URL="https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/8.3-2019.03/binrel" |
| 15 | # Toolchain from Linaro Releases: https://releases.linaro.org/components/toolchain/binaries |
| 16 | #TC_URL="https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/aarch64-linux-gnu/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz" |
| 17 | #TC_URL="https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz" |
| 18 | |
| 19 | # AArch64 little-endian (aarch64-linux-gnu) compiler |
| 20 | cd ${WORKSPACE} |
| 21 | curl -sLSO -C - ${TC_URL}/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz |
| 22 | tar -Jxf gcc-arm-*-x86_64-aarch64-linux-gnu.tar.xz |
| 23 | cd ${WORKSPACE}/gcc-arm-*-x86_64-aarch64-linux-gnu/bin |
| 24 | export PATH=${PWD}:${PATH} |
| 25 | aarch64-linux-gnu-gcc --version |
| 26 | |
| 27 | # AArch32 bare-metal (arm-eabi) compiler |
| 28 | cd ${WORKSPACE} |
| 29 | curl -sLSO -C - ${TC_URL}/gcc-arm-8.3-2019.03-x86_64-arm-eabi.tar.xz |
| 30 | tar -Jxf gcc-arm-*-x86_64-arm-eabi.tar.xz |
| 31 | cd ${WORKSPACE}/gcc-arm-*-x86_64-arm-eabi/bin |
| 32 | export PATH=${PWD}:${PATH} |
| 33 | arm-eabi-gcc --version |
| 34 | |
| 35 | # Additional binaries required (rootfs, etc...) |
| 36 | mkdir -p \ |
| 37 | ${WORKSPACE}/nfs/downloads/linaro/18.04 \ |
| 38 | ${WORKSPACE}/nfs/downloads/mbedtls |
| 39 | cd ${WORKSPACE}/nfs/downloads/linaro/18.04 |
| 40 | curl -sLSO -C - https://releases.linaro.org/openembedded/juno-lsk/15.09/lt-vexpress64-openembedded_minimal-armv8-gcc-4.9_20150912-729.img.gz |
| 41 | curl -sLSO -C - https://releases.linaro.org/openembedded/aarch64/17.01/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz |
| 42 | wget -q -c -m -A .zip -np -nd https://releases.linaro.org/members/arm/platforms/19.06/ |
| 43 | for file in $(ls *.zip); do |
| 44 | unzip -q ${file} -d $(basename ${file} .zip) |
| 45 | done |
| 46 | cd ${WORKSPACE}/nfs/downloads/mbedtls |
| 47 | curl -sLSO -C - https://tls.mbed.org/download/start/mbedtls-2.16.0-apache.tgz |
| 48 | cp -a mbedtls-2.16.0-apache.tgz mbedtls-2.16.0.tar.gz |
| 49 | |
| 50 | cd ${WORKSPACE} |
| 51 | |
| 52 | # Path to root of CI repository |
| 53 | ci_root="${WORKSPACE}/tf-a-ci-scripts" |
| 54 | |
| 55 | export nfs_volume="${WORKSPACE}/nfs" |
| 56 | export tfa_downloads="file://${nfs_volume}/downloads" |
| 57 | |
| 58 | # Mandatory workspace |
| 59 | export workspace="${workspace:-${WORKSPACE}/workspace}" |
| 60 | |
| 61 | # During feature development, we need incremental build, so don't run |
| 62 | # 'distlcean' on every invocation. |
| 63 | export dont_clean="${dont_clean:-1}" |
| 64 | |
| 65 | # During feature development, we typically only build in debug mode. |
| 66 | export bin_mode="${bin_mode:-debug}" |
| 67 | |
| 68 | # Local paths to TF and TFTF repositories |
| 69 | export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}" |
| 70 | export tftf_root="${tftf_root:-${WORKSPACE}/tf-a-tests}" |
| 71 | |
| 72 | # We'd need to see the terminals during development runs, so no need for |
| 73 | # automation. |
| 74 | export test_run="${test_run:-1}" |
| 75 | |
| 76 | # Run this script bash -x, and it gets passed downstream for debugging |
| 77 | if echo "$-" | grep -q "x"; then |
| 78 | bash_opts="-x" |
| 79 | fi |
| 80 | |
| 81 | bash $bash_opts "$ci_root/script/run_local_ci.sh" |
| 82 | |
| 83 | cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/ |