diff options
author | Caveh Jalali <caveh@chromium.org> | 2018-04-12 20:41:38 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-04-17 00:47:08 -0700 |
commit | ab94e7ac45d394fefc5cd3221401090a5f225734 (patch) | |
tree | 07cec2b84802d54ba9678cfe06d6757d219c1fe3 /util/flash_ec | |
parent | fc006560c15ae1619c6eb0224f3530a023f59688 (diff) | |
download | chrome-ec-ab94e7ac45d394fefc5cd3221401090a5f225734.tar.gz |
flash_ec: fail on flash chip size of 0
flashrom --get-size seems to return a size of 0 in some failure cases.
add specific handling of this case so we don't proceed and end up
failing with a somewhat misleading message like:
Error: Image size doesn't match: stat 524288 bytes, wanted 1048576!
BUG=none
BRANCH=none
TEST=flashrom now fails with "chip size is 0" instead of complaining
about wanting a 1048576 byte image.
Change-Id: Iab4d0843d86ceec9f0ca482d9e060a33c7a58c7a
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1011823
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'util/flash_ec')
-rwxr-xr-x | util/flash_ec | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/util/flash_ec b/util/flash_ec index 487035c194..b0fbad8832 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -713,6 +713,7 @@ function flash_flashrom() { SPI_SIZE=$(sudo ${FLASHROM_CMDLINE} 2>/dev/null |\ grep -oe '[0-9]\+$') || \ die "Failed to determine chip size!" + (( SPI_SIZE == 0 )) && die "Chip size is 0!" IMG_SIZE=$(stat -c%s "$IMG") PATCH_SIZE=$((${SPI_SIZE} - ${IMG_SIZE})) |