diff options
author | Hung-Te Lin <hungte@chromium.org> | 2022-02-14 19:02:24 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-25 11:08:21 +0000 |
commit | f1144f4c25a38a78df7ac302f834d446270428e7 (patch) | |
tree | 51ae96f0236943532ad2c9671b14bd21ef76d8fb | |
parent | ca1aa19bc80a0455ba49608ca0a19a9c516c9673 (diff) | |
download | vboot-f1144f4c25a38a78df7ac302f834d446270428e7.tar.gz |
futility: updater: improve updater console output
To help debugging:
- Print equivalent flashrom commands when reading and writing.
- Print <sys-flash> instead of <none> in 'Current system:' message.
- Always print the detected model from libcrosid.
- After writing to flash, print a new line.
BUG=None
TEST=make; build and run test
BRANCH=None
Change-Id: I34a73ec1c968a98a9fca649c65863aa43ca39ca8
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3461090
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r-- | futility/updater_archive.c | 6 | ||||
-rw-r--r-- | futility/updater_utils.c | 17 | ||||
-rw-r--r-- | host/lib/flashrom_drv.c | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/futility/updater_archive.c b/futility/updater_archive.c index 93a043a9..9c3a608d 100644 --- a/futility/updater_archive.c +++ b/futility/updater_archive.c @@ -872,8 +872,10 @@ const struct model_config *manifest_find_model(const struct manifest *manifest, return NULL; } - VB2_DEBUG("Matched chromeos-config index: %d\n", matched_index); - VB2_DEBUG("Manifest key (model): '%s'\n", manifest_key); + INFO("Identified the device using libcrosid, " + "matched chromeos-config index: %d, " + "manifest key (model): %s\n", + matched_index, manifest_key); model_name = manifest_key; } diff --git a/futility/updater_utils.c b/futility/updater_utils.c index a846ef2b..9f91129e 100644 --- a/futility/updater_utils.c +++ b/futility/updater_utils.c @@ -528,6 +528,10 @@ int load_system_firmware(struct firmware_image *image, { int r, i; + INFO("flasrhom -r <IMAGE> -p %s%s\n", + image->programmer, + verbosity ? " -V" : ""); + for (i = 1, r = -1; i <= retries && r != 0; i++) { if (i > 1) WARN("Retry reading firmware (%d/%d)...\n", i, retries); @@ -551,11 +555,24 @@ int write_system_firmware(const struct firmware_image *image, { int r, i; + INFO("flashrom -w <IMAGE> -p %s%s%s%s%s%s\n", + image->programmer, + diff_image ? " --flash-contents <DIFF_IMAGE>" : "", + do_verify ? "" : " --noverify", + verbosity > 1 ? " -V" : "", + section_name ? " -i " : "", + section_name ? section_name : ""); + for (i = 1, r = -1; i <= retries && r != 0; i++) { if (i > 1) WARN("Retry writing firmware (%d/%d)...\n", i, retries); r = flashrom_write_image(image, section_name, diff_image, do_verify, verbosity + 1); + /* + * Force a newline to flush stdout in case if + * flashrom_write_image left some messages in the buffer. + */ + fprintf(stdout, "\n"); } return r; } diff --git a/host/lib/flashrom_drv.c b/host/lib/flashrom_drv.c index dfc9c83d..18e00ebe 100644 --- a/host/lib/flashrom_drv.c +++ b/host/lib/flashrom_drv.c @@ -102,7 +102,7 @@ int flashrom_read_image(struct firmware_image *image, const char *region, image->data = calloc(1, len); image->size = len; - image->file_name = strdup("<none>"); + image->file_name = strdup("<sys-flash>"); r |= flashrom_image_read(flashctx, image->data, len); |