From ad33485a2fc87ccd8859f955601ecfd38fa4402c Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 19 Jul 2011 15:52:43 -0700 Subject: [PATCH] Clear the recovery request after each boot attempt which is allowed to fail The problem is that the recovery request was only being cleared when the firmware found a good image, not after a failed attempt was ignored. BUG=chromium-os:17846 TEST=see bug for manual test procedure Change-Id: I4c6b026bef477839def9bf2b0fed626a9922650f Reviewed-on: http://gerrit.chromium.org/gerrit/4352 Reviewed-by: Stefan Reinauer Tested-by: Randall Spangler --- firmware/lib/vboot_api_kernel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index ea184a535d..03ea188697 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -478,6 +478,10 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) { } else { VBDEBUG(("VbBootDeveloper() - no kernel found on USB\n")); VbExBeep(DEV_DELAY_INCREMENT, 400); + /* Clear recovery requests from failed kernel loading, so + * that powering off at this point doesn't put us into + * recovery mode. */ + VbSetRecoveryRequest(VBNV_RECOVERY_NOT_REQUESTED); } break; default: @@ -543,6 +547,11 @@ VbError_t VbBootRecovery(VbCommonParams* cparams, LoadKernelParams* p) { VBDEBUG(("VbBootRecovery() attempting to load kernel\n")); retval = VbTryLoadKernel(cparams, p, VB_DISK_FLAG_REMOVABLE); + /* Clear recovery requests from failed kernel loading, since we're + * already in recovery mode. Do this now, so that powering off after + * inserting an invalid disk doesn't leave us stuck in recovery mode. */ + VbSetRecoveryRequest(VBNV_RECOVERY_NOT_REQUESTED); + if (VBERROR_SUCCESS == retval) break; /* Found a recovery kernel */ else if (VBERROR_TRY_LOAD_REBOOT == retval) @@ -642,10 +651,6 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams, kparams->bootloader_size = (uint32_t)p.bootloader_size; Memcpy(kparams->partition_guid, p.partition_guid, sizeof(kparams->partition_guid)); - - /* Since we did find something to boot, clear recovery request, if any, - * resulting from disk checks during developer or recovery mode. */ - VbSetRecoveryRequest(VBNV_RECOVERY_NOT_REQUESTED); } if (vnc.raw_changed)