| New file | 
 |  |  | 
 |  |  | #!/bin/bash | 
 |  |  | # This shell script used to setup imx6ull build envrionment | 
 |  |  | # | 
 |  |  |  | 
 |  |  | LYFTP_PUB=http://weike-iot.com:2211/imx6ull/tools/lintools | 
 |  |  |  | 
 |  |  | if [ `id -u` != 0 ] ; then | 
 |  |  |     echo "" | 
 |  |  |     echo "ERROR: This shell script must be excuted as root privilege." | 
 |  |  |     echo "" | 
 |  |  |     exit 0; | 
 |  |  | fi | 
 |  |  |  | 
 |  |  | function msg_banner() | 
 |  |  | { | 
 |  |  |     echo ""  | 
 |  |  |     echo "+-----------------------------------------------------------------------"  | 
 |  |  |     echo "|  $1 "  | 
 |  |  |     echo "+-----------------------------------------------------------------------"  | 
 |  |  |     echo "" | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function prepare_instpath() | 
 |  |  | { | 
 |  |  |     if [ -w /apps -a -w /opt ] ; then | 
 |  |  |         msg_banner "Install path [/apps and /opt] already setup, skip it" | 
 |  |  |         return ; | 
 |  |  |     fi | 
 |  |  |  | 
 |  |  |     msg_banner "/apps and /opt not writable, use chmod to give writable permissions" | 
 |  |  |  | 
 |  |  |     #QT build will installed to this path | 
 |  |  |     mkdir -p /apps && chmod 777 /apps | 
 |  |  |  | 
 |  |  |     #crosstool will installed to this path | 
 |  |  |     chmod 777 /opt/ | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function install_systools() | 
 |  |  | { | 
 |  |  |     arm-linux-gnueabihf-gcc -V > /dev/null 2>&1 | 
 |  |  |     if [ $? == 0 ] ;  then | 
 |  |  |         msg_banner "All development system tools already installed, skip it" | 
 |  |  |         return 0; | 
 |  |  |     fi | 
 |  |  |  | 
 |  |  |     msg_banner "start apt-get install system devlopment tools(commands)"  | 
 |  |  |  | 
 |  |  |     systools="gawk wget git diffstat unzip texinfo build-essential chrpath socat libncurses-dev \ | 
 |  |  |         libsdl1.2-dev xterm sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 tree \ | 
 |  |  |         help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf \ | 
 |  |  |         automake groff curl lzop asciidoc lib32z1 lib32ncurses5-dev libssl-dev autoconf-archive bison flex lzop" | 
 |  |  |  | 
 |  |  |     devtools="u-boot-tools mtd-utils device-tree-compiler gcc-9-arm-linux-gnueabihf " | 
 |  |  |  | 
 |  |  |     apt-get update > /dev/null 2>&1 | 
 |  |  |     apt-get install -y $systools $devtools | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function install_buildroot() | 
 |  |  | { | 
 |  |  |     BUILDROOT_PATH=/opt/buildroot | 
 |  |  |     BUILDROOT_NAME=cortex-a7 | 
 |  |  |  | 
 |  |  |     BUILDROOT_VER=buildroot-2021.02.5-gcc9.4.0-cortexA7-x86_64_arm-linux-gnueabihf | 
 |  |  |     BUILDROOT_TAR=${BUILDROOT_VER}.tar.xz | 
 |  |  |     BUILDROOT_DLADDR=${LYFTP_PUB}/$BUILDROOT_TAR | 
 |  |  |  | 
 |  |  |     if [ -d ${BUILDROOT_PATH}/${BUILDROOT_NAME} ] ; then | 
 |  |  |         msg_banner "$BUILDROOT_VER already installed to $BUILDROOT_PATH/$BUILDROOT_NAME" | 
 |  |  |         return 0; | 
 |  |  |     fi | 
 |  |  |  | 
 |  |  |     mkdir -p ${BUILDROOT_PATH}  | 
 |  |  |  | 
 |  |  |     if [ ! -f $BUILDROOT_TAR ] ; then  | 
 |  |  |         msg_banner "download $BUILDROOT_VER now..." | 
 |  |  |         wget -c $BUILDROOT_DLADDR  | 
 |  |  |     fi  | 
 |  |  |  | 
 |  |  |     msg_banner "install $BUILDROOT_VER to $BUILDROOT_PATH/$BUILDROOT_NAME now..." | 
 |  |  |     tar -xJf ${BUILDROOT_TAR} -C ${BUILDROOT_PATH}  -C  ${BUILDROOT_PATH} | 
 |  |  |  | 
 |  |  |     $BUILDROOT_PATH/$BUILDROOT_NAME/bin/arm-linux-gcc -v | 
 |  |  |  | 
 |  |  |     msg_banner "Cross compiler: $BUILDROOT_PATH/$BUILDROOT_NAME/bin/arm-linux-" | 
 |  |  |  | 
 |  |  |     rm -f ${BUILDROOT_TAR} | 
 |  |  | } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | prepare_instpath | 
 |  |  |  | 
 |  |  | install_systools | 
 |  |  |  | 
 |  |  | install_buildroot | 
 |  |  |  |