From 51b937ab315cf87541fdef72d6893a3d96a210a1 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Wed, 15 Dec 2021 22:49:31 +0800 Subject: [PATCH] remove stretch support in rootfs --- bsp/build.sh | 123 ++++++++++++++++++++++++++++++++-------- 1 files changed, 98 insertions(+), 25 deletions(-) diff --git a/bsp/build.sh b/bsp/build.sh index 8bd0c76..76e1789 100755 --- a/bsp/build.sh +++ b/bsp/build.sh @@ -7,11 +7,11 @@ #CROSS_TOOL=arm-linux-gnueabihf- CROSS_TOOL=/opt/buildroot/cortexA7/bin/arm-linux- -# bootloader, linux kernel tarball path and branch +# bootloader, linux kernel tarball path and branch 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 should be buildroot/yocto or buster/bullseye for debian system ROOTFS=buildroot set -u @@ -21,41 +21,114 @@ { DIR=$1 - sed -i "s|^BOARD.*|BOARD=${BOARD}|g" ${DIR}/build.sh + cd $PRJ_PATH - if [ $DIR = bootloader -o $DIR == kernel ] ; then - sed -i "s|^CROSS_TOOL.*|CROSS_TOOL=${CROSS_TOOL}|g" ${DIR}/build.sh - sed -i "s|^TAR_PATH.*|TAR_PATH=${TAR_PATH}|g" ${DIR}/build.sh + sed -i "s|^BOARD.*|BOARD=${BOARD}|g" ${DIR}/build.sh + + if [ $DIR = bootloader -o $DIR == kernel ] ; then + sed -i "s|^CROSS_TOOL.*|CROSS_TOOL=${CROSS_TOOL}|g" ${DIR}/build.sh sed -i "s|^BSP_BRANCH.*|BSP_BRANCH=${BSP_BRANCH}|g" ${DIR}/build.sh - elif [ $DIR = rootfs -o $DIR == images ] ; then - sed -i "s|^TAR_PATH.*|TAR_PATH=${TAR_PATH}|g" ${DIR}/build.sh - sed -i "s|^ROOTFS=.*|ROOTFS=${ROOTFS}|g" ${DIR}/build.sh - elif [ $DIR = tarball ] ; then - sed -i "s|^ROOTFS=.*|ROOTFS=${ROOTFS}|g" ${DIR}/build.sh + elif [ $DIR = rootfs -o $DIR == images -o $DIR = tarball ] ; then + sed -i "s|^ROOTFS=.*|ROOTFS=${ROOTFS}|g" ${DIR}/build.sh fi } function do_modify() -{ +{ do_modify_build tarball - do_modify_build bootloader - do_modify_build kernel - do_modify_build rootfs + do_modify_build bootloader + do_modify_build kernel + do_modify_build rootfs do_modify_build images } -function do_build() +function do_root() { - cd tarball && ./build.sh && cd - - - cd bootloader && ./build.sh && cd - - - cd kernel && ./build.sh && cd - - - cd 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 } -do_modify +function do_action() +{ + folder=$1 + action=$2 -do_build + 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 + +if [ $action == "build" ] ; then + do_modify + cd tarball && ./build.sh && cd - +fi + +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 -- Gitblit v1.9.1