Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -u |
| 3 | |
| 4 | HOST_ARCH=$(uname -m) |
| 5 | VER="11.2-2022.02" |
| 6 | |
| 7 | DOWNLOAD_DIR=$1 |
| 8 | TOOLCHAIN_DIR=$2 |
| 9 | TOOLCHAIN_LINK_DIR=$3 |
| 10 | |
| 11 | # These should be already created by .gitlab-ci.yml, but do here if run outside of that env |
| 12 | mkdir -p $DOWNLOAD_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR |
| 13 | |
| 14 | if [ $HOST_ARCH = "aarch64" ]; then |
| 15 | #AArch64 Linux hosted cross compilers |
| 16 | |
| 17 | #AArch32 target with hard float (arm-none-linux-gnueabihf) |
| 18 | wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz |
| 19 | elif [ $HOST_ARCH = "x86_64" ]; then |
| 20 | #x86_64 Linux hosted cross compilers |
| 21 | |
| 22 | #AArch32 target with hard float (arm-linux-none-gnueabihf) |
| 23 | wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz |
| 24 | |
| 25 | #AArch64 GNU/Linux target (aarch64-none-linux-gnu) |
| 26 | wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz |
| 27 | |
| 28 | #AArch64 GNU/Linux target (aarch64_be-none-linux-gnu) |
| 29 | wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz |
| 30 | else |
| 31 | echo "ERROR - Unknown build arch of $HOST_ARCH" |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | for i in arm aarch64 aarch64_be; do |
| 36 | if [ ! -d $TOOLCHAIN_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then |
| 37 | if [ ! -f $DOWNLOAD_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then |
| 38 | continue |
| 39 | fi |
| 40 | |
| 41 | tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz |
| 42 | fi |
| 43 | |
| 44 | # Setup a link for the toolchain to use local to the building machine (e.g., not in a shared location) |
| 45 | ln -s $TOOLCHAIN_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i |
| 46 | done |