From 588586f0f3086ee157ad78843b16339bdbdfa7f1 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 25 Nov 2021 23:47:44 +0800
Subject: [PATCH] update top build shell script
---
bsp/images/build.sh | 2
bsp/tarball/build.sh | 2
bsp/build.sh | 94 +++++++++++++++++++++++++++++++++++++++++-----
3 files changed, 85 insertions(+), 13 deletions(-)
diff --git a/bsp/build.sh b/bsp/build.sh
index 461e261..0ad0a30 100755
--- a/bsp/build.sh
+++ b/bsp/build.sh
@@ -11,8 +11,8 @@
TAR_PATH=${PRJ_PATH}/tarball
BSP_BRANCH="lf-5.10.52-2.1.0"
-# rootfs should be buildroot or stretch/buster/bullseye for debian system
-ROOTFS=buildroot
+# rootfs should be buildroot/yocto or stretch/buster/bullseye for debian system
+ROOTFS=buster
set -u
set -e
@@ -42,18 +42,90 @@
do_modify_build images
}
-function do_build()
+function do_root()
{
- cd $PRJ_PATH/tarball && ./build.sh && cd -
-
- cd $PRJ_PATH/bootloader && ./build.sh && cd -
-
- cd $PRJ_PATH/kernel && ./build.sh && cd -
-
- cd $PRJ_PATH/rootfs && ./build.sh && cd -
+ echo ""
+ if [[ $1 == "yes" ]] && [ `id -u` != 0 ] ; then
+ echo "ERROR: This action must run as root!"
+ echo ""
+ exit;
+ elif [[ $1 != "yes" ]] && [ `id -u` == 0 ] ; then
+ echo "ERROR: This action cannot run as root!"
+ echo ""
+ exit;
+ fi
}
+
+function do_action()
+{
+ folder=$1
+ action=$2
+
+ cd $PRJ_PATH/$folder
+
+ if [ $action == "build" ] ; then
+ ./build.sh -b
+ elif [ $action == "clean" ] ; then
+ ./build.sh -c
+ fi
+
+ cd $PRJ_PATH
+}
+
+
+function do_usage()
+{
+ echo ""
+ echo "Usage:"
+ echo " $0 [-b] [-c] [-h] bsp/image"
+ echo " -b bsp/image: build BSP or system image"
+ echo " -c bsp/image: clean BSP or system image"
+ echo " -h : show this help message"
+ echo ""
+ echo " WARNNING: build/clean image need run as sudo"
+ echo ""
+ echo " Example: $0 -b bsp && sudo $0 -b image"
+ echo ""
+ exit;
+}
+
+
+action="usage"
+
+while getopts "b:c:h" OPTNAME
+do
+ case "${OPTNAME}" in
+ "b")
+ action="build"
+ shift
+ ;;
+
+ "c")
+ action="clean"
+ shift
+ ;;
+
+ "*")
+ action="usage"
+ ;;
+ esac
+done
+
+if [ $action == "usage" ] ; then
+ do_usage
+fi
do_modify
-do_build
+if [ $1 == "bsp" ] ; then
+ if [ $action == "build" ] ; then
+ do_root "no"
+ fi
+ do_action bootloader $action
+ do_action kernel $action
+elif [ $1 == "image" ] ; then
+ do_root "yes"
+ do_action rootfs $action
+ do_action images $action
+fi
diff --git a/bsp/images/build.sh b/bsp/images/build.sh
index b66b133..fa49f9d 100755
--- a/bsp/images/build.sh
+++ b/bsp/images/build.sh
@@ -25,7 +25,7 @@
BOARD=imx6ull
# rootfs should be buildroot or stretch/buster/bullseye for debian system
-ROOTFS=buildroot
+ROOTFS=buster
# linux kernel tarball path and branch
TAR_PATH=${PRJ_PATH}/../tarball
diff --git a/bsp/tarball/build.sh b/bsp/tarball/build.sh
index c4dc130..ff1d933 100755
--- a/bsp/tarball/build.sh
+++ b/bsp/tarball/build.sh
@@ -8,7 +8,7 @@
IMX_BRANCH="lf-5.10.52-2.1.0"
# rootfs should be buildroot or stretch/buster/bullseye for debian system
-ROOTFS=buildroot
+ROOTFS=buster
function do_fetch_git()
{
--
Gitblit v1.9.1