futility: updater: Check and use larger regions in EC RO update
futility: updater: Check and use larger regions in EC RO update

Unlike STM32 (used on ARM Chromebooks), EC images on most x86
Chromebooks used to have a header before EC_RO section describing the
size and attributes of firmware to load.  However, partial updating with
only 'EC_RO' by flashrom will not include those data. So we should use
'WP_RO' to update whole RO area.

This also implies EC RO software sync, which usually only updates
ec.RO.bin in EC_RO, is not safe on devices with extra data. A quick
solution is to only allow RO software sync when EC_RO is aligned to top
of EC firmware image. Also in future devices cannot run EC software sync
may skip generating EC RO blobs in AP coreboot CBFS so the updater won't
try to do RO software sync.

BUG=chromium:1024401
TEST=(kukui) chromeos-firmwareupdate --mode=recovery # updated and boot
     (laser) chromeos-firmwareupdate --mode=recovery # updated and boot
     also verified we can update from old x86 EC (EC_RO does not
     include header) to new style (EC_RO contains header).

Change-Id: I2c90320ffbfd79ba0cbaf70016446d8ab489e6ac
Signed-off-by: Hung-Te Lin <8a7fce4940baad93a69f5073b383c85deed9d9c4@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1919097
Reviewed-by: Shelley Chen <ab7b8cc85923339aed379eb1c5cc4dccfd2eb3d7@chromium.org>

coreboot/vboot,coreboot/vboot,coreboot/vboot,coreboot/vboot,coreboot/vboot