Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
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 <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41988
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
---
M src/vendorcode/google/chromeos/cr50_enable_update.c
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/vendorcode/google/chromeos/cr50_enable_update.c b/src/vendorcode/google/chromeos/cr50_enable_update.c
index 5b3a1a3..e30fe2a 100644
--- a/src/vendorcode/google/chromeos/cr50_enable_update.c
+++ b/src/vendorcode/google/chromeos/cr50_enable_update.c
@@ -72,8 +72,12 @@
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();

To view, visit change 41988. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Iba341a750cce8334da4dcf6353ca8cd1268d170f
Gerrit-Change-Number: 41988
Gerrit-PatchSet: 4
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Sam McNally <sammc@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged