Skip to content

Commit

Permalink
uboot-mkimage: show help before ERROR message
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Lopez committed Oct 11, 2016
1 parent bd0686c commit 08de7ef
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions U-boot/uboot-mkimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,29 @@
#

#include util.sh

function help_msg {
echo -e "-------------------------------------------------------------------"
echo -e "$(basename $0) -p -u -r <rootfs> -i <image>"
echo -e ""
echo -e "Options:"
echo -e "\t-m: Mode (pack|unpack)"
echo -e "\t-c: Compress mode (none|gzip)"
echo -e "\t-r: Root filesystem folder"
echo -e "\t-i: Image name without extension"
echo -e "\t-h: Print help message"
echo -e ""
echo -e "Variable SCRIPT_BASE_FOLDER must contain repository parent folder"
echo -e ""
echo -e "-------------------------------------------------------------------"
echo -e "Copyright (C) 2015, University of Granada"
echo -e "Miguel Jimenez Lopez <klyone@ugr.es>"
echo -e "GPLv2 License or later"
echo -e "-------------------------------------------------------------------"
}

if [ -z ${SCRIPT_BASE_FOLDER} ] ; then
help_msg
echo "ERROR: SCRIPT_BASE_FOLDER var not defined!"
exit -1
fi
Expand Down Expand Up @@ -49,24 +71,6 @@ function uboot_image_pack {
esac
}

function help_msg {
echo_norm "-------------------------------------------------------------------"
echo_norm "$(basename $0) -p -u -r <rootfs> -i <image>"
echo_norm ""
echo_norm "Options:"
echo_norm "\t-m: Mode (pack|unpack)"
echo_norm "\t-c: Compress mode (none|gzip)"
echo_norm "\t-r: Root filesystem folder"
echo_norm "\t-i: Image name without extension"
echo_norm "\t-h: Print help message"
echo_norm ""
echo_norm "-------------------------------------------------------------------"
echo_norm "Copyright (C) 2015, University of Granada"
echo_norm "Miguel Jimenez Lopez <klyone@ugr.es>"
echo_norm "GPLv2 License or later"
echo_norm "-------------------------------------------------------------------"
}

while getopts ":m:c:r:i:h" opt; do
case $opt in
m)
Expand Down

0 comments on commit 08de7ef

Please sign in to comment.