From 8e62b03217c78e78eddf3ff8dbd5948dd4831aa6 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 23 Aug 2024 10:48:29 +0800
Subject: [PATCH] update build shell script form openlibs

---
 openlibs/openssl/build.sh                     |  191 ++-
 openlibs/mosquitto/build.sh                   |  204 ++-
 openlibs/libxml2/build.sh                     |  166 +-
 openlibs/opencv/build.sh                      |  201 +++
 openlibs/lrzsz/build.sh                       |  198 ++-
 hal/modules/libgpiod/build.sh                 |  174 +-
 openlibs/valgrind/build.sh                    |  212 ++-
 /dev/null                                     |   99 --
 openlibs/busybox/config/busybox-1.36.0.config |  110 +
 openlibs/sqlite/build.sh                      |  192 ++-
 openlibs/stunnel/build.sh                     |  202 ++-
 openlibs/cjson/build.sh                       |  182 +++
 openlibs/busybox/build.sh                     |  195 +++
 openlibs/pppd/build.sh                        |  216 +++-
 openlibs/libevent/build.sh                    |  186 ++-
 openlibs/libgpiod/build.sh                    |  174 +-
 16 files changed, 1,947 insertions(+), 955 deletions(-)

diff --git a/hal/modules/libgpiod/build.sh b/hal/modules/libgpiod/build.sh
index a4ec3f4..d59af44 100755
--- a/hal/modules/libgpiod/build.sh
+++ b/hal/modules/libgpiod/build.sh
@@ -6,10 +6,10 @@
 PACK_SUFIX=tar.gz
 
 # LingYun source code FTP server
-LY_FTP=http://master.weike-iot.com:2211/src/
+LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
 # library download URL address
-LIB_URL=$LY_FTP
+LIB_URL=$LYFTP_SRC
 
 # Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
@@ -40,144 +40,144 @@
 #+-------------------------+
 
 function pr_error() {
-	echo -e "\033[40;31m $1 \033[0m"
+    echo -e "\033[40;31m $1 \033[0m"
 }
 
 function pr_warn() {
-	echo -e "\033[40;33m $1 \033[0m"
+    echo -e "\033[40;33m $1 \033[0m"
 }
 
 function pr_info() {
-	echo -e "\033[40;32m $1 \033[0m"
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
-	if [ $? != 0 ] ; then
-		pr_error "$1"
-		exit
-	fi
+    if [ $? != 0 ] ; then
+        pr_error "$1"
+        exit
+    fi
 }
 # decompress a packet to destination path
 function do_unpack()
 {
-	tarball=$1
-	dstpath=`pwd`
+    tarball=$1
+    dstpath=`pwd`
 
-	if [[ $# == 2 ]] ; then
-		dstpath=$2
-	fi
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
 
-	pr_info "decompress $tarball => $dstpath"
+    pr_info "decompress $tarball => $dstpath"
 
-	mkdir -p $dstpath
-	case $tarball in
-		*.tar.gz)
-			tar -xzf $tarball -C $dstpath
-			;;
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
 
-		*.tar.bz2)
-			tar -xjf $tarball -C $dstpath
-			;;
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
 
-		*.tar.xz)
-			tar -xJf $tarball -C $dstpath
-			;;
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
 
-		*.tar.zst)
-			tar -I zstd -xf $tarball -C $dstpath
-			;;
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
 
-		*.tar)
-			tar -xf $tarball -C $dstpath
-			;;
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
 
-		*.zip)
-			unzip -qo $tarball -d $dstpath
-			;;
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
 
