From ae07e67fbaa658977f1c60b023717491de522f8e Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Fri, 1 Mar 2024 13:18:44 +0800 Subject: [PATCH] revise build.sh with updated help message This patch revises build.sh using only one target argument. It also synchronizes help message with code. --- build.sh | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 0d7987c..6fda77a --- a/build.sh +++ b/build.sh @@ -132,7 +132,8 @@ function cleanup_build() { } function usage() { - echo "Usage: $0 build/clean" + echo "Usage: $0 \n" + echo "Here can be: linux, opensbi, uboot, rootfs, img, linux_opensbi_uboot, all or clean." } function fault() { @@ -141,34 +142,31 @@ function fault() { } function main() { + echo $# if [[ $# < 1 ]]; then fault fi - if [ "$1" = "build" ]; then - if [ "$2" = "linux" ]; then - build_linux - elif [ "$2" = "opensbi" ]; then - build_opensbi - elif [ "$2" = "uboot" ]; then - build_uboot - elif [ "$2" = "rootfs" ]; then - build_rootfs - elif [ "$2" = "img" ]; then - build_img - elif [ "$2" = "linux_opensbi_uboot" ]; then - build_linux - build_opensbi - build_uboot - elif [ "$2" = "all" ]; then - build_linux - build_opensbi - build_uboot - build_rootfs - build_img - else - fault - fi + if [ "$1" = "linux" ]; then + build_linux + elif [ "$1" = "opensbi" ]; then + build_opensbi + elif [ "$1" = "uboot" ]; then + build_uboot + elif [ "$1" = "rootfs" ]; then + build_rootfs + elif [ "$1" = "img" ]; then + build_img + elif [ "$1" = "linux_opensbi_uboot" ]; then + build_linux + build_opensbi + build_uboot + elif [ "$1" = "all" ]; then + build_linux + build_opensbi + build_uboot + build_rootfs + build_img elif [ "$1" = "clean" ]; then cleanup_build else