summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2019-05-23 02:54:09 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-07-03 16:35:45 -0700
commita5ab221a1aebbd159a8f3ff9c68a8e4a8d247421 (patch)
tree342d4b08e82ef54385f11209b77e838254b1da56
parent627fd9e8f662c62d428f2a3ebb774789224ca12d (diff)
downloadvboot-a5ab221a1aebbd159a8f3ff9c68a8e4a8d247421.tar.gz
futility: updater: Report EC and PD images on emulation
When testing updater behavior with emulation (--emulate), there was no way to know if EC and PD images were correctly found from archive and expected to be flashed (for example if we want to test the difference between modes). Since we do flash EC/PD in recovery and factory modes, it is better to still allow loading EC/PD images, and simply not writing them (and print some messages as indication) in emulation. BUG=chromium:965092 TEST=make runfutiltests BRANCH=None Change-Id: I3bbbd75cb8adf2e238a593d3dee0b2491abe7719 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1626190 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Dana Goyette <dgoyette@chromium.org>
-rw-r--r--futility/updater.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/futility/updater.c b/futility/updater.c
index 0a7a3d5c..82ee4a44 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -887,7 +887,8 @@ static int write_firmware(struct updater_config *cfg,
static int write_optional_firmware(struct updater_config *cfg,
const struct firmware_image *image,
const char *section_name,
- int check_programmer_wp)
+ int check_programmer_wp,
+ int is_host)
{
if (!image->data) {
VB2_DEBUG("No data in <%s> image.\n", image->programmer);
@@ -898,6 +899,14 @@ static int write_optional_firmware(struct updater_config *cfg,
image->file_name, image->programmer, section_name);
return 0;
}
+ /* Currently only host emulation is supported. */
+ if (cfg->emulation && !is_host) {
+ INFO("(emulation) Update %s from %s to %s (%d bytes), "
+ "skipped for non-host targets in emulation.\n",
+ section_name ? section_name : "whole image",
+ image->file_name, image->programmer, image->size);
+ return 0;
+ }
/*
* EC & PD may have different WP settings and we want to write
@@ -1577,7 +1586,7 @@ static enum updater_error_codes update_rw_firmware(
if (write_firmware(cfg, image_to, FMAP_RW_SECTION_A) ||
write_firmware(cfg, image_to, FMAP_RW_SECTION_B) ||
write_firmware(cfg, image_to, FMAP_RW_SHARED) ||
- write_optional_firmware(cfg, image_to, FMAP_RW_LEGACY, 0))
+ write_optional_firmware(cfg, image_to, FMAP_RW_LEGACY, 0, 1))
return UPDATE_ERR_WRITE_FIRMWARE;
return UPDATE_ERR_DONE;
@@ -1648,8 +1657,8 @@ static enum updater_error_codes update_whole_firmware(
/* FMAP may be different so we should just update all. */
if (write_firmware(cfg, image_to, NULL) ||
- write_optional_firmware(cfg, &cfg->ec_image, NULL, 1) ||
- write_optional_firmware(cfg, &cfg->pd_image, NULL, 1))
+ write_optional_firmware(cfg, &cfg->ec_image, NULL, 1, 0) ||
+ write_optional_firmware(cfg, &cfg->pd_image, NULL, 1, 0))
return UPDATE_ERR_WRITE_FIRMWARE;
return UPDATE_ERR_DONE;
@@ -1833,7 +1842,7 @@ static int updater_load_images(struct updater_config *cfg,
if (!errorcnt)
errorcnt += updater_setup_quirks(cfg, arg);
}
- if (cfg->emulation || arg->host_only)
+ if (arg->host_only)
return errorcnt;
if (!cfg->ec_image.data && ec_image)
@@ -2049,7 +2058,6 @@ int updater_setup_config(struct updater_config *cfg,
/* Set up archive and load images. */
if (arg->emulation) {
/* Process emulation file first. */
- check_single_image = 1;
cfg->emulation = arg->emulation;
VB2_DEBUG("Using file %s for emulation.\n", arg->emulation);
errorcnt += !!load_firmware_image(