summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_api_kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/lib/vboot_api_kernel.c')
-rw-r--r--firmware/lib/vboot_api_kernel.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index c5e97dd7..11ff828e 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -406,7 +406,6 @@ VbError_t VbBootNormal(VbCommonParams* cparams, LoadKernelParams* p) {
}
-#ifdef BUILD_FVDEVELOPER
/* Developer mode delays. All must be multiples of DEV_DELAY_INCREMENT */
#define DEV_DELAY_INCREMENT 250 /* Delay each loop, in msec */
#define DEV_DELAY_BEEP1 20000 /* Beep for first time at this time */
@@ -479,8 +478,6 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
return VbTryLoadKernel(cparams, p, VB_DISK_FLAG_FIXED);
}
-#endif /* BUILD_FVDEVELOPER */
-
/* Delay between disk checks in recovery mode */
#define REC_DELAY_INCREMENT 250
@@ -557,7 +554,7 @@ VbError_t VbBootRecovery(VbCommonParams* cparams, LoadKernelParams* p) {
VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams,
VbSelectAndLoadKernelParams* kparams) {
VbSharedDataHeader* shared = (VbSharedDataHeader*)cparams->shared_data_blob;
- VbError_t retval;
+ VbError_t retval = VBERROR_SUCCESS;
LoadKernelParams p;
VBDEBUG(("VbSelectAndLoadKernel() start\n"));
@@ -587,23 +584,39 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams,
if (shared->flags & VBSD_BOOT_DEV_SWITCH_ON)
p.boot_flags |= BOOT_FLAG_DEVELOPER;
+ /* Handle separate normal and developer firmware builds. */
+#if defined(VBOOT_FIRMWARE_TYPE_NORMAL)
+ /* Normal-type firmware always acts like the dev switch is off. */
+ p.boot_flags &= ~BOOT_FLAG_DEVELOPER;
+#elif defined(VBOOT_FIRMWARE_TYPE_DEVELOPER)
+ /* Developer-type firmware fails if the dev switch is off. */
+ if (!(p.boot_flags & BOOT_FLAG_DEVELOPER)) {
+ /* Dev firmware should be signed with a key that only verifies
+ * when the dev switch is on, so we should never get here. */
+ VBDEBUG(("Developer firmware called with dev switch off!\n"));
+ VbSetRecoveryRequest(VBNV_RECOVERY_RW_DEV_MISMATCH);
+ retval = 1;
+ }
+#else
+ /* Recovery firmware, or merged normal+developer firmware. No
+ * need to override flags. */
+#endif
+
/* Select boot path */
- if (shared->recovery_reason) {
+ if (VBERROR_SUCCESS != retval) {
+ /* Failure during setup; don't attempt booting a kernel */
+ } else if (shared->recovery_reason) {
/* Recovery boot */
p.boot_flags |= BOOT_FLAG_RECOVERY;
retval = VbBootRecovery(cparams, &p);
VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0);
- } else {
- /* TODO: vboot compiler define for developer mode; this is the H2C one */
-#ifdef BUILD_FVDEVELOPER
+ } else if (p.boot_flags & BOOT_FLAG_DEVELOPER) {
/* Developer boot */
- p.boot_flags |= BOOT_FLAG_DEV_FIRMWARE;
retval = VbBootDeveloper(cparams, &p);
VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0);
-#else
+ } else {
/* Normal boot */
retval = VbBootNormal(cparams, &p);
-#endif
}
if (VBERROR_SUCCESS == retval) {