summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-04-06 18:04:44 -0700
committerChromeOS bot <3su6n15k.default@developer.gserviceaccount.com>2015-10-09 19:48:04 +0000
commitad65e3da6bb4a4cd00091ea961cd31e9ccf0536f (patch)
tree8ae3840de4082acac253c5b596062a433b83a9ac
parentca1d7d1fd18d91536318900dc199d7f337ad85ea (diff)
downloadvboot-ad65e3da6bb4a4cd00091ea961cd31e9ccf0536f.tar.gz
enable USB boot on transition to dev on some devices
Some Chrome OS devices do not allow to login even in developer mode, as they do not have display/keyboard and sshd is not part of the Chrome OS image. Even enabling developer mode on those devices is very involved (requires taking the device apart and is guaranteed to take long time). We still want to allow the end user to control those devices in dev mode. The solution is enabling the ability to boot from the USB stick when the device transitions from normal to developer mode. A simple way to do it is to set the NVRAM flag, which allows USB boot. The flag is set on normal=>dev transition only, and only on those devices where it is configured (as discovered by invoking VbExGetSwitches with the appropriate parameters). BRANCH=storm BUG=chrome-os-partner:38303 TEST=tested with the corresponding depthcharge patches Change-Id: I5fa58963256598cde3b534f5250101fba6042f8c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/264187 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/304118 Reviewed-by: Alexandru Stan <amstan@chromium.org> Commit-Queue: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
-rw-r--r--firmware/include/vboot_api.h3
-rw-r--r--firmware/lib/vboot_api_kernel.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index af61eedd..c28dbec9 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -230,6 +230,9 @@ typedef struct VbCommonParams {
/* Set when we are calling VbInit() before loading Option ROMs */
#define VB_INIT_FLAG_BEFORE_OPROM_LOAD 0x00002000
+/* Allow USB boot on transition to dev */
+#define VB_INIT_FLAG_ALLOW_USB_BOOT 0x00004000
+
/*
* Output flags for VbInitParams.out_flags. Used to indicate potential boot
* paths and configuration to the calling firmware early in the boot process,
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 784751ad..cefdbed6 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -41,6 +41,12 @@ static void VbSetRecoveryRequest(uint32_t recovery_request)
VbNvSet(&vnc, VBNV_RECOVERY_REQUEST, recovery_request);
}
+static void VbAllowUsbBoot(void)
+{
+ VBDEBUG(("%s\n", __func__));
+ VbNvSet(&vnc, VBNV_DEV_BOOT_USB, 1);
+}
+
/**
* Checks GBB flags against VbExIsShutdownRequested() shutdown request to
* determine if a shutdown is required.
@@ -587,6 +593,9 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p)
return VBERROR_TPM_SET_BOOT_MODE_STATE;
VBDEBUG(("%s() Reboot so it will take "
"effect\n", __func__));
+ if (VbExGetSwitches
+ (VB_INIT_FLAG_ALLOW_USB_BOOT))
+ VbAllowUsbBoot();
return VBERROR_TPM_REBOOT_REQUIRED;
case -1:
VBDEBUG(("%s() - Shutdown requested\n",