aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Stabellini2020-03-05 13:16:55 -0800
committerStefano Stabellini2020-03-05 14:17:43 -0800
commit4f53c7af211f919f34651828b97cae84cd00d7e7 (patch)
tree0998041a216d96d8b23bae55d02ac6531307ab81
parenta8e1675f75c3df0561ac75a50e7cccb1cd921bf2 (diff)
Introduce a -o option to specify output filename
Introduce a -o command line option for uboot-script-gen to be able to easily specify the output filename for the uboot script and the uboot script source. Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Signed-off-by: Brian Woods <brian.woods@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
-rw-r--r--README.md7
-rw-r--r--scripts/uboot-script-gen15
2 files changed, 19 insertions, 3 deletions
diff --git a/README.md b/README.md
index 98da5e8..388b252 100644
--- a/README.md
+++ b/README.md
@@ -68,10 +68,14 @@ Where:
- DOMU_PASSTHROUGH_DTB[number] specifies the device assignment
configuration, see xen.git:docs/misc/arm/passthrough.txt
+- UBOOT_SOURCE and UBOOT_SCRIPT specify the output. They are optional
+ as you can pass -o FILENAME to uboot-script-gen as a command line
+ parameter
+
Then you can invoke uboot-script-gen as follows:
```
-$ bash ./scripts/uboot-script-gen -c /path/to/config-file -d . -t tftp
+$ bash ./scripts/uboot-script-gen -c /path/to/config-file -d . -t tftp -o bootscript
```
Where:\
@@ -81,6 +85,7 @@ Where:\
-t specifies the u-boot command to load the binaries. "tftp" and "sd"
are shorthands for "tftpb" and "load scsi 0:1", but actually any
arbitrary command can be used, for instance -t "fatload" is valid.\
+-o specifies the output filename for the uboot script and its source.\
## Stand-alone Usage: scripts/disk\_image
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index f342505..9e81ad8 100644
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -183,7 +183,7 @@ function check_depends()
function print_help
{
echo "usage:"
- echo " $0 -c CONFIG_FILE -t UBOOT_TYPE -d DIRECTORY"
+ echo " $0 -c CONFIG_FILE -t UBOOT_TYPE -d DIRECTORY [-o FILE]"
echo " $0 -h"
echo "where:"
echo " CONFIG_FILE - configuration file"
@@ -192,6 +192,7 @@ function print_help
echo " tftp - alias for \"tftpb\" for uboot load cammnds"
echo " < > - used for uboot load commands"
echo " DIRECTORY - root directory of where the files of CONFIG_FILE"
+ echo " FILE - output filename for the uboot script and its source, overrides option in CONFIG_FILE"
echo " -h - prints out the help message and exits "
echo "Defaults:"
echo " CONFIG_FILE=$cfg_file, UBOOT_TYPE=\"LOAD_CMD\" env var, DIRECTORY=$uboot_dir"
@@ -199,7 +200,7 @@ function print_help
echo " $0 -c ../config -d ./build42 -t \"scsi load 1:1\""
}
-while getopts ":c:t:d:h" opt; do
+while getopts ":c:t:d:ho:" opt; do
case ${opt} in
t )
case $OPTARG in
@@ -220,6 +221,9 @@ while getopts ":c:t:d:h" opt; do
d )
uboot_dir=$OPTARG
;;
+ o )
+ UBOOT_SCRIPT_ARG=$OPTARG
+ ;;
h )
print_help
exit 0
@@ -242,6 +246,13 @@ check_depends
source "$cfg_file"
+# CLI ARG overrides what's in the config file
+if [ ! -z "$UBOOT_SCRIPT_ARG" ]
+then
+ UBOOT_SCRIPT="$UBOOT_SCRIPT_ARG".scr
+ UBOOT_SOURCE="$UBOOT_SCRIPT_ARG".source
+fi
+
# the cd is needed so that the relative paths will match once we use
# tftp or move the files to a partition
cd "$uboot_dir"