mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 02:35:22 +00:00
Ensure that the VGA is enabled/disabled as needed.
On some systems, we require the VGA option ROM to be loaded before VbInit() is called so we can display BIOS screens. If that hasn't happened, we request it and reboot. Alternatively, if we don't need the option ROM (normal mode) but we've already loaded it, we un-request it and reboot just in case there are security vulnerabilities that might be exposed. Not all systems need preloaded option ROMs. There is an additional input flag that indicates whether this matters or not. BUG=chrome-os-partner:8789 TEST=manual Using keyboard-based dev-mode, switch between normal and dev mode and back. It should work as expected. Change-Id: Id1d662014d47ab648c73db4b1647520801f3a0b8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27125 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -58,8 +58,6 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) {
|
||||
shared->flags |= VBSD_BOOT_S3_RESUME;
|
||||
if (iparams->flags & VB_INIT_FLAG_RO_NORMAL_SUPPORT)
|
||||
shared->flags |= VBSD_BOOT_RO_NORMAL_SUPPORT;
|
||||
if (iparams->flags & VB_INIT_FLAG_OPROM_LOADED)
|
||||
shared->flags |= VBSD_BOOT_OPROM_LOADED;
|
||||
|
||||
is_s3_resume = (iparams->flags & VB_INIT_FLAG_S3_RESUME ? 1 : 0);
|
||||
|
||||
@@ -205,12 +203,32 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) {
|
||||
VbNvGet(&vnc, VBNV_DEV_BOOT_SIGNED_ONLY, &require_official_os);
|
||||
if (!require_official_os)
|
||||
iparams->out_flags |= VB_INIT_OUT_ENABLE_ALTERNATE_OS;
|
||||
|
||||
/* Dev-mode needs the VGA option ROM to be loaded so it can display the
|
||||
* scary boot screen. If we don't have it, we need to request it and
|
||||
* reboot so it can be loaded. */
|
||||
if ((iparams->flags & VB_INIT_FLAG_OPROM_MATTERS) &&
|
||||
!(iparams->flags & VB_INIT_FLAG_OPROM_LOADED)) {
|
||||
VbNvSet(&vnc, VBNV_OPROM_NEEDED, 1);
|
||||
retval = VBERROR_VGA_OPROM_MISMATCH;
|
||||
VBDEBUG(("VbInit() needs oprom, doesn't have it\n"));
|
||||
}
|
||||
|
||||
} 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_SIGNED_ONLY, 0);
|
||||
|
||||
/* If we don't need the VGA option ROM but got it anyway, stop asking for
|
||||
* it and reboot in case there's some vulnerability in using it. */
|
||||
if ((iparams->flags & VB_INIT_FLAG_OPROM_MATTERS) &&
|
||||
(iparams->flags & VB_INIT_FLAG_OPROM_LOADED)) {
|
||||
VbNvSet(&vnc, VBNV_OPROM_NEEDED, 0);
|
||||
retval = VBERROR_VGA_OPROM_MISMATCH;
|
||||
VBDEBUG(("VbInit() has oprom, doesn't need it\n"));
|
||||
}
|
||||
}
|
||||
|
||||
VbInit_exit:
|
||||
|
||||
Reference in New Issue
Block a user