From b5a2cf66ac46fd656c3f888ee7bc7a9b5df2385d Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 18 Jan 2022 01:05:31 +0800 Subject: [PATCH] toolchain: dl_toolchain: add support for aarch64 host --- README.md | 6 ++++-- toolchain-mipsel/dl_toolchain.sh | 28 +++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ef163c252..f2aa81c26 100644 --- a/README.md +++ b/README.md @@ -60,14 +60,16 @@ This project is based on original rt-n56u with latest mtk 4.4.198 kernel, which ```sh cd padavan-4.4/toolchain-mipsel - # (Recommend) Download prebuilt toolchain for x86_64 host - sh dl_toolchain.sh + # (Recommend) Download prebuilt toolchain for x86_64 or aarch64 host + ./dl_toolchain.sh # or build toolchain with crosstool-ng # ./build_toolchain ``` - Modify template file and start compiling ```sh + cd padavan-4.4 + # (Optional) Modify template file # nano configs/templates/K2P.config diff --git a/toolchain-mipsel/dl_toolchain.sh b/toolchain-mipsel/dl_toolchain.sh index 81f9bbf7e..f43f3a70d 100755 --- a/toolchain-mipsel/dl_toolchain.sh +++ b/toolchain-mipsel/dl_toolchain.sh @@ -1,14 +1,32 @@ #!/bin/sh DIR="toolchain-4.4.x" -DL_NAME="mipsel-linux-uclibc.tar.xz" -DL_URL="https://github.com/hanwckf/padavan-toolchain/releases/download/linux-4.4-v1.0/$DL_NAME" +DL_URL="https://github.com/hanwckf/padavan-toolchain/releases/download/linux-4.4-v1.0" + +dl() { + [ -z "$1" ] && return + + echo "Download toolchain: $1" + curl -O -L "${DL_URL}/$1" && \ + mkdir -p $DIR && \ + tar -xf "${1}" -C $DIR +} if [ -d $DIR ]; then echo "$DIR exists!" exit fi -curl -O -L $DL_URL && \ -mkdir -p $DIR && \ -tar -xvf $DL_NAME -C $DIR +ARCH="$(uname -m)" + +case $ARCH in + aarch64) + dl "aarch64_mipsel-linux-uclibc.tar.xz" + ;; + x86_64) + dl "mipsel-linux-uclibc.tar.xz" + ;; + *) + echo "Unknown ARCH: $ARCH" + exit 1 +esac