From 7ac9332b6b07fab2e09a8c4b6cf82a49ad9abcb9 Mon Sep 17 00:00:00 2001 From: Namyoon Woo Date: Wed, 5 Aug 2020 12:47:20 -0700 Subject: util/flash_ec: fix in parse error in getting flash_size from flashrom This patch fixes flash_ec to take the last line of grep result from the output of 'flashrom --flash-size'. BUG=b:162771462 BRANCH=none TEST=ran flash_ec on nocturne with suzy-Q connected. $ ./util/flash_ec --image /Downloads/nocturne.bin --board nocturne \ --verbose INFO: Using ccd_cr50. INFO: Using ec image : /Downloads/nocturne.bin INFO: Flashing chip npcx_int_spi. dut-control --port=9999 cold_reset:on dut-control --port=9999 fw_up:on dut-control --port=9999 cold_reset:off INFO: Running flashrom: ... Erasing and writing flash chip... SUCCESS INFO: Flashing done. INFO: Restoring servo settings... dut-control --port=9999 fw_up:off dut-control --port=9999 ccd_ec_boot_mode_uut:off dut-control --port=9999 ccd_ec_boot_mode_bitbang:off dut-control --port=9999 cold_reset:on Signed-off-by: Namyoon Woo Change-Id: I1120c828ddb33f327cce46435ec9fa26b10d1908 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2340088 Reviewed-by: Edward Hill Commit-Queue: Edward Hill --- util/flash_ec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/flash_ec b/util/flash_ec index 272f00d38a..2dff03a5d3 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -972,8 +972,8 @@ function flash_flashrom() { info "Running flashrom:" 1>&2 echo " ${FLASHROM_GETSIZE}" 1>&2 fi - SPI_SIZE=$(${FLASHROM_GETSIZE} | grep -oe '[0-9]\+$') || \ - die "Failed to determine chip size!" + SPI_SIZE=$(${FLASHROM_GETSIZE} | grep -oe '[0-9]\+$' | + tail -n1) || die "Failed to determine chip size!" [[ ${SPI_SIZE} -eq 0 ]] && die "Chip size is 0!" PATCH_SIZE=$((${SPI_SIZE} - ${IMG_SIZE})) -- cgit v1.2.1