aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBrian Woods2021-09-02 16:52:17 -0700
committerStefano Stabellini2021-09-03 11:05:13 -0700
commitcb376bb3ad07ab88a0c02d6a241e5847510ce1be (patch)
treee578fa9222717421bae0f49290ca57c3b4c18696 /scripts
parent5c1faa5b84d22aea0995da9b53503b213528afd5 (diff)
Add support for setting LOAD_CMD in the config
Reducing what's needed in the CLI arguments to a minimum to streamline usage. The current behavior does not change and setting it on the CLI arguments will overwrite what's in the config file. Signed-off-by: Brian Woods <brian.woods@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/uboot-script-gen26
1 files changed, 18 insertions, 8 deletions
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index a911238..e3f2753 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -272,16 +272,16 @@ function print_help
{
script=`basename "$0"`
echo "usage:"
- echo " $script -c CONFIG_FILE -t UBOOT_TYPE -d DIRECTORY [-o FILE] [-k KEY_DIR/HINT [-u U-BOOT_DTB]] [-e]"
+ echo " $script -c CONFIG_FILE -d DIRECTORY [-t LOAD_CMD] [-o FILE] [-k KEY_DIR/HINT [-u U-BOOT_DTB]] [-e]"
echo " $script -h"
echo "where:"
echo " CONFIG_FILE - configuration file"
- echo " UBOOT_TYPE can be:"
+ echo " DIRECTORY - root directory where the files of CONFIG_FILE are located"
+ echo " LOAD_CMD can be:"
echo " sd - alias for \"load mmc 0:1\" for uboot load commands"
echo " scsi - alias for \"load scsi 0:1\" for uboot load commands"
echo " tftp - alias for \"tftpb\" for uboot load cammnds"
echo " < > - used for uboot load commands"
- echo " DIRECTORY - root directory where the files of CONFIG_FILE are located"
echo " FILE - output filename for the uboot script and its source, overrides option in CONFIG_FILE"
echo " KEY_DIR - key directory used for signing a fit image"
echo " HINT - the file name of the crt and key file minus the suffix (ex, hint.crt and hint.key)"
@@ -300,16 +300,16 @@ while getopts ":c:t:d:ho:k:u:ef" opt; do
t )
case $OPTARG in
scsi )
- LOAD_CMD="load scsi 0:1"
+ load_opt="load scsi 0:1"
;;
sd )
- LOAD_CMD="load mmc 0:1"
+ load_opt="load mmc 0:1"
;;
tftp )
- LOAD_CMD="tftpb"
+ load_opt="tftpb"
;;
* )
- LOAD_CMD="$OPTARG"
+ load_opt="$OPTARG"
;;
esac
;;
@@ -346,7 +346,7 @@ while getopts ":c:t:d:ho:k:u:ef" opt; do
done
shift $((OPTIND -1))
-if [ -z "$LOAD_CMD" ] || [ -z "$cfg_file" ] || [ -z "$uboot_dir" ]
+if test ! "$cfg_file" -o ! "$uboot_dir"
then
echo "Undefined arguments, see \"$0 -h\""
exit 1
@@ -356,6 +356,16 @@ check_depends
source "$cfg_file"
+if test "$load_opt"
+then
+ LOAD_CMD="$load_opt"
+fi
+if test ! "$LOAD_CMD"
+then
+ echo "LOAD_CMD not set, either specify it in the config or set it with the -t option"
+ exit 1
+fi
+
# CLI ARG overrides what's in the config file
if [ ! -z "$UBOOT_SCRIPT_ARG" ]
then