summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@google.com>2018-03-13 12:14:13 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-19 21:34:30 -0700
commit48d6891db8b5b2b0825136f6f9013a110b2a98da (patch)
treef00ef3fd7630cb3827cec17b9579f066d3b3c3b7
parent831d2b2597af1b92d576f6fb8c52066f0695249f (diff)
downloadchrome-ec-48d6891db8b5b2b0825136f6f9013a110b2a98da.tar.gz
cr50 signer: allow to use directory to specify source files
In most cases when Cr50 signer script is invoked, the input elf files are stored in the same directory and named ec.RW.elf and ec.RW_B.elf, the way they produced by the EC makefile. Let's allow create_released_image.sh to accept a directory name instead of two elf file names. BRANCH=none BUG=none TEST=verified that the script properly handles both old and new command line options (allows to pass individual elf files and a directory name). Change-Id: I40bb8983fd97e6cd82e235308622ba2f20119ce5 Signed-off-by: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://chromium-review.googlesource.com/963618 Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org>
-rwxr-xr-xutil/signer/create_released_image.sh23
1 files changed, 16 insertions, 7 deletions
diff --git a/util/signer/create_released_image.sh b/util/signer/create_released_image.sh
index 9dccd02aba..c584cc5392 100755
--- a/util/signer/create_released_image.sh
+++ b/util/signer/create_released_image.sh
@@ -184,17 +184,31 @@ set -e
FLAGS_HELP="usage: ${ME} [flags] <blobs>
blobs are:
- <prod RO A>.hex <prod RO B>.hex <RW.elf> <RW_B.elf>"
+ <prod RO A>.hex <prod RO B>.hex <RW.elf> <RW_B.elf>
+ or
+ <prod RO A>.hex <prod RO B>.hex <dir>
+ where <dir> contains files named ec.RW.elf and ec.RW_B.elf
+"
# Parse command line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
-if [ "${#*}" != "4" ]; then
+
+if [[ $# == 3 && -d "${3}" ]]; then
+ rw_a="${3}/ec.RW.elf"
+ rw_b="${3}/ec.RW_B.elf"
+elif [[ $# == 4 ]]; then
+ rw_a="${3}"
+ rw_b="${4}"
+else
flags_help
exit 1
fi
+prod_ro_a="${1}"
+prod_ro_b="${2}"
+
dd if=/dev/zero bs="${IMAGE_SIZE}" count=1 2>/dev/null |
tr \\000 \\377 > "${RESULT_FILE}"
if [ "$(stat -c '%s' "${RESULT_FILE}")" != "${IMAGE_SIZE}" ]; then
@@ -202,11 +216,6 @@ if [ "$(stat -c '%s' "${RESULT_FILE}")" != "${IMAGE_SIZE}" ]; then
exit 1
fi
-prod_ro_a="${1}"
-prod_ro_b="${2}"
-rw_a="${3}"
-rw_b="${4}"
-
# Used by the bs script.
export CR50_BOARD_ID="${FLAGS_cr50_board_id}"