From bfceb172fbac401c760473a4ee7c159940253d9b Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Fri, 26 Nov 2021 21:43:31 +0800 Subject: [PATCH] remove space in the end of a line --- bsp/images/win_flash.bat | 4 bsp/images/build.sh | 32 ++++---- bsp/bootloader/build.sh | 20 ++-- bsp/kernel/build.sh | 34 ++++---- bsp/tarball/build.sh | 22 ++-- bsp/rootfs/build.sh | 88 +++++++++++----------- bsp/build.sh | 12 +- 7 files changed, 106 insertions(+), 106 deletions(-) diff --git a/bsp/bootloader/build.sh b/bsp/bootloader/build.sh index 450ee70..579dc9a 100755 --- a/bsp/bootloader/build.sh +++ b/bsp/bootloader/build.sh @@ -4,9 +4,9 @@ PRJ_NAME=`basename ${PRJ_PATH}` IMG_PATH=${PRJ_PATH}/../images/ - + BOARD=imx6ull - + CROSS_TOOL=/opt/buildroot/cortexA7/bin/arm-linux- # bootloader tarball path and branch @@ -32,12 +32,12 @@ STAGE=0 function msg_banner() -{ +{ STAGE=`expr $STAGE + 1` echo "" - echo "+---------------------------------------------+" - printf " Stage $STAGE: $1\n" + echo "+---------------------------------------------+" + printf " Stage $STAGE: $1\n" echo "+---------------------------------------------+" echo "" } @@ -45,7 +45,7 @@ function do_fetch() { msg_banner "Fetch ${UBOOT_SRC} source code" - if [ -d ${UBOOT_SRC} ] ; then + if [ -d ${UBOOT_SRC} ] ; then printf "\n\n -- ${UBOOT_SRC} fetched already -- \n\n" return 0; fi @@ -69,14 +69,14 @@ cd ${PRJ_PATH} } - + function do_build() { msg_banner "Build for ${UBOOT_SRC} source code" cd ${UBOOT_SRC} - if [ ! -f .config ] ; then + if [ ! -f .config ] ; then cp $CONF_FILE .config fi @@ -114,10 +114,10 @@ } function gen_patch() -{ +{ do_clean - mv ${UBOOT_SRC} ${UBOOT_SRC}-${BOARD} + mv ${UBOOT_SRC} ${UBOOT_SRC}-${BOARD} do_fetch diff --git a/bsp/build.sh b/bsp/build.sh index e16073d..4e9073a 100755 --- a/bsp/build.sh +++ b/bsp/build.sh @@ -7,7 +7,7 @@ #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" @@ -34,11 +34,11 @@ } function do_modify() -{ +{ do_modify_build tarball do_modify_build bootloader do_modify_build kernel - do_modify_build rootfs + do_modify_build rootfs do_modify_build images } @@ -58,7 +58,7 @@ function do_action() { - folder=$1 + folder=$1 action=$2 cd $PRJ_PATH/$folder @@ -67,7 +67,7 @@ ./build.sh -b elif [ $action == "clean" ] ; then ./build.sh -c - fi + fi cd $PRJ_PATH } @@ -115,7 +115,7 @@ do_usage fi -if [ $action == "build" ] ; then +if [ $action == "build" ] ; then do_modify cd tarball && ./build.sh && cd - fi diff --git a/bsp/images/build.sh b/bsp/images/build.sh index fa49f9d..e8b2a0a 100755 --- a/bsp/images/build.sh +++ b/bsp/images/build.sh @@ -176,16 +176,16 @@ } function do_image() -{ - mkdir -p ${MNT_POINT} +{ + mkdir -p ${MNT_POINT} - generate_image + generate_image - format_partition + format_partition - install_sysimg + install_sysimg - install_rootfs + install_rootfs msg_banner " bzip2 compress system image " bzip2 ${IMAGE_NAME} @@ -199,15 +199,15 @@ function do_root() { echo "" - if [[ $1 == "yes" ]] && [ `id -u` != 0 ] ; then + if [[ $1 == "yes" ]] && [ `id -u` != 0 ] ; then echo "ERROR: This action must run as root!" echo "" exit; - elif [[ $1 != "yes" ]] && [ `id -u` == 0 ] ; then + elif [[ $1 != "yes" ]] && [ `id -u` == 0 ] ; then echo "ERROR: This action cannot run as root!" echo "" exit; - fi + fi } function do_usage() @@ -228,22 +228,22 @@ while getopts "bch" OPTNAME do - case "${OPTNAME}" in - "b") + case "${OPTNAME}" in + "b") break; - ;; + ;; - "c") + "c") do_root "yes" do_distclean - ;; + ;; "*") do_usage - ;; + ;; esac done -do_root "yes" +do_root "yes" do_image diff --git a/bsp/images/win_flash.bat b/bsp/images/win_flash.bat index b03e06a..68ce0ae 100644 --- a/bsp/images/win_flash.bat +++ b/bsp/images/win_flash.bat @@ -17,9 +17,9 @@ echo "Image Download Choices:" echo 1: Download bootloader [ %IMAGE_UBOOT% ] -echo 2: Download System Image [ %IMAGE_SYS% ] +echo 2: Download System Image [ %IMAGE_SYS% ] -set /p choice= Please Input Your Choice: +set /p choice= Please Input Your Choice: if %choice% == 1 uuu -b emmc %IMAGE_UBOOT% if %choice% == 2 uuu -b emmc_all %IMAGE_UBOOT% %IMAGE_SYS% diff --git a/bsp/kernel/build.sh b/bsp/kernel/build.sh index a4c5888..34486f0 100755 --- a/bsp/kernel/build.sh +++ b/bsp/kernel/build.sh @@ -5,9 +5,9 @@ PRJ_PATH=`pwd` IMG_PATH=${PRJ_PATH}/../images/boot - + BOARD=imx6ull - + CROSS_TOOL=/opt/buildroot/cortexA7/bin/arm-linux- # linux kernel tarball path and branch @@ -30,12 +30,12 @@ STAGE=0 function msg_banner() -{ +{ STAGE=`expr $STAGE + 1` echo "" - echo "+---------------------------------------------+" - printf " Stage $STAGE: $1\n" + echo "+---------------------------------------------+" + printf " Stage $STAGE: $1\n" echo "+---------------------------------------------+" echo "" } @@ -43,7 +43,7 @@ function do_fetch() { msg_banner "Fetch ${LINUX_SRC} source code" - if [ -d ${LINUX_SRC} ] ; then + if [ -d ${LINUX_SRC} ] ; then printf "\n\n -- ${LINUX_SRC} fetched already -- \n\n" return 0; fi @@ -67,14 +67,14 @@ cd ${PRJ_PATH} } - + function do_build() { msg_banner "Build for ${LINUX_SRC} source code" cd ${LINUX_SRC} - if [ ! -f .config ] ; then + if [ ! -f .config ] ; then cp $CONF_FILE .config fi @@ -114,7 +114,7 @@ cd ${LINUX_SRC} - if [ -f .config ] ; then + if [ -f .config ] ; then cp .config $CONF_FILE fi @@ -124,10 +124,10 @@ } function gen_patch() -{ +{ do_clean - mv ${LINUX_SRC} ${LINUX_SRC}-${BOARD} + mv ${LINUX_SRC} ${LINUX_SRC}-${BOARD} do_fetch @@ -177,12 +177,12 @@ esac done -# Default do build action +# Default do build action -do_fetch -do_patch -do_build -do_install +do_fetch +do_patch +do_build +do_install exit; - + diff --git a/bsp/rootfs/build.sh b/bsp/rootfs/build.sh index ef8ec8a..c692d4c 100755 --- a/bsp/rootfs/build.sh +++ b/bsp/rootfs/build.sh @@ -36,12 +36,12 @@ STAGE=0 function msg_banner() -{ +{ STAGE=`expr $STAGE + 1` - + echo "" - echo "+---------------------------------------------+" - printf " Stage $STAGE: $1\n" + echo "+---------------------------------------------+" + printf " Stage $STAGE: $1\n" echo "+---------------------------------------------+" echo "" } @@ -50,12 +50,12 @@ { if [ -d ${ROOTFS_DIR} ] ; then printf "\n\n -- ${ROOTFS_DIR} fetched already, skip it -- \n\n" - return; + return; fi - if [ -s ${TAR_PATH}/${ROOTFS_DIR}.tar.bz2 ] ; then - printf "\n\n -- decompress ${ROOTFS_DIR}.tar.bz2 -- \n\n" - mkdir -p ${ROOTFS_DIR} + if [ -s ${TAR_PATH}/${ROOTFS_DIR}.tar.bz2 ] ; then + printf "\n\n -- decompress ${ROOTFS_DIR}.tar.bz2 -- \n\n" + mkdir -p ${ROOTFS_DIR} tar -xjf ${TAR_PATH}/${ROOTFS_DIR}.tar.bz2 -C ${ROOTFS_DIR} fi @@ -71,9 +71,9 @@ # try to decompress packet first. do_unpack - if [ $ROOTFS == "buildroot" -o $ROOTFS == "yocto" ] ; then - if [ ! -d ${ROOTFS_DIR} ] ; then - echo " ERROR: miss rootfs ${ROOTFS}, exit now. " + if [ $ROOTFS == "buildroot" -o $ROOTFS == "yocto" ] ; then + if [ ! -d ${ROOTFS_DIR} ] ; then + echo " ERROR: miss rootfs ${ROOTFS}, exit now. " echo "" exit; else @@ -85,27 +85,27 @@ export DEBCONF_NONINTERACTIVE_SEEN=true export LC_ALL=C export LANGUAGE=C - export LANG=C + export LANG=C - printf "\n\n -- debootstrap fetch start --\n\n" + printf "\n\n -- debootstrap fetch start --\n\n" debootstrap --arch=${ARCH} --foreign ${ROOTFS} ${ROOTFS_DIR} http://ftp.cn.debian.org/debian/ - chroot ${ROOTFS_DIR} debootstrap/debootstrap --second-stage - printf "\n\n -- debootstrap config start --\n\n" + chroot ${ROOTFS_DIR} debootstrap/debootstrap --second-stage + printf "\n\n -- debootstrap config start --\n\n" - chroot ${ROOTFS_DIR} dpkg --configure -a - printf "\n\n -- debootstrap fetch done -- \n\n" + chroot ${ROOTFS_DIR} dpkg --configure -a + printf "\n\n -- debootstrap fetch done -- \n\n" # set root password - chroot ${ROOTFS_DIR} sh -c "echo root:${DEF_PASSWD} | chpasswd" + chroot ${ROOTFS_DIR} sh -c "echo root:${DEF_PASSWD} | chpasswd" # add extra user account chroot ${ROOTFS_DIR} sh -c "useradd -m -G sudo -s /bin/bash ${DEF_USER}" chroot ${ROOTFS_DIR} sh -c "echo ${DEF_USER}:${DEF_PASSWD} | chpasswd" chroot ${ROOTFS_DIR} sh -c "usermod -G video,audio ${DEF_USER}" - # Clear the MD5 value to install extra apps - sed -i -e "s|.*md5val.*|\t\"md5val\":\"MD5_Auto_Generate_Here\"|g" $APT_CONF + # Clear the MD5 value to install extra apps + sed -i -e "s|.*md5val.*|\t\"md5val\":\"MD5_Auto_Generate_Here\"|g" $APT_CONF } # Install extra apps defined in extra_apps.conf @@ -115,28 +115,28 @@ export DEBCONF_NONINTERACTIVE_SEEN=true export LC_ALL=C export LANGUAGE=C - export LANG=C + export LANG=C msg_banner " debootstrap apt install " - if [ -f $APT_CONF ] ; then + if [ -f $APT_CONF ] ; then extra_apps=$(eval jq -r .extra_apps[] $APT_CONF ) md5_file=$(eval jq -r .md5val extra_apps.json) md5_calc=$(eval echo $extra_apps | md5sum | awk '{print $1}') - if [ $md5_file == $md5_calc ] ; then + if [ $md5_file == $md5_calc ] ; then printf "\n\n -- debootstrap apt install already, skip it! --\n\n" else printf "\n\n -- debootstrap apt install start --\n\n" - cp -f /usr/bin/qemu-arm-static ${ROOTFS_DIR}/usr/bin/ - mount -o bind /proc ${ROOTFS_DIR}/proc - mount -o bind /dev ${ROOTFS_DIR}/dev - mount -o bind /dev/pts ${ROOTFS_DIR}/dev/pts + cp -f /usr/bin/qemu-arm-static ${ROOTFS_DIR}/usr/bin/ + mount -o bind /proc ${ROOTFS_DIR}/proc + mount -o bind /dev ${ROOTFS_DIR}/dev + mount -o bind /dev/pts ${ROOTFS_DIR}/dev/pts mount -o bind /sys ${ROOTFS_DIR}/sys - chroot ${ROOTFS_DIR} apt update + chroot ${ROOTFS_DIR} apt update chroot ${ROOTFS_DIR} apt install -y ${extra_apps} umount ${ROOTFS_DIR}/{sys,proc,dev/pts,dev} @@ -151,7 +151,7 @@ { if [ ! -d ${DRV_PATH}/lib/modules ] ; then return ; - fi + fi msg_banner " install kernel modules" @@ -222,32 +222,32 @@ function do_rootfs() { - do_fetch + do_fetch echo "do rootfs continue " # debian rootfs need apt install packet - if [ $ROOTFS != "buildroot" -a $ROOTFS != "yocto" ] ;then - do_apt + if [ $ROOTFS != "buildroot" -a $ROOTFS != "yocto" ] ;then + do_apt fi - do_modules - do_modify + do_modules + do_modify do_pack } function do_root() { echo "" - if [[ $1 == "yes" ]] && [ `id -u` != 0 ] ; then + if [[ $1 == "yes" ]] && [ `id -u` != 0 ] ; then echo "ERROR: This action must run as root!" echo "" exit; - elif [[ $1 != "yes" ]] && [ `id -u` == 0 ] ; then + elif [[ $1 != "yes" ]] && [ `id -u` == 0 ] ; then echo "ERROR: This action cannot run as root!" echo "" exit; - fi + fi } function do_usage() @@ -266,22 +266,22 @@ while getopts "bch" OPTNAME do - case "${OPTNAME}" in - "b") + case "${OPTNAME}" in + "b") break; - ;; + ;; - "c") + "c") do_root "yes" do_distclean - ;; + ;; "*") do_usage - ;; + ;; esac done -do_root "yes" +do_root "yes" do_rootfs diff --git a/bsp/tarball/build.sh b/bsp/tarball/build.sh index ff1d933..a62bd20 100755 --- a/bsp/tarball/build.sh +++ b/bsp/tarball/build.sh @@ -12,32 +12,32 @@ function do_fetch_git() { - SRC=$1 + SRC=$1 - if [ -s ${SRC}-${IMX_BRANCH}.tar.xz ] ; then + if [ -s ${SRC}-${IMX_BRANCH}.tar.xz ] ; then echo " -- ${SRC} fetch alread, skip it --" return; fi - if [ ! -d $SRC ] ; then - git clone --branch ${IMX_BRANCH} ${GIT_URL_NXP}/${SRC}.git + if [ ! -d $SRC ] ; then + git clone --branch ${IMX_BRANCH} ${GIT_URL_NXP}/${SRC}.git fi echo " -- start git clone ${SRC} now --" - cd $SRC - git config tar.tar.xz.command "xz -c" - git archive --format=tar.xz --prefix=${SRC}/ ${IMX_BRANCH} > ${TAR_PATH}/${SRC}-${IMX_BRANCH}.tar.xz + cd $SRC + git config tar.tar.xz.command "xz -c" + git archive --format=tar.xz --prefix=${SRC}/ ${IMX_BRANCH} > ${TAR_PATH}/${SRC}-${IMX_BRANCH}.tar.xz - cd - + cd - rm -rf $SRC } function do_fetch_url() { - TARBALL=$1 + TARBALL=$1 - if [ -s ${TARBALL} ] ; then + if [ -s ${TARBALL} ] ; then echo " -- ${TARBALL} fetch alread, skip it --" return; fi @@ -50,7 +50,7 @@ function do_fetch() { - if [ ! -z $TARBALL_URL ] ; then + if [ ! -z $TARBALL_URL ] ; then do_fetch_url uboot-imx-${IMX_BRANCH}.tar.xz do_fetch_url linux-imx-${IMX_BRANCH}.tar.xz do_fetch_url rootfs_${ROOTFS}.tar.bz2 -- Gitblit v1.9.1