From f67c45dd4ba4081ec4f8b82cee2b2da0f5d06143 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 30 Mar 2023 23:49:54 +0800
Subject: [PATCH] update patch file name in kirkstone-lf-5.15.71-2.2.0

---
 tools/setup_tools.sh |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/tools/setup_tools.sh b/tools/setup_tools.sh
index 11c2908..02cb804 100755
--- a/tools/setup_tools.sh
+++ b/tools/setup_tools.sh
@@ -56,7 +56,7 @@
     apt install -y $systools
 }
 
-function install_crosstool()
+function install_devtools()
 {
     if command -v arm-linux-gnueabihf-gcc > /dev/null 2>&1 ; then
         pr_warn "All development tools already installed, skip it"
@@ -104,12 +104,43 @@
     rm -f ${BUILDROOT_TAR}
 }
 
+# NXP document suggest cross compiler from ARM Developer:
+#   https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
+function install_crosstool()
+{
+    ARMTOOL_VER=10.3-2021.07
+    ARMTOOL_NAME=gcc-arm-$ARMTOOL_VER
+    ARMTOOL_PACK=${ARMTOOL_NAME}-`uname -p`-arm-none-linux-gnueabihf
+    ARMTOOL_URL=https://developer.arm.com/-/media/Files/downloads/gnu-a/$ARMTOOL_VER/binrel/
+
+    if [ -d /opt/$ARMTOOL_NAME ]  ; then
+        pr_info "$ARMTOOL_NAME crosstool already installed, skip it"
+        return 0;
+    fi
+
+    pr_info "start download cross compiler from ARM Developer"
+
+    if [ ! -s $ARMTOOL_PACK.tar.xz ] ; then
+        wget $ARMTOOL_URL/$ARMTOOL_PACK.tar.xz
+    fi
+
+    tar -xJf $ARMTOOL_PACK.tar.xz -C /opt
+    rm -f $ARMTOOL_PACK.tar.xz
+
+	mv /opt/$ARMTOOL_PACK /opt/$ARMTOOL_NAME
+
+    /opt/$ARMTOOL_NAME/bin/arm-none-linux-gnueabihf-gcc -v
+    pr_info "cross compiler installed to \"/opt/$ARMTOOL_NAME\" successfully"
+}
+
 echo ""
 
 prepare_instpath
 
 install_systools
 
+install_devtools
+
 install_crosstool
 
 #install_buildroot

--
Gitblit v1.9.1