diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-03-23 13:06:32 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-28 19:04:12 -0700 |
commit | 522fd2a0af591c12e2089601c0aab4097cc749c1 (patch) | |
tree | 1621d9e6772cd8b67fbd651f046dfd5af7a790e3 | |
parent | f70c35da2801bbba477c16919392486ab07111b0 (diff) | |
download | vboot-522fd2a0af591c12e2089601c0aab4097cc749c1.tar.gz |
sign_cr50_firmware: improve error reporting
In case jq does not find a node in the JSON file, it still returns
with exit code of 0, it just prints 'null' instead of the expected
node value.
This patch adds processing this error condition, which makes it easier
to troubleshoot the case of misconfigured Cr50 signing manifest.
BRANCH=none
BUG=b:74100307
TEST=tried using the script with a manifest which does not have the
node of board_id_flags defined. Observed error message of
...sign_cr50_firmware.sh: ERROR : bid_flags not found in...
instead of previous error reported as
...sign_cr50_firmware.sh: line 53: null: unbound variable
Change-Id: I70acff7a3331b01f0f964f2942bf2806a2af8691
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1537260
Reviewed-by: Mike Frysinger <vapier@chromium.org>
-rwxr-xr-x | scripts/image_signing/sign_cr50_firmware.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/image_signing/sign_cr50_firmware.sh b/scripts/image_signing/sign_cr50_firmware.sh index b39babac..1616e49b 100755 --- a/scripts/image_signing/sign_cr50_firmware.sh +++ b/scripts/image_signing/sign_cr50_firmware.sh @@ -43,7 +43,14 @@ verify_cr50_manifest() { local bid_flags major="$(jq '.major' "${manifest_json}")" + if [[ ${major} == null ]]; then + die "Major version number not found in ${manifest_json}" + fi + bid_flags="$(jq '.board_id_flags' "${manifest_json}")" + if [[ ${bid_flags} == null ]]; then + die "bid_flags not found in ${manifest_json}" + fi if (( major & 1 )); then if (( bid_flags & MP_BID_FLAG )); then |