-		*)
-			pr_error "decompress Unsupport packet: $tarball"
-			return 1;
-			;;
-	esac
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
 }
 
 function do_export()
 {
-	BUILD_ARCH=$(uname -m)
-	if [[ $BUILD_ARCH =~ "arm" ]] ; then
-		pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
-		return ;
-	fi
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
 
-	pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
 
-	# export cross toolchain
-	export CC=${CROSS_COMPILE}gcc
-	export CXX=${CROSS_COMPILE}g++
-	export AS=${CROSS_COMPILE}as
-	export AR=${CROSS_COMPILE}ar
-	export LD=${CROSS_COMPILE}ld
-	export NM=${CROSS_COMPILE}nm
-	export RANLIB=${CROSS_COMPILE}ranlib
-	export OBJDUMP=${CROSS_COMPILE}objdump
-	export STRIP=${CROSS_COMPILE}strip
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
 
-	# export cross configure
-	export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
-	# Clear LDFLAGS and CFLAGS
-	export LDFLAGS=
-	export CFLAGS=
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
 }
 
 function do_fetch()
 {
-	if [ -e ${INST_FILE} ] ; then
-		pr_warn "$LIB_NAME compile and installed alredy"
-		exit ;
-	fi
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
 
-	if [ -d $LIB_NAME ] ; then
-		pr_warn "$LIB_NAME fetch already"
-		return ;
-	fi
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
 
-	if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
-		wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
-		check_result "ERROR: download ${LIB_NAME} failure"
-	fi
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-	do_unpack ${LIB_NAME}.${PACK_SUFIX}
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
 function do_build()
 {
-	cd $LIB_NAME
+    cd $LIB_NAME
 
-	./autogen.sh
+    ./autogen.sh
 
-	do_export
+    do_export
 
-	echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
-	./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
-		--cache-file=arm-linux.cache --enable-tools
-	check_result "ERROR: configure ${LIB_NAME} failure"
+    echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
+        --cache-file=arm-linux.cache --enable-tools
+    check_result "ERROR: configure ${LIB_NAME} failure"
 
-	make -j ${JOBS} && make install
-	check_result "ERROR: compile ${LIB_NAME} failure"
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
 }
 
 function do_clean()
 {
-	rm -rf *${LIB_NAME}*
+    rm -rf *${LIB_NAME}*
 }
 
 if [[ $# == 1 && $1 == -c ]] ;then
-	pr_warn "start clean ${LIB_NAME}"
-	do_clean
-	exit;
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
 fi
 
 do_fetch
diff --git a/openlibs/busybox/build.sh b/openlibs/busybox/build.sh
index 615c9dd..be2b3a7 100755
--- a/openlibs/busybox/build.sh
+++ b/openlibs/busybox/build.sh
@@ -1,75 +1,184 @@
 #!/bin/bash
 
-set -e
+# library name and version
+# Official: https://busybox.net/downloads/
+LIB_NAME=busybox-1.36.0
+PACK_SUFIX=tar.bz2
 
-ROOTFS_PATH=`pwd`/../../linux-bsp/rootfs/
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
 
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
 
-JOBS=`cat /proc/cpuinfo  |  grep processor | wc -l`
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/busybox
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-
-function compile_busybox()
+# decompress a packet to destination path
+function do_unpack()
 {
-    SRC_NAME=busybox-1.31.0
-    PACK_SUFIX=tar.bz2
+    tarball=$1
+    dstpath=`pwd`
 
-    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}
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
     fi
 
-    cp config/${SRC_NAME}.config $SRC_NAME/.config
+    pr_info "decompress $tarball => $dstpath"
 
-    cd $SRC_NAME
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
 
-    sed -i "s|^CONFIG_CROSS_COMPILER_PREFIX.*|CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILE}\"|g" .config 
-    sed -i "s|^CONFIG_PREFIX.*|CONFIG_PREFIX=\"$ROOTFS_PATH\"|g" .config
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
 
-    make 
-    #make uninstall && sudo make install
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
 }
 
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
 
-compile_busybox
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
 
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
 
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
+}
 
+function do_fetch()
+{
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
+
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
+
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
+
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
+}
+
+function do_build()
+{
+    cd $LIB_NAME
+
+    cp $PRJ_PATH/config/${LIB_NAME}.config .config
+
+    do_export
+
+    make -j ${JOBS} CROSS_COMPILE=$CROSS_COMPILE
+    check_result "ERROR: compile ${LIB_NAME} failure"
+
+    pr_info "${LIB_NAME} installed to '${BIN_PATH}'"
+    mkdir -p ${BIN_PATH}
+    install -m 755 busybox ${BIN_PATH}/
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
 
diff --git a/openlibs/busybox/config/busybox-1.31.0.config b/openlibs/busybox/config/busybox-1.36.0.config
similarity index 95%
rename from openlibs/busybox/config/busybox-1.31.0.config
rename to openlibs/busybox/config/busybox-1.36.0.config
index 84497d1..cab3838 100644
--- a/openlibs/busybox/config/busybox-1.31.0.config
+++ b/openlibs/busybox/config/busybox-1.36.0.config
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Busybox version: 1.31.0
-# Mon Aug 12 14:27:57 2019
+# Busybox version: 1.36.0
+# Tue Aug 15 16:28:32 2023
 #
 CONFIG_HAVE_DOT_CONFIG=y
 
@@ -36,7 +36,6 @@
 # CONFIG_FEATURE_CLEAN_UP is not set
 CONFIG_FEATURE_SYSLOG_INFO=y
 CONFIG_FEATURE_SYSLOG=y
-CONFIG_PLATFORM_LINUX=y
 
 #
 # Build Options
@@ -48,13 +47,14 @@
 # CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
 # CONFIG_FEATURE_INDIVIDUAL is not set
 # CONFIG_FEATURE_SHARED_BUSYBOX is not set
-CONFIG_CROSS_COMPILER_PREFIX="/opt/buildroot/cortex-a5/bin/arm-linux-"
+CONFIG_CROSS_COMPILER_PREFIX=""
 CONFIG_SYSROOT=""
 CONFIG_EXTRA_CFLAGS=""
 CONFIG_EXTRA_LDFLAGS=""
 CONFIG_EXTRA_LDLIBS=""
 # CONFIG_USE_PORTABLE_CODE is not set
 CONFIG_STACK_OPTIMIZATION_386=y
+CONFIG_STATIC_LIBGCC=y
 
 #
 # Installation Options ("make install" behavior)
@@ -76,6 +76,7 @@
 # CONFIG_DEBUG_SANITIZE is not set
 # CONFIG_UNIT_TEST is not set
 # CONFIG_WERROR is not set
+# CONFIG_WARN_SIMPLE_MSG is not set
 CONFIG_NO_DEBUG_LIB=y
 # CONFIG_DMALLOC is not set
 # CONFIG_EFENCE is not set
@@ -92,10 +93,16 @@
 # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
 CONFIG_PASSWORD_MINLEN=6
 CONFIG_MD5_SMALL=1
+CONFIG_SHA1_SMALL=3
+CONFIG_SHA1_HWACCEL=y
+CONFIG_SHA256_HWACCEL=y
 CONFIG_SHA3_SMALL=1
-# CONFIG_FEATURE_FAST_TOP is not set
-# CONFIG_FEATURE_ETC_NETWORKS is not set
-# CONFIG_FEATURE_ETC_SERVICES is not set
+CONFIG_FEATURE_NON_POSIX_CP=y
+# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
+CONFIG_FEATURE_USE_SENDFILE=y
+CONFIG_FEATURE_COPYBUF_KB=4
+CONFIG_MONOTONIC_SYSCALL=y
+CONFIG_IOCTL_HEX2STR_ERROR=y
 CONFIG_FEATURE_EDITING=y
 CONFIG_FEATURE_EDITING_MAX_LEN=1024
 # CONFIG_FEATURE_EDITING_VI is not set
@@ -119,14 +126,9 @@
 # CONFIG_UNICODE_BIDI_SUPPORT is not set
 # CONFIG_UNICODE_NEUTRAL_TABLE is not set
 # CONFIG_UNICODE_PRESERVE_BROKEN is not set
-CONFIG_FEATURE_NON_POSIX_CP=y
-# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
-CONFIG_FEATURE_USE_SENDFILE=y
-CONFIG_FEATURE_COPYBUF_KB=4
-CONFIG_FEATURE_SKIP_ROOTFS=y
-CONFIG_MONOTONIC_SYSCALL=y
-CONFIG_IOCTL_HEX2STR_ERROR=y
-CONFIG_FEATURE_HWIB=y
+# CONFIG_LOOP_CONFIGURE is not set
+# CONFIG_NO_LOOP_CONFIGURE is not set
+CONFIG_TRY_LOOP_CONFIGURE=y
 
 #
 # Applets
@@ -161,6 +163,8 @@
 # CONFIG_CPIO is not set
 # CONFIG_FEATURE_CPIO_O is not set
 # CONFIG_FEATURE_CPIO_P is not set
+# CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set
+# CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set
 CONFIG_DPKG=y
 # CONFIG_DPKG_DEB is not set
 CONFIG_GZIP=y
@@ -196,6 +200,22 @@
 #
 # Coreutils
 #
+CONFIG_FEATURE_VERBOSE=y
+
+#
+# Common options for date and touch
+#
+CONFIG_FEATURE_TIMEZONE=y
+
+#
+# Common options for cp and mv
+#
+CONFIG_FEATURE_PRESERVE_HARDLINKS=y
+
+#
+# Common options for df, du, ls
+#
+CONFIG_FEATURE_HUMAN_READABLE=y
 CONFIG_BASENAME=y
 CONFIG_CAT=y
 CONFIG_FEATURE_CATN=y
@@ -206,11 +226,13 @@
 CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
 CONFIG_CHROOT=y
 CONFIG_CKSUM=y
+CONFIG_CRC32=y
 CONFIG_COMM=y
 CONFIG_CP=y
 CONFIG_FEATURE_CP_LONG_OPTIONS=y
 CONFIG_FEATURE_CP_REFLINK=y
 CONFIG_CUT=y
+CONFIG_FEATURE_CUT_REGEX=y
 CONFIG_DATE=y
 CONFIG_FEATURE_DATE_ISOFMT=y
 # CONFIG_FEATURE_DATE_NANO is not set
@@ -222,6 +244,7 @@
 CONFIG_FEATURE_DD_STATUS=y
 CONFIG_DF=y
 CONFIG_FEATURE_DF_FANCY=y
+CONFIG_FEATURE_SKIP_ROOTFS=y
 CONFIG_DIRNAME=y
 CONFIG_DOS2UNIX=y
 CONFIG_UNIX2DOS=y
@@ -315,13 +338,13 @@
 CONFIG_FEATURE_TEST_64=y
 CONFIG_TIMEOUT=y
 CONFIG_TOUCH=y
-CONFIG_FEATURE_TOUCH_NODEREF=y
 CONFIG_FEATURE_TOUCH_SUSV3=y
 CONFIG_TR=y
 CONFIG_FEATURE_TR_CLASSES=y
 CONFIG_FEATURE_TR_EQUIV=y
 CONFIG_TRUE=y
 CONFIG_TRUNCATE=y
+CONFIG_TSORT=y
 CONFIG_TTY=y
 CONFIG_UNAME=y
 CONFIG_UNAME_OSNAME="GNU/Linux"
@@ -330,6 +353,7 @@
 CONFIG_UNLINK=y
 CONFIG_USLEEP=y
 CONFIG_UUDECODE=y
+CONFIG_BASE32=y
 CONFIG_BASE64=y
 CONFIG_UUENCODE=y
 CONFIG_WC=y
@@ -339,21 +363,6 @@
 CONFIG_USERS=y
 CONFIG_WHOAMI=y
 CONFIG_YES=y
-
-#
-# Common options
-#
-CONFIG_FEATURE_VERBOSE=y
-
-#
-# Common options for cp and mv
-#
-CONFIG_FEATURE_PRESERVE_HARDLINKS=y
-
-#
-# Common options for df, du, ls
-#
-CONFIG_FEATURE_HUMAN_READABLE=y
 
 #
 # Console Utilities
@@ -422,6 +431,7 @@
 CONFIG_FEATURE_VI_MAX_LEN=4096
 # CONFIG_FEATURE_VI_8BIT is not set
 CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_COLON_EXPAND=y
 CONFIG_FEATURE_VI_YANKMARK=y
 CONFIG_FEATURE_VI_SEARCH=y
 # CONFIG_FEATURE_VI_REGEX_SEARCH is not set
@@ -435,6 +445,7 @@
 CONFIG_FEATURE_VI_UNDO=y
 CONFIG_FEATURE_VI_UNDO_QUEUE=y
 CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
+CONFIG_FEATURE_VI_VERBOSE_STATUS=y
 CONFIG_FEATURE_ALLOW_EXEC=y
 
 #
@@ -443,7 +454,11 @@
 CONFIG_FIND=y
 CONFIG_FEATURE_FIND_PRINT0=y
 CONFIG_FEATURE_FIND_MTIME=y
+CONFIG_FEATURE_FIND_ATIME=y
+CONFIG_FEATURE_FIND_CTIME=y
 CONFIG_FEATURE_FIND_MMIN=y
+CONFIG_FEATURE_FIND_AMIN=y
+CONFIG_FEATURE_FIND_CMIN=y
 CONFIG_FEATURE_FIND_PERM=y
 CONFIG_FEATURE_FIND_TYPE=y
 CONFIG_FEATURE_FIND_EXECUTABLE=y
@@ -451,6 +466,7 @@
 CONFIG_FEATURE_FIND_MAXDEPTH=y
 CONFIG_FEATURE_FIND_NEWER=y
 CONFIG_FEATURE_FIND_INUM=y
+CONFIG_FEATURE_FIND_SAMEFILE=y
 CONFIG_FEATURE_FIND_EXEC=y
 CONFIG_FEATURE_FIND_EXEC_PLUS=y
 CONFIG_FEATURE_FIND_USER=y
@@ -462,6 +478,7 @@
 CONFIG_FEATURE_FIND_PRUNE=y
 CONFIG_FEATURE_FIND_QUIT=y
 CONFIG_FEATURE_FIND_DELETE=y
+CONFIG_FEATURE_FIND_EMPTY=y
 CONFIG_FEATURE_FIND_PATH=y
 CONFIG_FEATURE_FIND_REGEX=y
 # CONFIG_FEATURE_FIND_CONTEXT is not set
@@ -621,7 +638,6 @@
 CONFIG_GETOPT=y
 CONFIG_FEATURE_GETOPT_LONG=y
 CONFIG_HEXDUMP=y
-CONFIG_FEATURE_HEXDUMP_REVERSE=y
 # CONFIG_HD is not set
 CONFIG_XXD=y
 CONFIG_HWCLOCK=y
@@ -692,6 +708,7 @@
 CONFIG_SWITCH_ROOT=y
 CONFIG_TASKSET=y
 CONFIG_FEATURE_TASKSET_FANCY=y
+CONFIG_FEATURE_TASKSET_CPULIST=y
 CONFIG_UEVENT=y
 CONFIG_UMOUNT=y
 CONFIG_FEATURE_UMOUNT_ALL=y
@@ -712,6 +729,7 @@
 CONFIG_FEATURE_VOLUMEID_BCACHE=y
 CONFIG_FEATURE_VOLUMEID_BTRFS=y
 CONFIG_FEATURE_VOLUMEID_CRAMFS=y
+CONFIG_FEATURE_VOLUMEID_EROFS=y
 CONFIG_FEATURE_VOLUMEID_EXFAT=y
 CONFIG_FEATURE_VOLUMEID_EXT=y
 CONFIG_FEATURE_VOLUMEID_F2FS=y
@@ -739,6 +757,7 @@
 # Miscellaneous Utilities
 #
 CONFIG_ADJTIMEX=y
+CONFIG_ASCII=y
 # CONFIG_BBCONFIG is not set
 # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
 CONFIG_BC=y
@@ -809,6 +828,7 @@
 CONFIG_FEATURE_MAKEDEVS_TABLE=y
 # CONFIG_MAN is not set
 CONFIG_MICROCOM=y
+CONFIG_MIM=y
 # CONFIG_MT is not set
 CONFIG_NANDWRITE=y
 CONFIG_NANDDUMP=y
@@ -818,10 +838,12 @@
 # CONFIG_RFKILL is not set
 CONFIG_RUNLEVEL=y
 CONFIG_RX=y
+CONFIG_SEEDRNG=y
 CONFIG_SETFATTR=y
 CONFIG_SETSERIAL=y
 CONFIG_STRINGS=y
 CONFIG_TIME=y
+CONFIG_TREE=y
 CONFIG_TS=y
 CONFIG_TTYSIZE=y
 CONFIG_UBIATTACH=y
@@ -833,6 +855,7 @@
 CONFIG_UBIRENAME=y
 CONFIG_VOLNAME=y
 CONFIG_WATCHDOG=y
+# CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set
 
 #
 # Networking Utilities
@@ -841,6 +864,9 @@
 # CONFIG_FEATURE_UNIX_LOCAL is not set
 # CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
 # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+# CONFIG_FEATURE_ETC_SERVICES is not set
+CONFIG_FEATURE_HWIB=y
 # CONFIG_FEATURE_TLS_SHA1 is not set
 CONFIG_ARP=y
 CONFIG_ARPING=y
@@ -859,6 +885,7 @@
 CONFIG_HOSTNAME=y
 CONFIG_DNSDOMAINNAME=y
 # CONFIG_HTTPD is not set
+CONFIG_FEATURE_HTTPD_PORT_DEFAULT=0
 # CONFIG_FEATURE_HTTPD_RANGES is not set
 # CONFIG_FEATURE_HTTPD_SETUID is not set
 # CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
@@ -870,6 +897,10 @@
 # CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
 # CONFIG_FEATURE_HTTPD_PROXY is not set
 # CONFIG_FEATURE_HTTPD_GZIP is not set
+# CONFIG_FEATURE_HTTPD_ETAG is not set
+# CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set
+# CONFIG_FEATURE_HTTPD_DATE is not set
+# CONFIG_FEATURE_HTTPD_ACL_IP is not set
 CONFIG_IFCONFIG=y
 CONFIG_FEATURE_IFCONFIG_STATUS=y
 CONFIG_FEATURE_IFCONFIG_SLIP=y
@@ -947,6 +978,7 @@
 CONFIG_FEATURE_TELNET_WIDTH=y
 # CONFIG_TELNETD is not set
 # CONFIG_FEATURE_TELNETD_STANDALONE is not set
+CONFIG_FEATURE_TELNETD_PORT_DEFAULT=0
 # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
 CONFIG_TFTP=y
 CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
@@ -967,6 +999,7 @@
 CONFIG_WGET=y
 CONFIG_FEATURE_WGET_LONG_OPTIONS=y
 CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_FTP=y
 CONFIG_FEATURE_WGET_AUTHENTICATION=y
 CONFIG_FEATURE_WGET_TIMEOUT=y
 CONFIG_FEATURE_WGET_HTTPS=y
@@ -983,6 +1016,7 @@
 CONFIG_FEATURE_UDHCPC_ARPING=y
 CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
 CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+CONFIG_UDHCPC6_DEFAULT_SCRIPT=""
 # CONFIG_UDHCPC6 is not set
 # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
 # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
@@ -992,6 +1026,7 @@
 #
 # Common options for DHCP applets
 #
+CONFIG_UDHCPC_DEFAULT_INTERFACE="eth0"
 # CONFIG_FEATURE_UDHCP_PORT is not set
 CONFIG_UDHCP_DEBUG=2
 CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
@@ -1009,17 +1044,19 @@
 #
 # Mail Utilities
 #
+CONFIG_FEATURE_MIME_CHARSET=""
 # CONFIG_MAKEMIME is not set
 # CONFIG_POPMAILDIR is not set
 # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
 # CONFIG_REFORMIME is not set
 # CONFIG_FEATURE_REFORMIME_COMPAT is not set
 # CONFIG_SENDMAIL is not set
-CONFIG_FEATURE_MIME_CHARSET=""
 
 #
 # Process Utilities
 #
+# CONFIG_FEATURE_FAST_TOP is not set
+CONFIG_FEATURE_SHOW_THREADS=y
 CONFIG_FREE=y
 CONFIG_FUSER=y
 CONFIG_IOSTAT=y
@@ -1058,7 +1095,6 @@
 CONFIG_UPTIME=y
 CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
 CONFIG_WATCH=y
-CONFIG_FEATURE_SHOW_THREADS=y
 
 #
 # Runit Utilities
@@ -1099,6 +1135,7 @@
 CONFIG_BASH_IS_ASH=y
 # CONFIG_BASH_IS_HUSH is not set
 # CONFIG_BASH_IS_NONE is not set
+CONFIG_SHELL_ASH=y
 CONFIG_ASH=y
 CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
 CONFIG_ASH_INTERNAL_GLOB=y
@@ -1114,15 +1151,17 @@
 CONFIG_ASH_ECHO=y
 CONFIG_ASH_PRINTF=y
 CONFIG_ASH_TEST=y
+CONFIG_ASH_SLEEP=y
 CONFIG_ASH_HELP=y
 CONFIG_ASH_GETOPTS=y
 CONFIG_ASH_CMDCMD=y
 CONFIG_CTTYHACK=y
 # CONFIG_HUSH is not set
+# CONFIG_SHELL_HUSH is not set
 # CONFIG_HUSH_BASH_COMPAT is not set
 # CONFIG_HUSH_BRACE_EXPANSION is not set
-# CONFIG_HUSH_LINENO_VAR is not set
 # CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
+# CONFIG_HUSH_LINENO_VAR is not set
 # CONFIG_HUSH_INTERACTIVE is not set
 # CONFIG_HUSH_SAVEHISTORY is not set
 # CONFIG_HUSH_JOB is not set
@@ -1185,6 +1224,7 @@
 CONFIG_FEATURE_REMOTE_LOG=y
 CONFIG_FEATURE_SYSLOGD_DUP=y
 CONFIG_FEATURE_SYSLOGD_CFG=y
+# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
 CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
 CONFIG_FEATURE_IPC_SYSLOG=y
 CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
diff --git a/openlibs/cJSON/build.sh b/openlibs/cJSON/build.sh
deleted file mode 100755
index 69e60a3..0000000
--- a/openlibs/cJSON/build.sh
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/bin/bash
-
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile JSON library cJSON for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
-
-PREFIX_PATH=`pwd`/../install
-
-LYFTP_SRC=http://master.weike-iot.com:2211/src/
-
-CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
-
-mkdir -p ${PREFIX_PATH}
-
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
-}
-
-function check_result()
-{
-    if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
-    fi
-}
-
-function export_cross()
-{
-    # export cross toolchain
-    export CC=${CROSS_COMPILE}gcc
-    export CXX=${CROSS_COMPILE}g++
-    export AS=${CROSS_COMPILE}as
-    export AR=${CROSS_COMPILE}ar
-    export LD=${CROSS_COMPILE}ld
-    export NM=${CROSS_COMPILE}nm
-    export RANLIB=${CROSS_COMPILE}ranlib
-    export OBJDUMP=${CROSS_COMPILE}objdump
-    export STRIP=${CROSS_COMPILE}strip
-
-    # export cross configure 
-    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
-
-    # Clear LDFLAGS and CFLAGS
-    export LDFLAGS=
-    export CFLAGS=
-}
-
-
-function compile_cJSON()
-{
-    SRC_NAME=cJSON-1.7.14
-    PACK_SUFIX=tar.gz
-
-    if [ -f ${PREFIX_PATH}/lib/libcjson.so ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
-    fi
-
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        # https://github.com/DaveGamble/cJSON/tags
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-
-        check_result "ERROR: download ${SRC_NAME} failure"
-    fi
-
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
-
-
-    sed -i -e "s|^CC.*|CC = ${CROSS_COMPILE}gcc -std=c89|g" Makefile
-    sed -i -e "s|^PREFIX.*|PREFIX = ${PREFIX_PATH}|g" Makefile
-    
-    make 
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-    make install
-
-    cd -
-}
-
-export_cross
-
-compile_cJSON
-
-
diff --git a/openlibs/cjson/build.sh b/openlibs/cjson/build.sh
new file mode 100755
index 0000000..5b94603
--- /dev/null
+++ b/openlibs/cjson/build.sh
@@ -0,0 +1,182 @@
+#!/bin/bash
+
+# library name and version
+# Official: https://github.com/DaveGamble/cJSON
+LIB_NAME=cJSON-1.7.15
+PACK_SUFIX=tar.gz
+
+# LingYun source code FTP server
+LYFTP_SRC=http://master.weike-iot.com:2211/src/
+
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
+CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
+
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/lib/libcjson.so
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
+}
+
+function check_result()
+{
+    if [ $? != 0 ] ; then
+        pr_error "$1"
+    fi
+}
+# decompress a packet to destination path
+function do_unpack()
+{
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
+
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
+}
+
+function do_fetch()
+{
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
+
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
+
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
+
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
+}
+
+function do_build()
+{
+    cd $LIB_NAME
+
+    do_export
+
+    sed -i "s|^CC =.*|CC = ${CROSS_COMPILE}gcc -std=c89|" Makefile
+
+    make && make PREFIX=$PREFIX_PATH install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+
+    cp libcjson.a $PREFIX_PATH/lib
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
+
diff --git a/openlibs/libevent/build.sh b/openlibs/libevent/build.sh
index 3e6f109..63d7c92 100755
--- a/openlibs/libevent/build.sh
+++ b/openlibs/libevent/build.sh
@@ -1,41 +1,117 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile libevent for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://github.com/libevent/libevent/releases/download/
+LIB_NAME=libevent-2.1.11-stable
+PACK_SUFIX=tar.gz
 
-PREFIX_PATH=`pwd`/../install
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/lib/libevent.so
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
     export CXX=${CROSS_COMPILE}g++
@@ -47,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -55,40 +131,52 @@
     export CFLAGS=
 }
 
-function compile_libevent()
+function do_fetch()
 {
-    SRC_NAME=libevent-2.1.11-stable
-    PACK_SUFIX=tar.gz
-
-    if [ -f ${PREFIX_PATH}/lib/libevent.so ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/${SRC_NAME}.${PACK_SUFIX}
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS}  --enable-thread-support --enable-openssl --enable-function-sections
-    check_result "ERROR: configure ${SRC_NAME} failure"
-
-    make  && make install
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
+function do_build()
+{
+    cd $LIB_NAME
 
-export_cross
+    do_export
 
-compile_libevent
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
+        --enable-thread-support --enable-openssl --enable-function-sections
+    check_result "ERROR: configure ${LIB_NAME} failure"
 
+    make && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
 
diff --git a/openlibs/libgpiod/build.sh b/openlibs/libgpiod/build.sh
index a4ec3f4..d59af44 100755
--- a/openlibs/libgpiod/build.sh
+++ b/openlibs/libgpiod/build.sh
@@ -6,10 +6,10 @@
 PACK_SUFIX=tar.gz
 
 # LingYun source code FTP server
-LY_FTP=http://master.weike-iot.com:2211/src/
+LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
 # library download URL address
-LIB_URL=$LY_FTP
+LIB_URL=$LYFTP_SRC
 
 # Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
@@ -40,144 +40,144 @@
 #+-------------------------+
 
 function pr_error() {
-	echo -e "\033[40;31m $1 \033[0m"
+    echo -e "\033[40;31m $1 \033[0m"
 }
 
 function pr_warn() {
-	echo -e "\033[40;33m $1 \033[0m"
+    echo -e "\033[40;33m $1 \033[0m"
 }
 
 function pr_info() {
-	echo -e "\033[40;32m $1 \033[0m"
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
-	if [ $? != 0 ] ; then
-		pr_error "$1"
-		exit
-	fi
+    if [ $? != 0 ] ; then
+        pr_error "$1"
+        exit
+    fi
 }
 # decompress a packet to destination path
 function do_unpack()
 {
-	tarball=$1
-	dstpath=`pwd`
+    tarball=$1
+    dstpath=`pwd`
 
-	if [[ $# == 2 ]] ; then
-		dstpath=$2
-	fi
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
 
-	pr_info "decompress $tarball => $dstpath"
+    pr_info "decompress $tarball => $dstpath"
 
-	mkdir -p $dstpath
-	case $tarball in
-		*.tar.gz)
-			tar -xzf $tarball -C $dstpath
-			;;
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
 
-		*.tar.bz2)
-			tar -xjf $tarball -C $dstpath
-			;;
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
 
-		*.tar.xz)
-			tar -xJf $tarball -C $dstpath
-			;;
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
 
-		*.tar.zst)
-			tar -I zstd -xf $tarball -C $dstpath
-			;;
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
 
-		*.tar)
-			tar -xf $tarball -C $dstpath
-			;;
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
 
-		*.zip)
-			unzip -qo $tarball -d $dstpath
-			;;
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
 
