Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | #------------------------------------------------------------------------------- |
| 8 | |
| 9 | # |
| 10 | # Builds a single configuration on Trusted Firmware M. |
| 11 | # Relies on environment variables pre-populated. |
| 12 | # These variables can be obtained using configs.py. |
| 13 | # Expected to have trusted-firmware-m cloned to same level as this git tree |
| 14 | # |
| 15 | |
| 16 | set -ex |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 17 | |
| 18 | if [ -z "$CONFIG_NAME" ] ; then |
| 19 | echo "Set CONFIG_NAME to run a build." |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
Fathi Boudra | a43b5ba | 2020-11-19 22:33:50 +0100 | [diff] [blame] | 23 | # FIXME: workaround for Arm Clang license server on ci.trustedfirmware.org |
| 24 | [[ ${JENKINS_URL} == *trustedfirmware.org* ]] && \ |
| 25 | export ARMLMD_LICENSE_FILE=${ARMLMD_LICENSE_FILE:-27000@ci.trustedfirmware.org} |
| 26 | |
Karl Zhang | 4a45dac | 2020-06-10 14:03:10 +0800 | [diff] [blame] | 27 | set +e |
| 28 | echo "output current build environment" |
| 29 | cat /etc/issue |
| 30 | uname -a |
| 31 | grep -c ^processor /proc/cpuinfo |
| 32 | armclang --version |
| 33 | arm-none-eabi-gcc --version |
| 34 | cmake --version |
| 35 | python --version |
| 36 | make --version |
| 37 | |
| 38 | set -ex |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 39 | build_commands=$(python3 tf-m-ci-scripts/configs.py -b -g all $CONFIG_NAME) |
| 40 | |
Karl Zhang | f6f467e | 2020-07-10 16:24:45 +0800 | [diff] [blame] | 41 | if [ $CODE_COVERAGE_EN = "TRUE" ] && [[ $CONFIG_NAME =~ "GNUARM" ]] ; then |
| 42 | build_commands=${build_commands/-DCOMPILER=GNUARM/-DCOMPILER=GNUARM -DCODE_COVERAGE_EN=TRUE} |
| 43 | echo "Flag: Add compiler flag for build with code coverage supported." |
| 44 | echo $build_commands |
| 45 | fi |
| 46 | |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 47 | if [ -z "$build_commands" ] ; then |
| 48 | echo "No build commands found." |
| 49 | exit 1 |
| 50 | fi |
| 51 | |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 52 | cd mbedtls |
| 53 | git apply ../trusted-firmware-m/lib/ext/mbedcrypto/*.patch |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 54 | |
| 55 | mkdir ../trusted-firmware-m/build |
| 56 | cd ../trusted-firmware-m/build |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 57 | |
| 58 | eval "set -ex ; $build_commands" |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 59 | |
Xinyu Zhang | 6db162c | 2020-09-29 10:52:19 +0800 | [diff] [blame] | 60 | # TODO: Remove the copy logic when LAVA server could read artifacts directly generated by new build system |
Xinyu Zhang | 0e334e3 | 2020-09-27 11:42:47 +0800 | [diff] [blame] | 61 | set +e |
| 62 | |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 63 | mkdir install/outputs/fvp |
Xinyu Zhang | 6db162c | 2020-09-29 10:52:19 +0800 | [diff] [blame] | 64 | cp -r bin/* install/outputs/fvp/ |
Xinyu Zhang | 0e334e3 | 2020-09-27 11:42:47 +0800 | [diff] [blame] | 65 | |
| 66 | cd install/outputs |
Xinyu Zhang | 6db162c | 2020-09-29 10:52:19 +0800 | [diff] [blame] | 67 | cp -r CYPRESS/* . |
| 68 | cp -r MPS2/* . |
| 69 | cp -r MPS3/* . |
Xinyu Zhang | 0e334e3 | 2020-09-27 11:42:47 +0800 | [diff] [blame] | 70 | |
| 71 | for file in `find | grep bl2` |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 72 | do |
| 73 | newfile=`echo $file | sed "s/bl2/mcuboot/g"` |
Xinyu Zhang | 6db162c | 2020-09-29 10:52:19 +0800 | [diff] [blame] | 74 | cp $file $newfile |
| 75 | done |
| 76 | |
| 77 | for file in `find | grep s_ns_signed` |
| 78 | do |
| 79 | newfile=`echo $file | sed "s/s_ns_signed/sign/g"` |
| 80 | cp $file $newfile |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 81 | done |
Xinyu Zhang | 0e334e3 | 2020-09-27 11:42:47 +0800 | [diff] [blame] | 82 | |
| 83 | set -e |