From 524012c64c07f8673998428cca7f80e01a387f48 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Fri, 25 Sep 2020 11:11:22 +0800 Subject: futility: updater: print flashrom execution logs on read failure To prevent flooding AU logs, we don't want flashrom to print verbose logs especially when reading system SPI flash. However, if anything goes wrong it will be very helpful to have all the messages logged. With this patch, we will try reading system flash again with max verbosity. BUG=chromium:943262,b:169026171 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I5469182f2628855e65546bef3abf8791261aabca Signed-off-by: Hung-Te Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1545598 Commit-Queue: Edward O'Callaghan Reviewed-by: Edward O'Callaghan --- futility/updater_utils.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/futility/updater_utils.c b/futility/updater_utils.c index 5a2a5e6d..a441e03d 100644 --- a/futility/updater_utils.c +++ b/futility/updater_utils.c @@ -639,6 +639,17 @@ int load_system_firmware(struct firmware_image *image, r = host_flashrom(FLASHROM_READ, tmp_path, image->programmer, verbosity, NULL, NULL); + /* + * The verbosity for host_flashrom will be translated to + * (verbosity-1)*'-V', and usually 3*'-V' is enough for debugging. + */ + const int debug_verbosity = 4; + if (r && verbosity < debug_verbosity) { + /* Read again, with verbose messages for debugging. */ + WARN("Failed reading system firmware (%d), try again...\n", r); + r = host_flashrom(FLASHROM_READ, tmp_path, image->programmer, + debug_verbosity, NULL, NULL); + } if (!r) r = load_firmware_image(image, tmp_path, NULL); return r; -- cgit v1.2.1