From 8e3b064430300bba4ef15e99ddcda3d861e8e264 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Tue, 19 Apr 2016 12:09:30 -0400 Subject: Coreboot, vboot and depthcharge updates to Coreboot 4.3 for CrOS devices Signed-off-by: Paul Kocialkowski --- (limited to 'resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy') diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch new file mode 100644 index 0000000..53fc563 --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch @@ -0,0 +1,33 @@ +From fe4c243dac0d308746c0103aa22b5e6f29dd494c Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Mon, 10 Aug 2015 20:33:23 +0200 +Subject: [PATCH 1/7] firmware: Developer mode timeout delay shortening (down + to 3 seconds) + +A timeout delay of 3 seconds, with no bip, is much more appreciable for users. + +Signed-off-by: Paul Kocialkowski +--- + firmware/lib/vboot_audio.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/firmware/lib/vboot_audio.c b/firmware/lib/vboot_audio.c +index 6071b0d..fd03bfd 100644 +--- a/firmware/lib/vboot_audio.c ++++ b/firmware/lib/vboot_audio.c +@@ -30,11 +30,7 @@ + #define MAX_CUSTOM_DELAY 300000 + + /* These are visible externally only to make testing easier */ +-VbDevMusicNote default_notes_[] = { {20000, 0}, /* 20 seconds */ +- {250, 400}, /* two beeps */ +- {250, 0}, +- {250, 400}, +- {9250, 0} }; /* total 30 seconds */ ++VbDevMusicNote default_notes_[] = { {3000, 0} }; /* three seconds */ + uint32_t default_count_ = sizeof(default_notes_) / sizeof(VbDevMusicNote); + + VbDevMusicNote short_notes_[] = { {2000, 0} }; /* two seconds */ +-- +2.8.0 + diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0002-firmware-Text-based-screen-display-in-priority.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0002-firmware-Text-based-screen-display-in-priority.patch new file mode 100644 index 0000000..669e6de --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0002-firmware-Text-based-screen-display-in-priority.patch @@ -0,0 +1,39 @@ +From b3b529bec8f07557632510663a350f6d2abbe742 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Mon, 10 Aug 2015 22:44:50 +0200 +Subject: [PATCH 2/7] firmware: Text-based screen display in priority + +This allows showing text-based screen displays before looking at the GBB bitmaps +since those encourage the use of non-free software (Chrome OS) and don't display +enough information to the user. + +Signed-off-by: Paul Kocialkowski +--- + firmware/lib/vboot_display.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c +index f2978fb..b95a1eb 100644 +--- a/firmware/lib/vboot_display.c ++++ b/firmware/lib/vboot_display.c +@@ -339,13 +339,12 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, + /* Request the screen */ + disp_current_screen = screen; + +- /* Look in the GBB first */ +- if (VBERROR_SUCCESS == VbDisplayScreenFromGBB(cparams, screen, +- vncptr, locale)) ++ /* Display default first */ ++ if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale)) + return VBERROR_SUCCESS; + +- /* If screen wasn't in the GBB bitmaps, fall back to a default */ +- return VbExDisplayScreen(screen, locale); ++ /* If default doesn't have anything to show, fall back to GBB bitmaps */ ++ return VbDisplayScreenFromGBB(cparams, screen, vncptr, locale); + } + + VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, +-- +2.8.0 + diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0003-firmware-NV-context-pointer-handoff-to-VbExDisplaySc.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0003-firmware-NV-context-pointer-handoff-to-VbExDisplaySc.patch new file mode 100644 index 0000000..c82c546 --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0003-firmware-NV-context-pointer-handoff-to-VbExDisplaySc.patch @@ -0,0 +1,91 @@ +From 948b65615a4e84baa5862633e13705d1f283f0db Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Mon, 10 Aug 2015 22:46:43 +0200 +Subject: [PATCH 3/7] firmware: NV context pointer handoff to VbExDisplayScreen + +VbExDisplayScreen might need to display some information based on the NV context +so it makes sense to pass that pointer along. + +Signed-off-by: Paul Kocialkowski +--- + firmware/include/vboot_api.h | 4 +++- + firmware/lib/vboot_display.c | 4 ++-- + firmware/stub/vboot_api_stub.c | 3 ++- + tests/vboot_api_devmode_tests.c | 3 ++- + 4 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h +index ddc8cc6..c98fca4 100644 +--- a/firmware/include/vboot_api.h ++++ b/firmware/include/vboot_api.h +@@ -24,6 +24,7 @@ + #include + #include + ++#include "vboot_nvstorage.h" + #include "gpt.h" + + /*****************************************************************************/ +@@ -771,7 +772,8 @@ VbError_t VbExDisplaySetDimension(uint32_t width, uint32_t height); + * to be simple ASCII text such as "NO GOOD" or "INSERT"; these screens should + * only be seen during development. + */ +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale); ++VbError_t VbExDisplayScreen(uint32_t screen_type, VbNvContext *vnc, ++ uint32_t locale); + + /** + * Write an image to the display, with the upper left corner at the specified +diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c +index b95a1eb..472ca91 100644 +--- a/firmware/lib/vboot_display.c ++++ b/firmware/lib/vboot_display.c +@@ -340,7 +340,7 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, + disp_current_screen = screen; + + /* Display default first */ +- if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale)) ++ if (VBERROR_SUCCESS == VbExDisplayScreen(screen, vncptr, locale)) + return VBERROR_SUCCESS; + + /* If default doesn't have anything to show, fall back to GBB bitmaps */ +@@ -357,7 +357,7 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, + VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale); + + if (gbb->bmpfv_size == 0) { +- VbError_t ret = VbExDisplayScreen(screen, locale); ++ VbError_t ret = VbExDisplayScreen(screen, vncptr, locale); + + /* Keep track of the currently displayed screen */ + if (ret == VBERROR_SUCCESS) +diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c +index 2299a03..9c86fc7 100644 +--- a/firmware/stub/vboot_api_stub.c ++++ b/firmware/stub/vboot_api_stub.c +@@ -43,7 +43,8 @@ VbError_t VbExDisplaySetDimension(uint32_t width, uint32_t height) + return VBERROR_SUCCESS; + } + +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) ++VbError_t VbExDisplayScreen(uint32_t screen_type, VbNvContext *vnc, ++ uint32_t locale) + { + return VBERROR_SUCCESS; + } +diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c +index cd927a8..16abc6e 100644 +--- a/tests/vboot_api_devmode_tests.c ++++ b/tests/vboot_api_devmode_tests.c +@@ -265,7 +265,8 @@ VbError_t VbExBeep(uint32_t msec, uint32_t frequency) { + return beep_return; + } + +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) { ++VbError_t VbExDisplayScreen(uint32_t screen_type, VbNvContext *vnc, ++ uint32_t locale) { + switch(screen_type) { + case VB_SCREEN_BLANK: + VBDEBUG(("VbExDisplayScreen(BLANK)\n")); +-- +2.8.0 + diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0004-firmware-Hold-key-combination-in-developer-mode.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0004-firmware-Hold-key-combination-in-developer-mode.patch new file mode 100644 index 0000000..1a7db50 --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0004-firmware-Hold-key-combination-in-developer-mode.patch @@ -0,0 +1,49 @@ +From 1c60b7224562b50a9aef90d533cdfd918dced867 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Mon, 10 Aug 2015 22:59:50 +0200 +Subject: [PATCH 4/7] firmware: Hold key combination in developer mode + +This binds the Ctrl + H key combination to hold the developer mode screen. + +Signed-off-by: Paul Kocialkowski +--- + firmware/lib/vboot_api_kernel.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index fff3056..5e784eb 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -292,6 +292,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + uint32_t use_legacy = 0; + uint32_t default_boot = 0; + uint32_t ctrl_d_pressed = 0; ++ uint32_t hold = 0; + + VbAudioContext *audio = 0; + +@@ -417,6 +418,12 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + ctrl_d_pressed = 1; + goto fallout; + break; ++ case 0x08: ++ /* Ctrl+H = hold */ ++ VBDEBUG(("VbBootDeveloper() - " ++ "hold developer mode screen\n")); ++ hold = 1; ++ break; + case 0x0c: + VBDEBUG(("VbBootDeveloper() - " + "user pressed Ctrl+L; Try legacy boot\n")); +@@ -467,7 +474,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + VbCheckDisplayKey(cparams, key, &vnc); + break; + } +- } while(VbAudioLooping(audio)); ++ } while(hold || VbAudioLooping(audio)); + + fallout: + +-- +2.8.0 + diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0005-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0005-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch new file mode 100644 index 0000000..152aee8 --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0005-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch @@ -0,0 +1,55 @@ +From 5f41175ef44c71f2aa3e3bebd33a079c93f60a5f Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Mon, 10 Aug 2015 23:13:49 +0200 +Subject: [PATCH 5/7] firmware: Screen blank and wait at disabled USB boot + warning + +This blanks the screen before showing the disabled USB boot warning. +It also waits for the user to press any key to come back to the developer mode +screen. + +Signed-off-by: Paul Kocialkowski +--- + firmware/lib/vboot_api_kernel.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index 5e784eb..7d22c93 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -320,6 +320,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + use_usb = 0; + } + ++developer_mode_screen: + /* Show the dev mode warning screen */ + VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_WARNING, 0, &vnc); + +@@ -442,14 +443,23 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + if (!allow_usb) { + VBDEBUG(("VbBootDeveloper() - " + "USB booting is disabled\n")); ++ ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, ++ &vnc); ++ + VbExDisplayDebugInfo( + "WARNING: Booting from external media " + "(USB/SD) has not been enabled. Refer " + "to the developer-mode documentation " +- "for details.\n"); ++ "for details.\n\n" ++ "Press any key to continue.\n\n"); + VbExBeep(120, 400); + VbExSleepMs(120); + VbExBeep(120, 400); ++ ++ while (!VbExKeyboardRead()) ; ++ ++ goto developer_mode_screen; + } else { + /* + * Clear the screen to show we get the Ctrl+U +-- +2.8.0 + diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0006-firmware-Separate-screen-and-wait-at-device-informat.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0006-firmware-Separate-screen-and-wait-at-device-informat.patch new file mode 100644 index 0000000..52f77d1 --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0006-firmware-Separate-screen-and-wait-at-device-informat.patch @@ -0,0 +1,79 @@ +From 4be2a60b0ebb845c8f5043ef3f27b691a51df7c2 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Mon, 10 Aug 2015 23:53:48 +0200 +Subject: [PATCH 6/7] firmware: Separate screen and wait at device information + screen + +This blanks the screen (instead of redrawing it) at device information and +waits for the user to press any key to come back to the developer mode screen. + +Signed-off-by: Paul Kocialkowski +--- + firmware/lib/vboot_api_kernel.c | 12 ++++++++++++ + firmware/lib/vboot_display.c | 13 ++++++++----- + 2 files changed, 20 insertions(+), 5 deletions(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index 7d22c93..4e6de18 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -425,6 +425,18 @@ developer_mode_screen: + "hold developer mode screen\n")); + hold = 1; + break; ++ case 0x09: ++ /* Ctrl+I = device information */ ++ VBDEBUG(("VbBootDeveloper() - " ++ "device info\n")); ++ ++ hold = 1; ++ VbDisplayDebugInfo(cparams, &vnc); ++ ++ while (!VbExKeyboardRead()) ; ++ ++ goto developer_mode_screen; ++ break; + case 0x0c: + VBDEBUG(("VbBootDeveloper() - " + "user pressed Ctrl+L; Try legacy boot\n")); +diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c +index 472ca91..e092189 100644 +--- a/firmware/lib/vboot_display.c ++++ b/firmware/lib/vboot_display.c +@@ -541,7 +541,7 @@ const char *RecoveryReasonString(uint8_t code) + return "We have no idea what this means"; + } + +-#define DEBUG_INFO_SIZE 512 ++#define DEBUG_INFO_SIZE 768 + + VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + { +@@ -556,8 +556,8 @@ VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + VbError_t ret; + uint32_t i; + +- /* Redisplay current screen to overwrite any previous debug output */ +- VbDisplayScreen(cparams, disp_current_screen, 1, vncptr); ++ /* Blank screen */ ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, vncptr); + + /* Add hardware ID */ + VbRegionReadHWID(cparams, hwid, sizeof(hwid)); +@@ -666,8 +666,11 @@ VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + used += StrnAppend(buf + used, sha1sum, DEBUG_INFO_SIZE - used); + } + +- /* Make sure we finish with a newline */ +- used += StrnAppend(buf + used, "\n", DEBUG_INFO_SIZE - used); ++ /* Make sure we finish with newlines */ ++ used += StrnAppend(buf + used, "\n\n", DEBUG_INFO_SIZE - used); ++ ++ used += StrnAppend(buf + used, "Press any key to continue\n\n", ++ DEBUG_INFO_SIZE - used); + + /* TODO: add more interesting data: + * - Information on current disks */ +-- +2.8.0 + diff --git a/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0007-firmware-Localization-keys-removal.patch b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0007-firmware-Localization-keys-removal.patch new file mode 100644 index 0000000..770f4c1 --- /dev/null +++ b/resources/libreboot/patch/vboot/933c4e7aa4b873f0ad9cd4c348a1ea4f37f66aa7/depthcharge/veyron_speedy/0007-firmware-Localization-keys-removal.patch @@ -0,0 +1,53 @@ +From ed1da3f76c1c19f9e078d0a19bac06151d5988d6 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Tue, 11 Aug 2015 00:07:18 +0200 +Subject: [PATCH 7/7] firmware: Localization keys removal + +Since we're using a text-based interface, binding the arrow keys to localization +changes has no effect and only makes the screen flicker. + +Signed-off-by: Paul Kocialkowski +--- + firmware/lib/vboot_api_kernel.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index 4e6de18..62efd0f 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -263,7 +263,6 @@ int VbUserConfirms(VbCommonParams *cparams, uint32_t confirm_flags) + return 1; + } + } +- VbCheckDisplayKey(cparams, key, &vnc); + } + VbExSleepMs(CONFIRM_KEY_DELAY); + } +@@ -493,7 +492,6 @@ developer_mode_screen: + break; + default: + VBDEBUG(("VbBootDeveloper() - pressed key %d\n", key)); +- VbCheckDisplayKey(cparams, key, &vnc); + break; + } + } while(hold || VbAudioLooping(audio)); +@@ -557,7 +555,6 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + VbDisplayScreen(cparams, VB_SCREEN_OS_BROKEN, 0, &vnc); + VBDEBUG(("VbBootRecovery() waiting for manual recovery\n")); + while (1) { +- VbCheckDisplayKey(cparams, VbExKeyboardRead(), &vnc); + if (VbWantShutdown(cparams->gbb->flags)) + return VBERROR_SHUTDOWN_REQUESTED; + VbExSleepMs(REC_KEY_DELAY); +@@ -655,8 +652,6 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + i = 4; + break; + } +- } else { +- VbCheckDisplayKey(cparams, key, &vnc); + } + if (VbWantShutdown(cparams->gbb->flags)) + return VBERROR_SHUTDOWN_REQUESTED; +-- +2.8.0 + -- cgit v0.9.1