summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2011-12-20 14:11:22 -0800
committerStefan Reinauer <reinauer@chromium.org>2011-12-20 14:49:28 -0800
commit556aa0c7893a4a73f7b2fbfcc43f4ad1924c85d6 (patch)
tree81b6e1da3efd3ce99832cc79511856cb39638afc
parent59bcc6a23ac0beea5af8f71579f0b2540d0f696a (diff)
downloadvboot-556aa0c7893a4a73f7b2fbfcc43f4ad1924c85d6.tar.gz
Add VB_INIT_OUT_ENABLE_ALTERNATE_OS flag
This adds a flag to the list of values returned by VbInit(). When this flag is set, the BIOS may be asked to boot something other than ChromeOS. If this requires some sort of special preparation, the BIOS should do it. BUG=chromium-os:22454 TEST=none There is no test for this. It requires a change to the BIOS in order to do anything differently, and we haven't yet decided whether the BIOS should pay attention to it. Reviewed-on: https://gerrit.chromium.org/gerrit/11714 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 0d11efb0dc1d8d2b5eafdd5b65bce82e73fdeecc) Change-Id: I9507fad6486a3304a45067d8b51a99708e15bbff Reviewed-on: https://gerrit.chromium.org/gerrit/13258 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org>
-rw-r--r--firmware/include/gbb_header.h6
-rw-r--r--firmware/include/vboot_api.h2
-rw-r--r--firmware/lib/vboot_api_init.c16
-rw-r--r--firmware/lib/vboot_api_kernel.c7
4 files changed, 22 insertions, 9 deletions
diff --git a/firmware/include/gbb_header.h b/firmware/include/gbb_header.h
index 6a0b65fb..7f9b0005 100644
--- a/firmware/include/gbb_header.h
+++ b/firmware/include/gbb_header.h
@@ -38,9 +38,11 @@
/* BIOS should load option ROMs from arbitrary PCI devices. We'll never enable
* this ourselves because it executes non-verified code, but if a customer wants
* to void their warranty and set this flag in the read-only flash, they should
- * be able to do so.
- */
+ * be able to do so. */
#define GBB_FLAG_LOAD_OPTION_ROMS 0x00000002
+/* The factory flow may need the BIOS to boot a non-ChromeOS kernel if the
+ * dev-switch is on. This flag allows that. */
+#define GBB_FLAG_ENABLE_ALTERNATE_OS 0x00000004
#ifdef __cplusplus
extern "C" {
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index ffc0c412..b9f9f4a6 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -186,6 +186,8 @@ typedef struct VbCommonParams {
#define VB_INIT_OUT_S3_DEBUG_BOOT 0x00000010
/* BIOS should load any PCI option ROMs it finds, not just internal video */
#define VB_INIT_OUT_ENABLE_OPROM 0x00000020
+/* BIOS may be asked to boot something other than ChromeOS */
+#define VB_INIT_OUT_ENABLE_ALTERNATE_OS 0x00000040
/* Data only used by VbInit() */
diff --git a/firmware/lib/vboot_api_init.c b/firmware/lib/vboot_api_init.c
index 7fa488ae..f8c74909 100644
--- a/firmware/lib/vboot_api_init.c
+++ b/firmware/lib/vboot_api_init.c
@@ -22,6 +22,7 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) {
uint32_t recovery = VBNV_RECOVERY_NOT_REQUESTED;
int is_s3_resume = 0;
uint32_t s3_debug_boot = 0;
+ uint32_t user_enabled_custom_os = 0;
VBDEBUG(("VbInit() input flags 0x%x\n", iparams->flags));
@@ -105,12 +106,27 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) {
iparams->out_flags |= (VB_INIT_OUT_CLEAR_RAM |
VB_INIT_OUT_ENABLE_DISPLAY |
VB_INIT_OUT_ENABLE_USB_STORAGE);
+ /* ... which could include custom OSes */
+ VbNvGet(&vnc, VBNV_DEV_BOOT_CUSTOM, &user_enabled_custom_os);
+ if (user_enabled_custom_os)
+ iparams->out_flags |= VB_INIT_OUT_ENABLE_ALTERNATE_OS;
+ } else {
+ /* Normal mode, so disable dev_boot_* flags. This ensures they will be
+ * initially disabled if the user later transitions back into developer
+ * mode. */
+ VbNvSet(&vnc, VBNV_DEV_BOOT_USB, 0);
+ VbNvSet(&vnc, VBNV_DEV_BOOT_CUSTOM, 0);
}
/* Allow BIOS to load arbitrary option ROMs? */
if (gbb->flags & GBB_FLAG_LOAD_OPTION_ROMS)
iparams->out_flags |= VB_INIT_OUT_ENABLE_OPROM;
+ /* The factory may need to boot custom OSes whenever the dev-switch is on */
+ if ((gbb->flags & GBB_FLAG_ENABLE_ALTERNATE_OS) &&
+ (iparams->flags & VB_INIT_FLAG_DEV_SWITCH_ON))
+ iparams->out_flags |= VB_INIT_OUT_ENABLE_ALTERNATE_OS;
+
/* copy current recovery reason to shared data */
shared->recovery_reason = (uint8_t)recovery;
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 52bcacc7..6715e86f 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -105,13 +105,6 @@ uint32_t VbTryLoadKernel(VbCommonParams* cparams, LoadKernelParams* p,
/* Handle a normal boot. */
VbError_t VbBootNormal(VbCommonParams* cparams, LoadKernelParams* p) {
-
- /* Force dev_boot_* flags disabled. This ensures they will be
- * initially disabled if the user later transitions back into
- * developer mode. */
- VbNvSet(&vnc, VBNV_DEV_BOOT_USB, 0);
- VbNvSet(&vnc, VBNV_DEV_BOOT_CUSTOM, 0);
-
/* Boot from fixed disk only */
return VbTryLoadKernel(cparams, p, VB_DISK_FLAG_FIXED);
}