summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/include/gbb_header.h4
-rw-r--r--firmware/lib/vboot_api_kernel.c20
-rwxr-xr-xscripts/image_signing/set_gbb_flags.sh2
3 files changed, 24 insertions, 2 deletions
diff --git a/firmware/include/gbb_header.h b/firmware/include/gbb_header.h
index f490bb01..8a215106 100644
--- a/firmware/include/gbb_header.h
+++ b/firmware/include/gbb_header.h
@@ -55,6 +55,10 @@
#define GBB_FLAG_FORCE_DEV_BOOT_LEGACY 0x00000080
/* Allow booting using alternate keys for FAFT servo testing */
#define GBB_FLAG_FAFT_KEY_OVERIDE 0x00000100
+/* Disable EC software sync */
+#define GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC 0x00000200
+/* Default to booting legacy OS when dev screen times out */
+#define GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY 0x00000400
#ifdef __cplusplus
extern "C" {
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index cb9722a3..82b9a613 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -158,7 +158,7 @@ VbError_t VbBootNormal(VbCommonParams* cparams, LoadKernelParams* p) {
VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
GoogleBinaryBlockHeader* gbb = (GoogleBinaryBlockHeader*)cparams->gbb_data;
VbSharedDataHeader* shared = (VbSharedDataHeader*)cparams->shared_data_blob;
- uint32_t allow_usb = 0, allow_legacy = 0;
+ uint32_t allow_usb = 0, allow_legacy = 0, ctrl_d_pressed = 0;
VbAudioContext* audio = 0;
VBDEBUG(("Entering %s()\n", __func__));
@@ -230,6 +230,7 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
case 0x04:
/* Ctrl+D = dismiss warning; advance to timeout */
VBDEBUG(("VbBootDeveloper() - user pressed Ctrl+D; skip delay\n"));
+ ctrl_d_pressed = 1;
goto fallout;
break;
case 0x0c:
@@ -286,6 +287,19 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
} while( VbAudioLooping(audio) );
fallout:
+
+ /* If defaulting to legacy boot, try that unless Ctrl+D was pressed */
+ if ((gbb->flags & GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY) &&
+ !ctrl_d_pressed) {
+ VBDEBUG(("VbBootDeveloper() - defaulting to legacy\n"));
+ VbExLegacy();
+
+ /* If that fails, beep and fall through to fixed disk */
+ VbExBeep(120, 400);
+ VbExSleepMs(120);
+ VbExBeep(120, 400);
+ }
+
/* Timeout or Ctrl+D; attempt loading from fixed disk */
VBDEBUG(("VbBootDeveloper() - trying fixed disk\n"));
VbAudioClose(audio);
@@ -598,6 +612,7 @@ VbError_t VbEcSoftwareSync(VbCommonParams* cparams) {
VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams,
VbSelectAndLoadKernelParams* kparams) {
VbSharedDataHeader* shared = (VbSharedDataHeader*)cparams->shared_data_blob;
+ GoogleBinaryBlockHeader *gbb = (GoogleBinaryBlockHeader *)cparams->gbb_data;
VbError_t retval = VBERROR_SUCCESS;
LoadKernelParams p;
uint32_t tpm_status = 0;
@@ -616,7 +631,8 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams,
Memset(kparams->partition_guid, 0, sizeof(kparams->partition_guid));
/* Do EC software sync if necessary */
- if (shared->flags & VBSD_EC_SOFTWARE_SYNC) {
+ if (shared->flags & VBSD_EC_SOFTWARE_SYNC &&
+ !(gbb->flags & GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC)) {
retval = VbEcSoftwareSync(cparams);
if (retval != VBERROR_SUCCESS)
goto VbSelectAndLoadKernel_exit;
diff --git a/scripts/image_signing/set_gbb_flags.sh b/scripts/image_signing/set_gbb_flags.sh
index ac52432d..5469f1a0 100755
--- a/scripts/image_signing/set_gbb_flags.sh
+++ b/scripts/image_signing/set_gbb_flags.sh
@@ -31,6 +31,8 @@ GBBFLAGS_DESCRIPTION="
GBB_FLAG_ENTER_TRIGGERS_TONORM 0x00000040
GBB_FLAG_FORCE_DEV_BOOT_LEGACY 0x00000080
GBB_FLAG_FAFT_KEY_OVERIDE 0x00000100
+ GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC 0x00000200
+ GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY 0x00000400
To get a developer-friendly device, try 0x11 (short_delay + boot_usb).
For factory-related tests (always DEV), try 0x39.