Add indication to developer that dev_boot_usb is disabled

BUG=chrome-os-partner:5031
TEST=manual

1. crossystem dev_boot_usb=0
2. Boot with dev switch on and bootable USB device inserted
3. Press Tab.  Should show dev_boot_usb: 0
4. Press Ctrl+U.  Should beep twice

5. crossystem dev_boot_usb=1
6. Boot with dev switch on and nothing in USB/SD
7. Press Tab.  Should show dev_boot_usb: 1
8. Press Ctrl+U.  Should beep once

Change-Id: Ie9b73f86d68337b48c1b859c7c6d76fcb72d13c2
Reviewed-on: http://gerrit.chromium.org/gerrit/4312
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Randall Spangler
2011-07-19 09:45:00 -07:00
parent a185b8d8f6
commit 43101b4b50

View File

@@ -219,14 +219,13 @@ static VbError_t VbDisplayScreen(VbCommonParams* cparams, uint32_t screen,
return VbExDisplayScreen(screen);
}
#define DEBUG_INFO_SIZE 512
static VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key) {
/* Display debug info to the screen */
static VbError_t VbDisplayDebugInfo(VbCommonParams* cparams) {
VbSharedDataHeader* shared = (VbSharedDataHeader*)cparams->shared_data_blob;
GoogleBinaryBlockHeader* gbb = (GoogleBinaryBlockHeader*)cparams->gbb_data;
if ('\t' == key) {
/* Tab = display debug info */
char buf[DEBUG_INFO_SIZE] = "";
uint32_t used = 0;
uint32_t i;
@@ -246,9 +245,8 @@ static VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key) {
DEBUG_INFO_SIZE - used);
}
/* Add recovery request */
used += Strncat(buf + used, "\nrecovery_request: 0x",
DEBUG_INFO_SIZE - used);
/* Add recovery reason */
used += Strncat(buf + used, "\nrecovery_reason: 0x", DEBUG_INFO_SIZE - used);
used += Uint64ToString(buf + used, DEBUG_INFO_SIZE - used,
shared->recovery_reason, 16, 2);
@@ -265,6 +263,12 @@ static VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key) {
vnc.raw[i], 16, 2);
}
/* Add dev_boot_usb flag */
VbNvGet(&vnc, VBNV_DEV_BOOT_USB, &i);
used += Strncat(buf + used, "\ndev_boot_usb: ", DEBUG_INFO_SIZE - used);
used += Uint64ToString(buf + used, DEBUG_INFO_SIZE - used, i, 10, 0);
/* Make sure we finish with a newline */
used += Strncat(buf + used, "\n", DEBUG_INFO_SIZE - used);
/* TODO: add more interesting data:
@@ -280,6 +284,14 @@ static VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key) {
buf[DEBUG_INFO_SIZE - 1] = '\0';
VBDEBUG(("VbCheckDisplayKey() wants to show '%s'\n", buf));
return VbExDisplayDebugInfo(buf);
}
static VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key) {
if ('\t' == key) {
/* Tab = display debug info */
return VbDisplayDebugInfo(cparams);
} else if (VB_KEY_LEFT == key || VB_KEY_RIGHT == key) {
/* Arrow keys = change localization */
@@ -456,7 +468,9 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
VBDEBUG(("VbBootDeveloper() - user pressed Ctrl+U; try USB\n"));
if (!allow_usb) {
VBDEBUG(("VbBootDeveloper() - USB booting is disabled\n"));
VbExBeep(DEV_DELAY_INCREMENT, 400);
VbExBeep(DEV_DELAY_INCREMENT / 2, 400);
VbExSleepMs(DEV_DELAY_INCREMENT / 2);
VbExBeep(DEV_DELAY_INCREMENT / 2, 400);
} else if (VBERROR_SUCCESS ==
VbTryLoadKernel(cparams, p, VB_DISK_FLAG_REMOVABLE)) {
VBDEBUG(("VbBootDeveloper() - booting USB\n"));
@@ -573,6 +587,7 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams,
Memset(kparams->partition_guid, 0, sizeof(kparams->partition_guid));
/* Fill in params for calls to LoadKernel() */
Memset(&p, 0, sizeof(p));
p.shared_data_blob = cparams->shared_data_blob;
p.shared_data_size = cparams->shared_data_size;
p.gbb_data = cparams->gbb_data;