Skip to contentSkip to conversation

UBOOT_SOURCE/SCRIPTS variables must always be set

PATCH In review Luca Miccio 2 participants 2 messages Nov 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 UBOOT_SOURCE/SCRIPTS variables must always be set

The current README incorrectly omits the need for the UBOOT_SOURCE and UBOOT_SCRIPT variables for uboot-script-gen to function properly. Moreover, the script silently fails if these variables are not set. Return an error if the the UBOOT_SCRIPT variable is not set and correct the documentation accordingly.

---
 README.md                |  3 ++-
 scripts/uboot-script-gen | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
README.md +2 -1
index 4fcd908..ae2fdfd 100644
@@ -272,7 +272,8 @@ Where:
 
 - 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
+  parameter. It has to be set either in the config file or CLI argument
+  though.
 
 - APPEND_EXTRA_CMDS: is optional and specifies the path to a text file
   containing extra u-boot commands to be added to the boot script before
scripts/uboot-script-gen +12 -0
index dcf5bdb..fc63702 100755
@@ -1210,6 +1210,18 @@ then
     UBOOT_SCRIPT="$uboot_out_opt".scr
     UBOOT_SOURCE="$uboot_out_opt".source
 fi
+
+if test ! "$UBOOT_SOURCE"
+then
+    echo "UBOOT_SOURCE not set, either specify it in the config or set it with the -o option"
+    exit 1
+fi
+
+if test ! "$UBOOT_SCRIPT"
+then
+    UBOOT_SCRIPT="${UBOOT_SOURCE%.source}.scr"
+fi
+
 if test "$fit_opt" && ! test "$FIT"
 then
     FIT="${UBOOT_SOURCE%.source}.fit"
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Luca Miccio

The current README incorrectly omits the need for the UBOOT_SOURCE and UBOOT_SCRIPT variables for uboot-script-gen to function properly. Moreover, the script silently fails if these variables are not set. Return an error if the the UBOOT_SCRIPT variable is not set and correct the documentation accordingly.

Quoted 45 lines
---
 README.md                |  3 ++-
 scripts/uboot-script-gen | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
README.md +2 -1
index 4fcd908..ae2fdfd 100644
@@ -272,7 +272,8 @@ Where:
 
 - 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
+  parameter. It has to be set either in the config file or CLI argument
+  though.
 
 - APPEND_EXTRA_CMDS: is optional and specifies the path to a text file
   containing extra u-boot commands to be added to the boot script before
scripts/uboot-script-gen +12 -0
index dcf5bdb..fc63702 100755
@@ -1210,6 +1210,18 @@ then
     UBOOT_SCRIPT="$uboot_out_opt".scr
     UBOOT_SOURCE="$uboot_out_opt".source
 fi
+
+if test ! "$UBOOT_SOURCE"
+then
+    echo "UBOOT_SOURCE not set, either specify it in the config or set it with the -o option"
+    exit 1
+fi
+
+if test ! "$UBOOT_SCRIPT"
+then
+    UBOOT_SCRIPT="${UBOOT_SOURCE%.source}.scr"
+fi
+
 if test "$fit_opt" && ! test "$FIT"
 then
     FIT="${UBOOT_SOURCE%.source}.fit"
Signature · 1 line
2.34.1