-		*)
-			pr_error "decompress Unsupport packet: $tarball"
-			return 1;
-			;;
-	esac
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
 }
 
 function do_export()
 {
-	BUILD_ARCH=$(uname -m)
-	if [[ $BUILD_ARCH =~ "arm" ]] ; then
-		pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
-		return ;
-	fi
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
 
-	pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
 
-	# export cross toolchain
-	export CC=${CROSS_COMPILE}gcc
-	export CXX=${CROSS_COMPILE}g++
-	export AS=${CROSS_COMPILE}as
-	export AR=${CROSS_COMPILE}ar
-	export LD=${CROSS_COMPILE}ld
-	export NM=${CROSS_COMPILE}nm
-	export RANLIB=${CROSS_COMPILE}ranlib
-	export OBJDUMP=${CROSS_COMPILE}objdump
-	export STRIP=${CROSS_COMPILE}strip
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
 
-	# export cross configure
-	export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
-	# Clear LDFLAGS and CFLAGS
-	export LDFLAGS=
-	export CFLAGS=
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
 }
 
 function do_fetch()
 {
-	if [ -e ${INST_FILE} ] ; then
-		pr_warn "$LIB_NAME compile and installed alredy"
-		exit ;
-	fi
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
 
-	if [ -d $LIB_NAME ] ; then
-		pr_warn "$LIB_NAME fetch already"
-		return ;
-	fi
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
 
-	if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
-		wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
-		check_result "ERROR: download ${LIB_NAME} failure"
-	fi
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-	do_unpack ${LIB_NAME}.${PACK_SUFIX}
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
 function do_build()
 {
-	cd $LIB_NAME
+    cd $LIB_NAME
 
-	./autogen.sh
+    ./autogen.sh
 
-	do_export
+    do_export
 
-	echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
-	./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
-		--cache-file=arm-linux.cache --enable-tools
-	check_result "ERROR: configure ${LIB_NAME} failure"
+    echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
+        --cache-file=arm-linux.cache --enable-tools
+    check_result "ERROR: configure ${LIB_NAME} failure"
 
-	make -j ${JOBS} && make install
-	check_result "ERROR: compile ${LIB_NAME} failure"
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
 }
 
 function do_clean()
 {
-	rm -rf *${LIB_NAME}*
+    rm -rf *${LIB_NAME}*
 }
 
 if [[ $# == 1 && $1 == -c ]] ;then
-	pr_warn "start clean ${LIB_NAME}"
-	do_clean
-	exit;
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
 fi
 
 do_fetch
diff --git a/openlibs/libxml2/build.sh b/openlibs/libxml2/build.sh
index 3abf05a..1501746 100755
--- a/openlibs/libxml2/build.sh
+++ b/openlibs/libxml2/build.sh
@@ -2,7 +2,7 @@
 
 # library name and version
 # Official: https://download.gnome.org/sources/libxml2/
-LIB_NAME=libxml2-2.13.3
+LIB_NAME=libxml2-2.11.5
 PACK_SUFIX=tar.xz
 
 # LingYun source code FTP server
@@ -40,140 +40,140 @@
 #+-------------------------+
 
 function pr_error() {
-	echo -e "\033[40;31m $1 \033[0m"
+    echo -e "\033[40;31m $1 \033[0m"
 }
 
 function pr_warn() {
-	echo -e "\033[40;33m $1 \033[0m"
+    echo -e "\033[40;33m $1 \033[0m"
 }
 
 function pr_info() {
-	echo -e "\033[40;32m $1 \033[0m"
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
-	if [ $? != 0 ] ; then
-		pr_error $1
-	fi
+    if [ $? != 0 ] ; then
+        pr_error "$1"
+    fi
 }
 # decompress a packet to destination path
 function do_unpack()
 {
-	tarball=$1
-	dstpath=`pwd`
+    tarball=$1
+    dstpath=`pwd`
 
-	if [[ $# == 2 ]] ; then
-		dstpath=$2
-	fi
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
 
-	pr_info "decompress $tarball => $dstpath"
+    pr_info "decompress $tarball => $dstpath"
 
-	mkdir -p $dstpath
-	case $tarball in
-		*.tar.gz)
-			tar -xzf $tarball -C $dstpath
-			;;
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
 
-		*.tar.bz2)
-			tar -xjf $tarball -C $dstpath
-			;;
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
 
-		*.tar.xz)
-			tar -xJf $tarball -C $dstpath
-			;;
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
 
-		*.tar.zst)
-			tar -I zstd -xf $tarball -C $dstpath
-			;;
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
 
-		*.tar)
-			tar -xf $tarball -C $dstpath
-			;;
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
 
-		*.zip)
-			unzip -qo $tarball -d $dstpath
-			;;
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
 
