From 8d2ec2700398f7d3363ebd194e697ae7358b5028 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 27 Jan 2022 10:30:13 +0800 Subject: futility: updater: add new quirk 'no_verify' Some devices in early dogfood stage may need to skip verifying flashed firmware contents, for example due to CSE updating itself. This should not be a long term solution - only for debugging or testing in early development. BUG=b:213706510 TEST=build and test BRANCH=none Change-Id: I04a79f6762a0c556d82d0062e5cf5c9b3e0cfc4f Signed-off-by: Hung-Te Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3419417 Reviewed-by: Yu-Ping Wu Reviewed-by: YH Lin Commit-Queue: YH Lin --- futility/updater.c | 1 + futility/updater.h | 1 + futility/updater_quirks.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/futility/updater.c b/futility/updater.c index d58ea399..46f8878a 100644 --- a/futility/updater.c +++ b/futility/updater.c @@ -1198,6 +1198,7 @@ enum updater_error_codes update_firmware(struct updater_config *cfg) image_to->file_name, image_to->ro_version, image_to->rw_version_a, image_to->rw_version_b); + try_apply_quirk(QUIRK_NO_VERIFY, cfg); if (try_apply_quirk(QUIRK_MIN_PLATFORM_VERSION, cfg)) { if (!cfg->force_update) { ERROR("Add --force to waive checking the version.\n"); diff --git a/futility/updater.h b/futility/updater.h index 721f09f1..2562782b 100644 --- a/futility/updater.h +++ b/futility/updater.h @@ -47,6 +47,7 @@ enum quirk_types { QUIRK_OVERRIDE_SIGNATURE_ID, QUIRK_PRESERVE_ME, QUIRK_NO_CHECK_PLATFORM, + QUIRK_NO_VERIFY, QUIRK_MAX, }; diff --git a/futility/updater_quirks.c b/futility/updater_quirks.c index 5d996ad5..1f7fada9 100644 --- a/futility/updater_quirks.c +++ b/futility/updater_quirks.c @@ -433,6 +433,16 @@ static int quirk_no_check_platform(struct updater_config *cfg) return 0; } +/* + * Disable verifying contents after flashing. + */ +static int quirk_no_verify(struct updater_config *cfg) +{ + WARN("Disabled verifying flashed contents. You are on your own.\n"); + cfg->do_verify = 0; + return 0; +} + /* * Registers known quirks to a updater_config object. */ @@ -497,6 +507,11 @@ void updater_register_quirks(struct updater_config *cfg) quirks->name = "no_check_platform"; quirks->help = "Do not check platform name."; quirks->apply = quirk_no_check_platform; + + quirks = &cfg->quirks[QUIRK_NO_VERIFY]; + quirks->name = "no_verify"; + quirks->help = "Do not verify when flashing."; + quirks->apply = quirk_no_verify; } /* -- cgit v1.2.1