From b901880014f1b2099f7390833ed6eebd97c0e50a Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sun, 11 Aug 2019 19:09:24 +0800
Subject: [PATCH] update linux-bsp build shell script and patch file for new buildroot cross compiler

---
 3rdparty/busybox/build.sh |   69 +++++++++++++++++++++++++++-------
 1 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/3rdparty/busybox/build.sh b/3rdparty/busybox/build.sh
index 8a02c7f..c2b8045 100755
--- a/3rdparty/busybox/build.sh
+++ b/3rdparty/busybox/build.sh
@@ -6,29 +6,70 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+CROSSTOOL=/opt/buildroot/cortex-a5/bin/arm-linux-
 
-SRC_NAME=busybox-1.31.0
-PACK_SUFIX=tar.bz2
+
 
 JOBS=`cat /proc/cpuinfo  |  grep processor | wc -l`
 
-if [ ! -d $SRC_NAME ] ; then
-    if [ ! -f $SRC_NAME.${PACK_SUFIX} ] ; then
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
+function msg_banner()
+{
+    echo ""
+    echo "+-----------------------------------------------------------------------"
+    echo "|  $1 "
+    echo "+-----------------------------------------------------------------------"
+    echo ""
+}
+
+function check_result()
+{
+    if [ $? != 0 ] ; then
+       echo ""
+       echo "+-----------------------------------------------------------------------"
+       echo "|  $1 "
+       echo "+-----------------------------------------------------------------------"
+       echo ""
+       exit ;
+    fi
+}
+
+
+function compile_busybox()
+{
+    SRC_NAME=busybox-1.31.0
+    PACK_SUFIX=tar.bz2
+
+    if [ -f $SRC_NAME/busybox ] ; then 
+        msg_banner "$SRC_NAME already compile and installed" 
+        return 0; 
+    fi 
+
+    msg_banner "start download and compile $SRC_NAME " 
+
+    if [ ! -d $SRC_NAME ] ; then
+        if [ ! -f $SRC_NAME.${PACK_SUFIX} ] ; then
+           wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
+           check_result "ERROR: download ${SRC_NAME} failure"
+        fi
+
+        tar -xjf $SRC_NAME.${PACK_SUFIX}
     fi
 
-    tar -xjf $SRC_NAME.${PACK_SUFIX}
-fi
+    cp config/${SRC_NAME}.config $SRC_NAME/.config
 
-cp config/${SRC_NAME}.config $SRC_NAME/.config
+    cd $SRC_NAME
 
-cd $SRC_NAME
+    sed -i "s|^CONFIG_CROSS_COMPILER_PREFIX.*|CONFIG_CROSS_COMPILER_PREFIX=\"${CROSSTOOL}\"|g" .config 
+    sed -i "s|^CONFIG_PREFIX.*|CONFIG_PREFIX=\"$ROOTFS_PATH\"|g" .config
 
-sed -i "s|^CONFIG_CROSS_COMPILER_PREFIX.*|CONFIG_CROSS_COMPILER_PREFIX=\"${CROSSTOOL}\"|g" .config
-sed -i "s|^CONFIG_PREFIX.*|CONFIG_PREFIX=\"$ROOTFS_PATH\"|g" .config
+    make 
+    #make uninstall && sudo make install
+}
 
-make 
-#make uninstall && sudo make install
+
+compile_busybox
+
+
+
 
 

--
Gitblit v1.9.1