-		*)
-			pr_error "decompress Unsupport packet: $tarball"
-			return 1;
-			;;
-	esac
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
 }
 
 function do_export()
 {
-	BUILD_ARCH=$(uname -m)
-	if [[ $BUILD_ARCH =~ "arm" ]] ; then
-		pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
-		return ;
-	fi
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
 
-	pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
 
-	# export cross toolchain
-	export CC=${CROSS_COMPILE}gcc
-	export CXX=${CROSS_COMPILE}g++
-	export AS=${CROSS_COMPILE}as
-	export AR=${CROSS_COMPILE}ar
-	export LD=${CROSS_COMPILE}ld
-	export NM=${CROSS_COMPILE}nm
-	export RANLIB=${CROSS_COMPILE}ranlib
-	export OBJDUMP=${CROSS_COMPILE}objdump
-	export STRIP=${CROSS_COMPILE}strip
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
 
-	# export cross configure
-	export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
-	# Clear LDFLAGS and CFLAGS
-	export LDFLAGS=
-	export CFLAGS=
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
 }
 
 function do_fetch()
 {
-	if [ -e ${INST_FILE} ] ; then
-		pr_warn "$LIB_NAME compile and installed alredy"
-		exit ;
-	fi
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
 
-	if [ -d $LIB_NAME ] ; then
-		pr_warn "$LIB_NAME fetch already"
-		return ;
-	fi
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
 
-	if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
-		wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
-		check_result "ERROR: download ${LIB_NAME} failure"
-	fi
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-	do_unpack ${LIB_NAME}.${PACK_SUFIX}
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
 function do_build()
 {
-	cd $LIB_NAME
+    cd $LIB_NAME
 
-	do_export
+    do_export
 
-	./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
-		--without-python --without-zlib --without-lzma
-	check_result "ERROR: configure ${LIB_NAME} failure"
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
+        --without-python --without-zlib --without-lzma
+    check_result "ERROR: configure ${LIB_NAME} failure"
 
-	make && make install
-	check_result "ERROR: compile ${LIB_NAME} failure"
+    make && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
 }
 
 function do_clean()
 {
-	rm -rf *${LIB_NAME}*
+    rm -rf *${LIB_NAME}*
 }
 
 if [[ $# == 1 && $1 == -c ]] ;then
-	pr_warn "start clean ${LIB_NAME}"
-	do_clean
-	exit;
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
 fi
 
 do_fetch
diff --git a/openlibs/lrzsz/build.sh b/openlibs/lrzsz/build.sh
index ecbec6f..e8c1d10 100755
--- a/openlibs/lrzsz/build.sh
+++ b/openlibs/lrzsz/build.sh
@@ -1,44 +1,120 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile lzrz for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: http://www.ohse.de/uwe/releases/
+LIB_NAME=lrzsz-0.12.20
+PACK_SUFIX=tar.gz
 
-PRJ_PATH=`pwd`
-PREFIX_PATH=`pwd`/../install
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/sz
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
     export AS=${CROSS_COMPILE}as
     export AR=${CROSS_COMPILE}ar
     export LD=${CROSS_COMPILE}ld
@@ -47,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -55,46 +131,56 @@
     export CFLAGS=
 }
 
-function compile_lrzsz()
+function do_fetch()
 {
-    SRC_NAME=lrzsz-0.12.20
-    PACK_SUFIX=tar.gz
-    IMG_NAME=sz
-
-    if [ -f ${PRJ_PATH}/${IMG_NAME} ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget http://www.ohse.de/uwe/releases/${SRC_NAME}.${PACK_SUFIX}
-        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS}  --enable-thread-support --enable-openssl --enable-function-sections
-    check_result "ERROR: configure ${SRC_NAME} failure"
-
-    make  && make install
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-    ${STRIP} ${PREFIX_PATH}/bin/lrz
-    ${STRIP} ${PREFIX_PATH}/bin/lsz
-
-    cp ${PREFIX_PATH}/bin/lrz ${PRJ_PATH}/rz
-    cp ${PREFIX_PATH}/bin/lsz ${PRJ_PATH}/sz
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
+function do_build()
+{
+    cd $LIB_NAME
 
-export_cross
+    do_export
 
-compile_lrzsz
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS}
+    check_result "ERROR: configure ${LIB_NAME} failure"
 
+    make
+    check_result "ERROR: compile ${LIB_NAME} failure"
+
+    pr_info "${LIB_NAME} installed to '${BIN_PATH}'"
+    mkdir -p ${BIN_PATH}
+    install -m 755 src/lsz ${BIN_PATH}/sz
+    install -m 755 src/lrz ${BIN_PATH}/rz
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
 
diff --git a/openlibs/mosquitto/build.sh b/openlibs/mosquitto/build.sh
index 2623d8c..555e399 100755
--- a/openlibs/mosquitto/build.sh
+++ b/openlibs/mosquitto/build.sh
@@ -1,41 +1,117 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile MQTT C library mosquitto for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://mosquitto.org/
+LIB_NAME=mosquitto-2.0.15
+PACK_SUFIX=tar.gz
 
-PREFIX_PATH=`pwd`/../install
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/mosquitto
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
     export CXX=${CROSS_COMPILE}g++
@@ -47,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -55,51 +131,61 @@
     export CFLAGS=
 }
 
-
-function compile_mosquitto()
+function do_fetch()
 {
-    SRC_NAME=mosquitto-1.6.4
-    PACK_SUFIX=tar.gz
-
-    if [ -f ${PREFIX_PATH}/bin/mosquitto ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget https://mosquitto.org/files/source/${SRC_NAME}.${PACK_SUFIX}
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    export CFLAGS=-I${PREFIX_PATH}/include
-    export LDFLAGS="-L${PREFIX_PATH}/lib -lcrypto -lssl -ldl -lpthread"
-    export DESTDIR=${PREFIX_PATH}
-
-    make WITH_SRV=no WITH_UUID=no
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-    make DESTDIR=${PREFIX_PATH} prefix=/ install
-    cp src/mosquitto ${PREFIX_PATH}/bin
-    ${STRIP} ${PREFIX_PATH}/bin/mosquitto*
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
-if [ ! -f ${PREFIX_PATH}//lib/libcrypto.a ] ; then
-    cd ../openssl
-    ./build.sh
-    cd -
+function do_build()
+{
+    cd $LIB_NAME
+
+    do_export
+
+    export CFLAGS=-I${INC_PATH}
+    export LDFLAGS="-L${LIB_PATH} -lcrypto -lssl -ldl -lpthread"
+    export DESTDIR=${PREFIX_PATH}
+
+    make WITH_UUID=no WITH_STATIC_LIBRARIES=yes
+    check_result "ERROR: compile ${LIB_NAME} failure"
+
+    make DESTDIR=${PREFIX_PATH} prefix=/ install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+
+    install -m 755 src/mosquitto $BIN_PATH
+    install -m 644 lib/libmosquitto.a $LIB_PATH
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
 fi
 
-export_cross
+cd ../openssl && ./build.sh && cd -
+cd ../cjson && ./build.sh && cd -
 
-compile_mosquitto
+do_fetch
 
+do_build
 
diff --git a/openlibs/opencv/build.sh b/openlibs/opencv/build.sh
index 77179d5..d6c53da 100755
--- a/openlibs/opencv/build.sh
+++ b/openlibs/opencv/build.sh
@@ -1,84 +1,197 @@
 #!/bin/bash
 
-set -e
+# library name and version
+# Official: https://opencv.org/
+LIB_NAME=opencv-4.8.0
+PACK_SUFIX=zip
 
-PREFIX_PATH=`pwd`/../install/
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-TOOLCHAIN=cortexa7.toolchain.cmake
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
 
-JOBS=`cat /proc/cpuinfo  |  grep processor | wc -l`
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 " 
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/lib/opencv
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-
-function compile_opencv()
+# decompress a packet to destination path
+function do_unpack()
 {
-    SRC_NAME=opencv-3.4.6
-    PACK_SUFIX=zip
+    tarball=$1
+    dstpath=`pwd`
 
-    if [ -f ${PREFIX_PATH}/lib/libopencv_core.so ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
+    pr_info "decompress $tarball => $dstpath"
 
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
 
-    if [ ! -d $SRC_NAME ] ; then 
-        if [ ! -f $SRC_NAME.zip ] ; then 
-            wget $LYFTP_SRC/$SRC_NAME.${PACK_SUFIX}
-        fi
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
 
-        unzip $SRC_NAME.${PACK_SUFIX}
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_error "ERROR: local($BUILD_ARCH) compile $LIB_NAME not support for it's too slow"
+        exit 0;
     fi
 
-    cd $SRC_NAME
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
 
-    rm -f platforms/linux/${TOOLCHAIN} 
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
+
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
+}
+
+function do_fetch()
+{
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
+
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
+
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
+
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
+}
+
+function do_build()
+{
+    cd $LIB_NAME
+
+    do_export
+
+    TOOLCHAIN=armlinux.toolchain.cmake
+    rm -f platforms/linux/${TOOLCHAIN}
+
     cat >platforms/linux/${TOOLCHAIN} <<EOF
-
 set(GCC_COMPILER_VERSION "" CACHE STRING "GCC Compiler version")
 set(GNU_MACHINE "${CROSS_COMPILE%*-}" CACHE STRING "GNU compiler triple")
 include("\${CMAKE_CURRENT_LIST_DIR}/arm.toolchain.cmake")
 
 EOF
 
-    mkdir -p release
-    cd release
+    mkdir -p build && cd build
 
-    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`pwd`/../../../install \
+    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_PATH \
         -DCMAKE_TOOLCHAIN_FILE="../platforms/linux/${TOOLCHAIN}" -DSOFTFP=ON -DENABLE_PROFILING=OFF \
         -DWITH_OPENCL=OFF -DWITH_TBB=ONĀ  -DWITH_V4L=ON -DHAVE_CAMV4L2=ON -DBUILD_TESTS=OFF \
-        -DINSTALL_PYTHON_EXAMPLES=OFF -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=ON -DHAVE_FFMPEG=ON \
-        -DBUILD_opencv_js=OFF -DENABLE_NEON=OFF -DENABLE_VFPV3=OFF ../
+        -DINSTALL_PYTHON_EXAMPLES=OFF -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF -DHAVE_FFMPEG=OFF \
+        -DBUILD_opencv_js=OFF ../
 
-    make && make install
-
-    cd -
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
 }
 
-compile_opencv
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+
+do_build
 
diff --git a/openlibs/openssl/build.sh b/openlibs/openssl/build.sh
index 9e4ceac..3c4749f 100755
--- a/openlibs/openssl/build.sh
+++ b/openlibs/openssl/build.sh
@@ -1,44 +1,120 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile openssl for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://www.openssl.org/
+LIB_NAME=openssl-1.1.1v
+PACK_SUFIX=tar.gz
 
-PROJ_PATH=`pwd`
-PREFIX_PATH=`pwd`/../install
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/openssl
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
     export AS=${CROSS_COMPILE}as
     export AR=${CROSS_COMPILE}ar
     export LD=${CROSS_COMPILE}ld
@@ -47,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -55,35 +131,52 @@
     export CFLAGS=
 }
 
-function compile_openssl()
+function do_fetch()
 {
-    SRC_NAME=openssl-1.1.1v
-    PACK_SUFIX=tar.gz 
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
 
-    if [ -f ${PREFIX_PATH}/lib/libcrypto.a ] ; then 
-        return 0;
-    fi  
-    
-    msg_banner "Start cross compile $SRC_NAME " 
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then 
-        #wget https://www.openssl.org/source/${SRC_NAME}.${PACK_SUFIX} 
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-        check_result "ERROR: download ${SRC_NAME} failure"
-    fi  
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME} 
-    
-    CROSS_COMPILE=${CROSS_COMPILE} CFLAGS=-I${PROJ_PATH}/cryptodev-linux ./Configure \
-        threads -shared -no-zlib --prefix=$PREFIX_PATH --openssldir=$PREFIX_PATH \
-      enable-devcryptoeng linux-armv4
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    make && make install 
-    check_result "ERROR: compile ${SRC_NAME} failure" 
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
+}
 
-    cd - 
-} 
+function do_build()
+{
+    cd $LIB_NAME
 
-compile_openssl
+    do_export
 
+    ./Configure linux-armv4 \
+        threads -shared -no-zlib --prefix=$PREFIX_PATH --openssldir=$PREFIX_PATH
+    check_result "ERROR: configure ${LIB_NAME} failure"
+
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
 
diff --git a/openlibs/pppd/build.sh b/openlibs/pppd/build.sh
index 18af25b..2b9cd52 100755
--- a/openlibs/pppd/build.sh
+++ b/openlibs/pppd/build.sh
@@ -1,45 +1,120 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile pppd for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://github.com/ppp-project/ppp/tags
+LIB_NAME=ppp-2.5.0
+PACK_SUFIX=tar.gz
 
-PREFIX_PATH=`pwd`/../install/bin
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-SYSROOT=`${CROSS_COMPILE}gcc -print-sysroot`
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/pppd
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
     export AS=${CROSS_COMPILE}as
     export AR=${CROSS_COMPILE}ar
     export LD=${CROSS_COMPILE}ld
@@ -48,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -56,58 +131,63 @@
     export CFLAGS=
 }
 
-function compile_pppd()
+function do_fetch()
 {
-    SRC_NAME=ppp-2.4.7
-    PACK_SUFIX=tar.gz
-
-    if [ -f ${PREFIX_PATH}/pppd ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget https://download.samba.org/pub/ppp/${SRC_NAME}.${PACK_SUFIX}
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    rm -rf ${SRC_NAME}
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    cd ${SRC_NAME}
-    patch -p1 < ../patch/${SRC_NAME}.patch
-
-    sed -i -e "s|.*CC = .*|CC=${CROSS_COMPILE}gcc|g" pppd/Makefile.linux
-    sed -i -e "s|^OPENSSL_INCLUDE_DIR=.*|OPENSSL_INCLUDE_DIR=${SYSROOT}/usr/include/openssl|g" pppd/Makefile.linux
-    sed -i -e "s|.*CC = .*|CC=${CROSS_COMPILE}gcc|g" chat/Makefile.linux
-
-    cd pppd 
-        make CC="${CROSS_COMPILE}gcc -static" -f Makefile.linux && ${CROSS_COMPILE}strip pppd 
-        check_result "ERROR: compile ${SRC_NAME} pppd failure"
-        cp pppd ../../
-    cd -
-
-    cd  chat
-        make CC="${CROSS_COMPILE}gcc -static" -f Makefile.linux && ${CROSS_COMPILE}strip chat
-        check_result "ERROR: compile ${SRC_NAME} chat failure"
-        cp chat ../..
-    cd -
-
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-    cd ..
-
-    cp pppd chat ${PREFIX_PATH} 
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
+function do_build()
+{
+    cd $LIB_NAME
 
-export_cross
+    if [ ! -e configure ] ; then
+        ./autogen.sh
+    fi
 
-compile_pppd
+    do_export
 
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} \
+        --disable-plugins --disable-eaptls --disable-peap \
+        --with-openssl=${PREFIX_PATH}
+
+    check_result "ERROR: configure ${LIB_NAME} failure"
+
+    sed -i -e "/HAVE_CRYPT_H/d" pppd/config.h
+    make -j ${JOBS} CFLAGS="-I ${INC_PATH}" && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+
+    pr_info "${LIB_NAME} installed to '${BIN_PATH}'"
+    install -m 755 pppd/pppd ${BIN_PATH}
+    install -m 755 chat/chat ${BIN_PATH}
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
 
diff --git a/openlibs/sqlite/build.sh b/openlibs/sqlite/build.sh
index ce0682e..a7c2fa5 100755
--- a/openlibs/sqlite/build.sh
+++ b/openlibs/sqlite/build.sh
@@ -1,43 +1,120 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile sqlite for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://www.sqlite.org/download.html
+LIB_NAME=sqlite-autoconf-3420000
+PACK_SUFIX=tar.gz
 
-PREFIX_PATH=`pwd`/../install/
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/sqlite3
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
     export AS=${CROSS_COMPILE}as
     export AR=${CROSS_COMPILE}ar
     export LD=${CROSS_COMPILE}ld
@@ -46,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -54,44 +131,51 @@
     export CFLAGS=
 }
 
-
-function compile_sqlite()
+function do_fetch()
 {
-    SRC_NAME=sqlite-autoconf-3290000
-    PACK_SUFIX=tar.gz
-
-    if [ -f ${PREFIX_PATH}/bin/sqlite3 ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start donwload $SRC_NAME "
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget https://www.sqlite.org/2019/${SRC_NAME}.${PACK_SUFIX}
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static
-
-    check_result "ERROR: configure ${SRC_NAME} failure"
-
-    make && make install
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-
-    ${STRIP} ${PREFIX_PATH}/bin/sqlite3 
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
-export_cross
+function do_build()
+{
+    cd $LIB_NAME
 
-compile_sqlite
+    do_export
 
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static
+    check_result "ERROR: configure ${LIB_NAME} failure"
+
+    make && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
+
+do_fetch
+
+do_build
 
diff --git a/openlibs/stunnel/build.sh b/openlibs/stunnel/build.sh
index 62b6714..85722b8 100755
--- a/openlibs/stunnel/build.sh
+++ b/openlibs/stunnel/build.sh
@@ -1,41 +1,117 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile stunnel for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2018.08.16
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://www.stunnel.org/downloads.html
+LIB_NAME=stunnel-5.70
+PACK_SUFIX=tar.gz
 
-PREFIX_PATH=`pwd`/../install/
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/stunnel
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
     export CXX=${CROSS_COMPILE}g++
@@ -47,7 +123,7 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
+    # export cross configure
     export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
     # Clear LDFLAGS and CFLAGS
@@ -55,57 +131,55 @@
     export CFLAGS=
 }
 
-
-function compile_stunnel()
+function do_fetch()
 {
-    SRC_NAME=stunnel-5.55
-    PACK_SUFIX=tar.gz
-
-    if [ -f ${PREFIX_PATH}/bin/stunnel ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget http://www.usenix.org.uk/mirrors/stunnel/${SRC_NAME}.${PACK_SUFIX}
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    # fix can't load library 'libssp.so.0' bug
-    sed -i -e "s/fstack-protector/pthread/g" configure
-
-    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static --disable-shared --disable-largefile --disable-ipv6 \
-       --disable-systemd --disable-libwrap --with-ssl=${PREFIX_PATH}  CFLAGS="-DHAVE_GETNAMEINFO -UHAVE_DAEMON " 
-    check_result "ERROR: configure ${SRC_NAME} failure"
-
-    sed -i -e "s|^LDFLAGS =.*|LDFLAGS =-static|g" src/Makefile
-    sed -i -e "s|^#define HAVE_DAEMON.*|#undef HAVE_DAEMON|g" src/config.h
-    make
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-    ${STRIP} src/stunnel
-    cp src/stunnel ${PREFIX_PATH}/bin
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
+function do_build()
+{
+    cd $LIB_NAME
 
-if [ ! -f ${PREFIX_PATH}/lib/libcrypto.so ] ; then
-    cd ../openssl
-    ./build.sh
-    cd -
+    do_export
+
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
+        --disable-shared --disable-largefile --disable-ipv6 \
+        --disable-systemd --disable-libwrap --with-ssl=${PREFIX_PATH}
+    check_result "ERROR: configure ${LIB_NAME} failure"
+
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
+}
+
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
+
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
 fi
 
+cd ../openssl && ./build.sh && cd -
 
-export_cross
+do_fetch
 
-compile_stunnel
-
+do_build
 
diff --git a/openlibs/valgrind/build.sh b/openlibs/valgrind/build.sh
index 5de8049..db998ea 100755
--- a/openlibs/valgrind/build.sh
+++ b/openlibs/valgrind/build.sh
@@ -1,51 +1,117 @@
 #!/bin/bash
 
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile valgrind for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2018.08.16
-#| 
-#|  Running bugfix:
-#|    root@JelliesV2:/tmp# tar -xJf valgrind_a5.tar.xz -C /apps/
-#|    root@JelliesV2:/tmp# export PATH=$PATH:/apps/valgrind/
-#|    root@JelliesV2:/tmp# valgrind 
-#|        valgrind: failed to start tool 'memcheck' for platform 'arm-linux': No such file or directory
-#|    root@JelliesV2:/tmp# export VALGRIND_LIB=/apps/valgrind/
-#|    root@JelliesV2:/tmp# valgrind --tool=memcheck --leak-check=full --track-fds=yes ./memcheck
-#|    
-#+--------------------------------------------------------------------------------------------
+# library name and version
+# Official: https://valgrind.org/downloads/
+LIB_NAME=valgrind-3.21.0
+PACK_SUFIX=tar.bz2
 
-# valgrind install path be same as board 
-PREFIX_PATH=`pwd`/../install/
-
+# LingYun source code FTP server
 LYFTP_SRC=http://master.weike-iot.com:2211/src/
 
+# library download URL address
+LIB_URL=$LYFTP_SRC
+
+# Cross compiler for cross compile on Linux server
 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
 
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
+# compile jobs
+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
+
+# this project absolute path
+PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+
+# top project absolute path
+TOP_PATH=$(realpath $PRJ_PATH/..)
+
+# binaries install path
+PREFIX_PATH=$TOP_PATH/install
+BIN_PATH=$PREFIX_PATH/bin
+LIB_PATH=$PREFIX_PATH/lib
+INC_PATH=$PREFIX_PATH/include
+
+# check installed or not file
+INST_FILE=$PREFIX_PATH/bin/valgrind
+
+# shell script will exit once get command error
+set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
     if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
+        pr_error "$1"
     fi
 }
-
-function export_cross()
+# decompress a packet to destination path
+function do_unpack()
 {
+    tarball=$1
+    dstpath=`pwd`
+
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
+
+    pr_info "decompress $tarball => $dstpath"
+
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
+
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
+
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
+
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
+
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
+
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
+
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
+}
+
+function do_export()
+{
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
+        return ;
+    fi
+
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+
     # export cross toolchain
     export CC=${CROSS_COMPILE}gcc
     export CXX=${CROSS_COMPILE}g++
@@ -57,70 +123,60 @@
     export OBJDUMP=${CROSS_COMPILE}objdump
     export STRIP=${CROSS_COMPILE}strip
 
-    # export cross configure 
-    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=armv7-linux "
 
     # Clear LDFLAGS and CFLAGS
     export LDFLAGS=
     export CFLAGS=
 }
 
-
-function compile_valgrind()
+function do_fetch()
 {
-    SRC_NAME=valgrind-3.16.1
-    PACK_SUFIX=tar.bz2
-
-    if [ -f ${PREFIX_PATH}/bin/valgrind ] ; then
-        msg_banner "$SRC_NAME already compile and installed"
-        return 0;
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
     fi
 
-    msg_banner "Start cross compile $SRC_NAME "
-
-    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        #wget https://sourceware.org/pub/valgrind/valgrind-3.16.1.tar.bz2
-        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
-
-        check_result "ERROR: download ${SRC_NAME} failure"
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
     fi
 
-    tar -xjf ${SRC_NAME}.${PACK_SUFIX}
-    cd ${SRC_NAME}
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-    sed -i -e "s|armv7|arm|g" configure
-
-    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-only32bit
-    check_result "ERROR: configure ${SRC_NAME} failure"
-
-    make && make install
-    check_result "ERROR: compile ${SRC_NAME} failure"
-
-
-    cd -
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
-function do_pack()
+function do_build()
 {
-    cp -af ${PREFIX_PATH}/lib/valgrind . -af
-    cp -af ${PREFIX_PATH}/bin/valgrind valgrind
+    cd $LIB_NAME
 
-    rm -f valgrind/64bit*
-    rm -f valgrind/amd64*
-    rm -f valgrind/mips64*
-    rm -f valgrind/i386*
-    rm -f valgrind/mips*
-    rm -f valgrind/power*
-    rm -f valgrind/s390*
-    rm -f valgrind/*.a
+    do_export
 
-    tar -cJf valgrind_a5.tar.xz valgrind
-    rm -rf valgrind
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} \
+        --enable-only32bit --disable-tls
+    check_result "ERROR: configure ${LIB_NAME} failure"
+
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
 }
 
-export_cross
+function do_clean()
+{
+    rm -rf *${LIB_NAME}*
+}
 
-compile_valgrind
+if [[ $# == 1 && $1 == -c ]] ;then
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
+fi
 
-do_pack
+do_fetch
+
+do_build
 

--
Gitblit v1.9.1