diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2017-08-01 16:41:30 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-03 15:13:55 -0700 |
commit | 716b0fcf4f3fceae3a156a118d2979227ac06226 (patch) | |
tree | d5b22bacf52748a008c5355de67404812e745402 /util/signer | |
parent | e525e1af8a9d89fe1613238b4a5eb458e7f5c7de (diff) | |
download | chrome-ec-716b0fcf4f3fceae3a156a118d2979227ac06226.tar.gz |
signer: include Board ID fields in the tarball file name
When an image with non-default board ID fields is released, the
generated tarball name should include the Board ID values to allow to
tell between images of the same version locked for different boards.
BRANCH=none
BUG=none
TEST=ran create_released_image.sh with and without specifying Board ID
fields, observed properly named file generated in both cases
Change-Id: I5f60a0e547d93c78caee34a9c307fc93f824b2ae
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/597121
Reviewed-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Diffstat (limited to 'util/signer')
-rwxr-xr-x | util/signer/create_released_image.sh | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/util/signer/create_released_image.sh b/util/signer/create_released_image.sh index 430f58168b..9e0397916f 100755 --- a/util/signer/create_released_image.sh +++ b/util/signer/create_released_image.sh @@ -55,9 +55,11 @@ verify_ro() { # RW version numbers, which is where eventually the ebuild downloading the # tarball from the BCS expects the dev and prod images be. prepare_image() { + local awk_prog local count=0 local extra_param= local image_type="${1}" + local raw_version local ro_a_hex="$(readlink -f "${2}")" local ro_b_hex="$(readlink -f "${3}")" local rw_a="$(readlink -f "${4}")" @@ -88,9 +90,44 @@ prepare_image() { dd if="${TMPD}/0.bin" of="${RESULT_FILE}" conv=notrunc dd if="${TMPD}/1.bin" of="${RESULT_FILE}" seek=262144 bs=1 conv=notrunc - version="$("${USB_UPDATER}" -b "${RESULT_FILE}" | - awk '/^RO_A:/ {gsub(/R[OW]_A:/, ""); print "r" $1 ".w" $2}')" - + # A typical Cr50 version reported by usb_updater looks as follows: + # RO_A:0.0.10 RW_A:0.0.22[ABCD:00000013:00000012] ...(the same for R[OW]_B). + # + # In case Board ID field is not set in the image, it is reported as + # [00000000:00000000:00000000] + # + # We want the generated tarball file name to include all relevant version + # fields. Let's retrieve the version string and process it using awk to + # generate the proper file name. Only the RO_A and RW_A version numbers are + # used, this script trusts the user to submit for processing a proper image + # where both ROs and both RWs are of the same version respectively. + # + # As a result, blob versions are converted as follows: + # RO_A:0.0.10 RW_A:0.0.22[ABCD:00000013:00000012] into + # r0.0.10.w0.0.22_ABCD_00000013_00000012 + # + # RO_A:0.0.10 RW_A:0.0.22[00000000:00000000:00000000] into + # r0.0.10.w0.0.22 + # + # The below awk program accomplishes this preprocessing. + awk_prog='/^RO_A:/ { + # drop the RO_A/RW_A strings + gsub(/R[OW]_A:/, "") + # Drop default mask value completely. + gsub(/\[00000000:00000000:00000000\]/, "") + # If there is a non-default mask: + # - replace opening brackets and colons with underscores. + gsub(/[\[\:]/, "_") + # - drop the trailing bracket. + gsub(/\]/, "") + # Print filtered out RO_A and RW_A values + print "r" $1 ".w" $2 +}' + + raw_version="$("${USB_UPDATER}" -b "${RESULT_FILE}")" || + ( echo "${ME}: Failed to retrieve blob version" >&2 && exit 1 ) + + version="$(awk "${awk_prog}" <<< "${raw_version}" )" if [ -z "${dest_dir}" ]; then # Note that this is a global variable dest_dir="cr50.${version}" |