Use LOAD_CMD by default if not specified in load_file()
Commit 061d6782756f modified load_file() to take load command as argument but did not change all the invocations (e.g. loading standalone Linux, bitstream, etc.) which broke the output script (load command empty). Fix it by defaulting to LOAD_CMD if not specified.
--- scripts/uboot-script-gen | 6 ++++++ 1 file changed, 6 insertions(+)
scripts/uboot-script-gen +6 -0
@@ -736,6 +736,12 @@ function load_file() local base="$(realpath $PWD)"/ local relative_path=${absolute_path#"$base"} + # Default to LOAD_CMD if not specified + if test -z "${load_cmd}" + then + load_cmd="${LOAD_CMD}" + fi + if test "$FIT" then echo "imxtract \$fit_addr $fit_scr_name $memaddr" >> $UBOOT_SOURCE
Signature · 1 line
2.43.0
Hi Michal,
Thank you for the patch and the detailed explanation.
Quoted 17 lines · Michal Orzel
Commit
061d6782756fmodifiedload_file()to take load command as argument but did not change all the invocations (e.g. loading standalone Linux, bitstream, etc.) which broke the output script (load command empty). Fix it by defaulting toLOAD_CMDif not specified.Fixes 061d6782756f ("Add config option to use separate load commands for Xen, DOM0 and DOMU binaries")Signed-off-by Michal Orzel <[email protected]>--- scripts/uboot-script-gen | 6 ++++++ 1 file changed, 6 insertions(+)scripts/uboot-script-gen +0
-0
scripts/uboot-script-gen function load_file() · line 744
Quoted 9 lines
scripts/uboot-script-gen +6
-0@@ -736,6 +736,12 @@ function load_file() local base="$(realpath $PWD)"/ local relative_path=${absolute_path#"$base"} + # Default to LOAD_CMD if not specified + if test -z "${load_cmd}" + then + load_cmd="${LOAD_CMD}" + fi +
I was wondering if we could use a slightly more concise notation here, like:
: "${load_cmd:=$LOAD_CMD}"
It does the same thing but is a bit more idiomatic for Bash scripts.
Quoted 7 lines
scripts/uboot-script-gen +0
-1if test "$FIT" then echo "imxtract \$fit_addr $fit_scr_name $memaddr" >> $UBOOT_SOURCE --2.43.0
Thanks again for your work on this!
Best regards,
Mykola
Quoted 35 lines · Mykola Kvach
Hi Michal,
Thank you for the patch and the detailed explanation.
Quoted 17 lines · Michal Orzel
Commit
061d6782756fmodifiedload_file()to take load command as argument but did not change all the invocations (e.g. loading standalone Linux, bitstream, etc.) which broke the output script (load command empty). Fix it by defaulting toLOAD_CMDif not specified.Fixes 061d6782756f ("Add config option to use separate load commands for Xen, DOM0 and DOMU binaries")Signed-off-by Michal Orzel <[email protected]>--- scripts/uboot-script-gen | 6 ++++++ 1 file changed, 6 insertions(+)scripts/uboot-script-gen +0
-0scripts/uboot-script-gen function load_file() · line 744
Quoted 9 lines
scripts/uboot-script-gen +6
-0@@ -736,6 +736,12 @@ function load_file() local base="$(realpath $PWD)"/ local relative_path=${absolute_path#"$base"} + # Default to LOAD_CMD if not specified + if test -z "${load_cmd}" + then + load_cmd="${LOAD_CMD}" + fi +I was wondering if we could use a slightly more concise notation here, like:
: "${load_cmd:=$LOAD_CMD}"
Quoted 1 line
It does the same thing but is a bit more idiomatic for Bash scripts.
Some time ago, Stefano requested me to use a simpler notation in ImageBuilder, so that it's immediately clear what the script does. Therefore I followed this suggestion here as well. I will let him choose what suits the project best.
~Michal
Quoted 36 lines · Michal
Quoted 35 lines · Mykola Kvach
Hi Michal,
Thank you for the patch and the detailed explanation.
Quoted 17 lines · Michal Orzel
Commit
061d6782756fmodifiedload_file()to take load command as argument but did not change all the invocations (e.g. loading standalone Linux, bitstream, etc.) which broke the output script (load command empty). Fix it by defaulting toLOAD_CMDif not specified.Fixes 061d6782756f ("Add config option to use separate load commands for Xen, DOM0 and DOMU binaries")Signed-off-by Michal Orzel <[email protected]>--- scripts/uboot-script-gen | 6 ++++++ 1 file changed, 6 insertions(+)scripts/uboot-script-gen +0
-0scripts/uboot-script-gen function load_file() · line 744
Quoted 9 lines
scripts/uboot-script-gen +6
-0@@ -736,6 +736,12 @@ function load_file() local base="$(realpath $PWD)"/ local relative_path=${absolute_path#"$base"} + # Default to LOAD_CMD if not specified + if test -z "${load_cmd}" + then + load_cmd="${LOAD_CMD}" + fi +I was wondering if we could use a slightly more concise notation here, like:
: "${load_cmd:=$LOAD_CMD}"
Quoted 4 lines
Quoted 1 line
It does the same thing but is a bit more idiomatic for Bash scripts.
Some time ago, Stefano requested me to use a simpler notation in ImageBuilder, so that it's immediately clear what the script does. Therefore I followed this suggestion here as well. I will let him choose what suits the project best.
I prefer the way Michal wrote it.
This is one of those cases where there is no right or wrong answer. Mykola's suggestion is a more modern and concise version. The code style I used was an attempt to be more verbose but also clearer. As always, when it comes to clarity, each individual finds different approaches more understandable.
[email protected]
Reviewed-by Denis MukhinQuoted 7 lines · Michal Orzel
Commit
061d6782756fmodifiedload_file()to take load command as argument but did not change all the invocations (e.g. loading standalone Linux, bitstream, etc.) which broke the output script (load command empty). Fix it by defaulting toLOAD_CMDif not specified.Fixes 061d6782756f ("Add config option to use separate load commands for Xen, DOM0 and DOMU binaries")Signed-off-by Michal Orzel <[email protected]>
Quoted 25 lines
--- scripts/uboot-script-gen | 6 ++++++ 1 file changed, 6 insertions(+)scripts/uboot-script-gen +6
-0@@ -736,6 +736,12 @@ function load_file() local base="$(realpath $PWD)"/ local relative_path=${absolute_path#"$base"} + # Default to LOAD_CMD if not specified + if test -z "${load_cmd}" + then + load_cmd="${LOAD_CMD}" + fi + if test "$FIT" then echo "imxtract \$fit_addr $fit_scr_name $memaddr" >> $UBOOT_SOURCESignature · 1 line
2.43.0
Stefano Stabellini
Acked-byQuoted 10 lines · On Tue, 9 Sep 2025, [email protected] wrote:
Quoted 7 lines · Michal Orzel
Commit
061d6782756fmodifiedload_file()to take load command as argument but did not change all the invocations (e.g. loading standalone Linux, bitstream, etc.) which broke the output script (load command empty). Fix it by defaulting toLOAD_CMDif not specified.Fixes 061d6782756f ("Add config option to use separate load commands for Xen, DOM0 and DOMU binaries")Signed-off-by Michal Orzel <[email protected]>Reviewed-by Denis Mukhin <[email protected]>