summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2015-05-08 23:00:16 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-12 01:17:23 +0000
commit0140cd2906b1107ef9ea60ed7a81f8cbdc9162f8 (patch)
treedeb1efd1cda51a9d88f11708050144876a38a4db
parent957b424c52d1cb0075f2a464e6845fcb59da41df (diff)
downloadvboot-stabilize-7060.B.tar.gz
vboot1: Condition default legacy boot on dev_boot_legacystabilize-7060.Bstabilize-7059.B
This patch fixes what I think is an inconsistency in the existing legacy boot behavior: when the GBB flag that defaults to legacy boot is set, running out the 30 second timer would still boot legacy mode even if dev_boot_legacy is not actually set (whereas pressing CTRL+L in the same configuration would beep and refuse). This patch makes both legacy boot trgiggers check the same condition before boot. This does not restrict functionality since anyone who sets the DEFAULT_DEV_BOOT_LEGACY GBB flag could simply set FORCE_DEV_BOOT_LEGACY at the same time. It does however open up an interesting new use case of using NVRAM to change back-and-forth between legacy and normal developer mode (after GBB flags are changed once and write-protection is enabled again). If this is updated in the field it might lock existing devices out of legacy mode... however, since by far the most common GBB flag combination recommended on the internet seems to be 0x489 (including FORCE_DEV_BOOT_LEGACY), I doubt this would be a problem in practice. BRANCH=tbd BUG=chrome-os-partner:39999 TEST=Booted with GBB flags 0x4b9 and 0x439, observed difference. Change-Id: If6a6d99ab2cf116db2237fdc3df97fc22a68251c Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270182 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--firmware/lib/vboot_api_kernel.c2
-rw-r--r--tests/vboot_api_kernel2_tests.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index d01160af..fc6df72e 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -437,7 +437,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
if ((gbb->flags & GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY) &&
!ctrl_d_pressed) {
VBDEBUG(("VbBootDeveloper() - defaulting to legacy\n"));
- VbTryLegacy(1);
+ VbTryLegacy(allow_legacy);
}
/* Timeout or Ctrl+D; attempt loading from fixed disk */
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 3070baea..fe0a46a7 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -288,7 +288,8 @@ static void VbBootDevTest(void)
/* Proceed to legacy after timeout if GBB flag set */
ResetMocks();
- gbb.flags |= GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY;
+ gbb.flags |= GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY |
+ GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
TEST_EQ(VbBootDeveloper(&cparams, &lkp), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 1, " try legacy");