From 328883219b417fc2f03281f58d41cb0a444e44e2 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 30 Mar 2023 23:43:01 +0800
Subject: [PATCH] update yocto build.sh to yocto package
---
tools/setup_tools.sh | 117 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 72 insertions(+), 45 deletions(-)
diff --git a/tools/setup_tools.sh b/tools/setup_tools.sh
index 5d89a83..02cb804 100755
--- a/tools/setup_tools.sh
+++ b/tools/setup_tools.sh
@@ -2,73 +2,68 @@
# This shell script used to setup imx6ull build envrionment
#
-LYFTP_PUB=http://weike-iot.com:2211/imx6ull/tools/lintools
+LYFTP_PUB=http://wekei-iot.com:2211/imx/igkboard/tools/lintools
+
+# display in yellow
+function pr_warn() {
+ echo -e "\033[40;33m --W-- $1 \033[0m\n"
+}
+
+# display in green
+function pr_info() {
+ echo -e "\033[40;32m --I-- $1 \033[0m\n"
+}
if [ `id -u` != 0 ] ; then
- echo ""
- echo "ERROR: This shell script must be excuted as root privilege."
- echo ""
- exit 0;
+ pr_warn "This shell script must be excuted as root privilege"
+ exit;
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"
+ pr_warn "Install path [/apps and /opt] already setup, skip it"
return ;
fi
- msg_banner "/apps and /opt not writable, use chmod to give writable permissions"
+ pr_info "/apps and /opt not writable, use chmod to give writable permissions"
- #QT build will installed to this path
+ # QT build will installed to this path
mkdir -p /apps && chmod 777 /apps
- #TFTP server path
- mkdir -p /tftp && chmod 777 /tftp
-
- #crosstool will installed to this path
+ # buildroot crosstool will installed to this path
chmod 777 /opt/
}
function install_systools()
{
- jq --version > /dev/null 2>&1
- if [ $? == 0 ] ; then
- msg_banner "All system tools already installed, skip it"
+ if command -v jq > /dev/null 2>&1 ; then
+ pr_warn "All system tools already installed, skip it"
return 0;
fi
- msg_banner "start apt install system tools(commands)"
+ pr_warn "start apt install system tools(commands)"
- systools="gawk wget git diffstat unzip texinfo build-essential chrpath socat libncurses-dev flex \
- 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 lib32ncurses-dev libssl-dev autoconf-archive bison \
- kpartx jq binfmt-support qemu qemu-user-static debootstrap debian-archive-keyring "
-
+ systools="coreutils jq wget curl tree gawk sed unzip cpio lz4 lzop zstd rsync kmod kpartx tmux \
+ desktop-file-utils iputils-ping xterm diffstat chrpath asciidoc docbook-utils help2man \
+ build-essential gcc g++ make cmake automake groff socat flex texinfo bison texi2html \
+ git cvs subversion mercurial autoconf autoconf-archive \
+ python2 python3 python3-pip python3-pexpect python3-git python3-jinja2 libsdl1.2-dev \
+ lib32z1 libssl-dev libncurses-dev lib32ncurses-dev libgl1-mesa-dev libglu1-mesa-dev \
+ "
apt update > /dev/null 2>&1
apt install -y $systools
}
-function install_crosstool()
+function install_devtools()
{
- arm-linux-gnueabihf-gcc -v > /dev/null 2>&1
- if [ $? == 0 ] ; then
- msg_banner "All development tools already installed, skip it"
+ if command -v arm-linux-gnueabihf-gcc > /dev/null 2>&1 ; then
+ pr_warn "All development tools already installed, skip it"
return 0;
fi
- msg_banner "start apt install devlopment tools(commands)"
+ pr_info "start apt install devlopment tools(commands)"
devtools="u-boot-tools mtd-utils device-tree-compiler gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
binfmt-support qemu qemu-user-static debootstrap debian-archive-keyring "
@@ -88,33 +83,65 @@
BUILDROOT_DLADDR=${LYFTP_PUB}/$BUILDROOT_TAR
if [ -d ${BUILDROOT_PATH}/${BUILDROOT_NAME} ] ; then
- msg_banner "Buildroot already installed to $BUILDROOT_PATH/$BUILDROOT_NAME"
+ pr_warn "Buildroot already installed to $BUILDROOT_PATH/$BUILDROOT_NAME"
return 0;
fi
- mkdir -p ${BUILDROOT_PATH}
+ mkdir -p ${BUILDROOT_PATH}
- if [ ! -f $BUILDROOT_TAR ] ; then
- msg_banner "download $BUILDROOT_VER now..."
- wget -c $BUILDROOT_DLADDR
- fi
+ if [ ! -f $BUILDROOT_TAR ] ; then
+ pr_info "download $BUILDROOT_VER now..."
+ wget -c $BUILDROOT_DLADDR
+ fi
- msg_banner "install $BUILDROOT_VER to $BUILDROOT_PATH/$BUILDROOT_NAME now..."
+ pr_info "install $BUILDROOT_VER to $BUILDROOT_PATH/$BUILDROOT_NAME now..."
tar -xjf ${BUILDROOT_TAR} -C ${BUILDROOT_PATH}
$BUILDROOT_PATH/$BUILDROOT_NAME/bin/arm-linux-gcc -v
- msg_banner "Cross compiler: $BUILDROOT_PATH/$BUILDROOT_NAME/bin/arm-linux-"
+ pr_info "Cross compiler: $BUILDROOT_PATH/$BUILDROOT_NAME/bin/arm-linux-"
rm -f ${BUILDROOT_TAR}
}
+# NXP document suggest cross compiler from ARM Developer:
+# https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
+function install_crosstool()
+{
+ ARMTOOL_VER=10.3-2021.07
+ ARMTOOL_NAME=gcc-arm-$ARMTOOL_VER
+ ARMTOOL_PACK=${ARMTOOL_NAME}-`uname -p`-arm-none-linux-gnueabihf
+ ARMTOOL_URL=https://developer.arm.com/-/media/Files/downloads/gnu-a/$ARMTOOL_VER/binrel/
+
+ if [ -d /opt/$ARMTOOL_NAME ] ; then
+ pr_info "$ARMTOOL_NAME crosstool already installed, skip it"
+ return 0;
+ fi
+
+ pr_info "start download cross compiler from ARM Developer"
+
+ if [ ! -s $ARMTOOL_PACK.tar.xz ] ; then
+ wget $ARMTOOL_URL/$ARMTOOL_PACK.tar.xz
+ fi
+
+ tar -xJf $ARMTOOL_PACK.tar.xz -C /opt
+ rm -f $ARMTOOL_PACK.tar.xz
+
+ mv /opt/$ARMTOOL_PACK /opt/$ARMTOOL_NAME
+
+ /opt/$ARMTOOL_NAME/bin/arm-none-linux-gnueabihf-gcc -v
+ pr_info "cross compiler installed to \"/opt/$ARMTOOL_NAME\" successfully"
+}
+
+echo ""
prepare_instpath
install_systools
+install_devtools
+
install_crosstool
-install_buildroot
+#install_buildroot
--
Gitblit v1.9.1