From 7c52283f7883f0a786c64f64b0ef2770d08dd91d Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Tue, 2 Jun 2020 14:41:43 +1000 Subject: chromeos/cr50_enable_update.c: Modify recovery flow for cr50 Enable Cr50 update in recovery mode, so that we can at least still update the process for most cases (that an update is pending in recovery mode is not impossible but should be unlikely in the field). Leave manual recovery unaffected so at least that would still work even if Cr50 wedges in a weird way that it thinks it has an update on every boot or something. Setting the recovery_reason to VB2_RECOVERY_TRAIN_AND_REBOOT allows the update to be applied. BUG=b:154071064 BRANCH=none TEST=builds Thanks to Julius Werner for the suggested fix. Change-Id: Iba341a750cce8334da4dcf6353ca8cd1268d170f Signed-off-by: Edward O'Callaghan Reviewed-on: https://review.coreboot.org/c/coreboot/+/41988 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/vendorcode/google/chromeos/cr50_enable_update.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/vendorcode/google') diff --git a/src/vendorcode/google/chromeos/cr50_enable_update.c b/src/vendorcode/google/chromeos/cr50_enable_update.c index 5b3a1a3474..e30fe2a44c 100644 --- a/src/vendorcode/google/chromeos/cr50_enable_update.c +++ b/src/vendorcode/google/chromeos/cr50_enable_update.c @@ -72,8 +72,12 @@ static void enable_update(void *unused) int cr50_reset_reqd = 0; uint8_t num_restored_headers; - /* Nothing to do on recovery mode. */ - if (vboot_recovery_mode_enabled()) + /** + * Never update during manually-triggered recovery to ensure update + * cannot interfere. Non-manual VB2_RECOVERY_TRAIN_AND_REBOOT + * sometimes used to update in factory. + */ + if (vboot_get_context()->flags & VB2_CONTEXT_FORCE_RECOVERY_MODE) return; ret = tlcl_lib_init(); -- cgit v1.2.3