summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* vboot/ui: pass timer_disabled to vb2ex_display_ui()factory-puff-13329.BYu-Ping Wu2020-07-024-1/+12
| | | | | | | | | | | | | | | | | Add an argument 'timer_disabled' to vb2ex_display_ui(), which will be used when drawing dev mode screen to show the appropriate screen descriptions. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests TEST=emerge-puff depthcharge Cq-Depend: chromium:2236550 Change-Id: I48b46838f482bce612106b840476f5f941cc1166 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241492 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Allow building for non-CrOS environmentsPatrick Georgi2020-07-022-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's some code that is architecture specific, but looking at it, it's code for Chrome OS devices that just happens to be split along ISA lines. When building on systems that we don't ship crossystems integration for, these parts are replaced by stubs that always return error conditions, which allows building on unsupported ISA (such as POWER). The issue was reported at https://ticket.coreboot.org/issues/145 where a coreboot user wanted to build a vboot-enabled coreboot configuration (which builds futility for the signing part) on a POWER host system, which failed because we lack an implementation of the crossystem interfaces for POWER. BUG=none BRANCH=none TEST=Built upstream coreboot with a vboot-enabled target inside qemu-user-ppc64. Doing so works with these patches applied while it failed without them. Change-Id: I4aaeb56d4521c426a520bc9a1bb49497bec86c35 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2270096 Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: add screen stack functionalityJoel Kitching2020-06-306-214/+261
| | | | | | | | | | | | | | | | | | | | | | | | Add a stack storing previous screen states. When the user clicks "Back" or presses ESC, revert to the previous state. In order to deal with the possibility of a UI cycle (repeatedly selecting the same sequence of screens) which would eventually use up all available memory, re-use existing target screen states within the stack. In other words, when switching to a specific screen which already exists in the stack, pop until that screen is reached, rather than creating a duplicate stack entry. BUG=b:146399181, b:158256196 TEST=make clean && make runtests BRANCH=none Change-Id: I6fbebc2abb11b26d95d4fcf841eb195b3d589396 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2214617 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* firmware/2lib: Add visual/audio error handlingShelley Chen2020-06-277-11/+71
| | | | | | | | | | | | | | | | | | | | | | Adding an enum parameter to vb2ex_display_ui to facilitate printing errors to the screen. Currently, errors are only printed to the serial console. Also adding in beep if an error is displayed. BUG=b:144969091,b:158635317,b:158639298,b:146399181 BRANCH=None TEST=Boot into dev warning screen and try to hit ctrl-u when no USB is plugged in. Ensure error beep occurs. Ensure in dev mode. Boot into recovery and press ctrl-d. Ensure that error message is printed to the screen and beep occurs. make runtests Cq-Depend: chromium:2243513 Change-Id: I548d624532ad8816497c37a726275b33171e28dc Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2243196 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* vboot: add vb2api_phone_recovery_ui_enabled()stabilize-quickfix-13310.91.Bstabilize-quickfix-13310.76.Bstabilize-quickfix-13310.73.Bstabilize-13310.99.Bstabilize-13310.94.Bstabilize-13310.83.Bstabilize-13310.74.Bstabilize-13310.72.Brelease-R85-13310.BYu-Ping Wu2020-06-257-10/+50
| | | | | | | | | | | | | | | | | | Add a new flag VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_UI_DISABLED to vb2_secdata_kernel_flags to separate phone recovery functionality from UI instructions. Also add vb2api_phone_recovery_ui_enabled() to control the UI behavior. BRANCH=none BUG=b:156532222 TEST=make runtests Cq-Depend: chromium:2260155 Change-Id: Ib91a206e680ba2cb47762d8a5c0c0ce146918b7d Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2259632 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: add power off optionsYu-Ping Wu2020-06-232-6/+36
| | | | | | | | | | | | | | | Add power off options to screens. BRANCH=none BUG=b:146399181, b:145098577 TEST=make runtests TEST=USE="menu_ui" emerge-nami depthcharge Cq-Depend: chromium:2237367 Change-Id: I356c56361a4282b456c3a4661e518a84944e983b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237366 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: makeshift debug info screenJoel Kitching2020-06-212-1/+20
| | | | | | | | | | | | | | | | | | | Provide makeshift debug info functionality while implementation of the proper screen is in progress. BUG=b:146399181, b:144969088 TEST=Build and flash; check <TAB> functionality TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2253732 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I0a738f731361d1c344c8fc8f5ecdef5b892f5ba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2253733 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* vboot/ui: add screens for dev boot from external diskYu-Ping Wu2020-06-202-6/+52
| | | | | | | | | | | | | | | | | | | | | | | Add polling screens for booting from external disk in dev mode. BRANCH=none BUG=b:146399181, b:158973903 TEST=make runtests TEST=emerge-puff depthcharge TEST=1. Enter developer mode screen 2. Select "Boot from external disk", then screen changes to DEVELOPER_BOOT_EXTERNAL 3. Plug in invalid usb, then screen changes to DEVELOPER_INVALID_DISK 4. Unplug usb, then screen changes back to DEVELOPER_BOOT_EXTERNAL 5. Plug in valid usb, then device boots successfully Cq-Depend: chromium:2245066 Change-Id: I633f16ca0d92eaf27eb3b7630ee61b2044942741 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2246298 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: add missing assert.h includeDavid Benjamin2020-06-191-0/+1
| | | | | | | | | | | | BUG=none TEST=make BRANCH=none Signed-off-by: David Benjamin <davidben@chromium.org> Change-Id: I4193d01bf9e65aff1567d4d00ae38811b61ad4c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2252761 Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* host/lib/subprocess: replace constructor function & perror with VB2_DEBUGJack Rosenthal2020-06-181-13/+3
| | | | | | | | | | | | | | | | | | | | Currently this had perror to print the error message, but we can get rid of this and the constructor function reasonably if we switch to VB2_DEBUG. This was changed since the Loonix team cannot rely on glibc-specific behaviors, and passing argv to constructor functions is glibc-specific. See the notes on cl/316913250 for a little bit of background. BUG=none BRANCH=none TEST=unit tests Change-Id: I5de76306d5a8615fdc3afcfb772a2eb32557aa87 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2251039 Reviewed-by: Joel Kitching <kitching@chromium.org>
* crossystem: arm: reland nvstorage using flashromJack Rosenthal2020-06-181-4/+6
| | | | | | | | | | | | | | | | | | This relands CL:2218891, which was reverted as the "mkbp" case was forgotten, and lit all sorts of stuff on fire when the CQ skipped hardware tests and the lab was accidentally soaked in gasoline. The devices which this affected are re-enabled in the lab, the CQ is now configured to enable hardware tests, so let's land it again ;) BUG=chromium:1032351,chromium:1030473,chromium:789276 BRANCH=none TEST=On scarlet and nyan_kitty, read and write using crossystem Change-Id: Ife4d17eeca484a2784f7e2b2f7c22fef27b9d083 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2251049 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Add beep testsHsuan Ting Chen2020-06-181-23/+63
| | | | | | | | | | | | | | | | | | | | Add beep tests for testing the beep duration and frequency. BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ifb3231a43195e51900139a98ab2696cee244a009 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2249261 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Add tests for developer screensHsuan Ting Chen2020-06-181-23/+314
| | | | | | | | | | | | | | | | | | Unit tests paired with CL:2192863. BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I40bb9fbe111a1ab6e6123bc18af0753100bfb08b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228255 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: rename USB_BOOT_ON_DEV to BOOT_EXTERNAL_ON_DEVfactory-endeavour-13295.BYu-Ping Wu2020-06-174-7/+7
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=make runtests TEST=emerge-puff depthcharge Cq-Depend: chromium:2241263 Change-Id: I4ebfadda3a41c09662f241f04c251784716784e3 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241418 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: use trusted keypress in cancel TO_DEV testJoel Kitching2020-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | In order to ensure that the TO_DEV action function does not trigger TO_DEV confirmation for the PHYSICAL_PRESENCE_KEYBOARD=1 case, use trusted DOWN and ENTER keys to navigate and press the "Cancel" button. If this is erroneously picked up by the TO_DEV action function, then a transition to developer mode will occur. This hole in test coverage was discovered by CL:2234678. BUG=b:146399181 TEST=PHYSICAL_PRESENCE_KEYBOARD=0 make runtests TEST=PHYSICAL_PRESENCE_KEYBOARD=1 make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Id8db074e4e9398a2f7fbfe348059c2c195bc8d90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237088 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* crossystem - remove fmap_base utilityAaron Massey2020-06-163-14/+1
| | | | | | | | | | | | | | | | fmap_base utility no longer needed since b:157897361 BUG=chromium:1091253 BRANCH=none TEST=Compiled, cros_workon_make test, and cros deploy to kindred device to confirm there was no fmap_parameter. Change-Id: Idc89c82555531030beaf8f84ce483a5f49a86fbe Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241386 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* host/lib/flashrom: enable --fast-verify for write operationsJack Rosenthal2020-06-162-1/+31
| | | | | | | | | | | | | | | | | | | We caused a boot-speed regression as we are currently verifying the entire flash chip after any write. Flashrom has an option --fast-verify which verifies only the region written, which is significantly faster. It also looks like this is the way mosys used to handle flashrom writes, so we can align with the old behavior this way. BUG=chromium:1091903 BRANCH=none TEST=unit tests, and boot speed regression went away (on octopus) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: If8d2288cb0c08e8644b6e05f7b174c3c21542f94 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2242738 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: rename USB to more accurate EXTERNALYu-Ping Wu2020-06-1319-146/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename enumerators of the vb2_dev_default_boot_target enum as follows, because the term USB is not quite accurate (we can also boot from an SD card). VB2_DEV_DEFAULT_BOOT_TARGET_DISK --> VB2_DEV_DEFAULT_BOOT_TARGET_INTERNAL VB2_DEV_DEFAULT_BOOT_TARGET_USB --> VB2_DEV_DEFAULT_BOOT_TARGET_EXTERNAL Also perform similar renaming for the following. enum vb2_nv_param: VB2_NV_DEV_BOOT_USB --> VB2_NV_DEV_BOOT_EXTERNAL enum vb2_secdata_fwmp_flags: VB2_SECDATA_FWMP_DEV_ENABLE_USB --> VB2_SECDATA_FWMP_DEV_ENABLE_EXTERNAL constants: VB2_NV_DEV_FLAG_USB --> VB2_NV_DEV_FLAG_EXTERNAL functions: vb2_dev_boot_usb_allowed --> vb2_dev_boot_external_allowed BRANCH=none BUG=none TEST=make runtests Change-Id: Iad16fcf34d76da08c6d8a81e150c7fde927c743b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237622 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Revert "crossystem: arm: switch to VBNV using flashrom from mosys"Shik Chen2020-06-101-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9a923c7dba003a5ddbc55937469c975689effa62. Reason for revert: https://crbug.com/1093191 Original change's description: > crossystem: arm: switch to VBNV using flashrom from mosys > > Most ARM platforms will store VBNV in SPI flash by calling out to > mosys, which in turn calls out to flashrom. > > The set of parent CLs to this commit port this functionality from > mosys directly to vboot's host libraries. This CL switches to use the > new functionality. > > (The CL to switch is provided as a separate CL for ARM only so it's an > easy and clean revert should something go wrong.) > > BUG=chromium:1032351,chromium:1030473,chromium:789276 > BRANCH=none > TEST=On scarlet, read and write VBNV using crossystem > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Change-Id: I1949522b665170ebeb35f3c46177f1957980d6a3 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218891 > Reviewed-by: Joel Kitching <kitching@chromium.org> Bug: chromium:1032351, chromium:1030473, chromium:789276 Change-Id: I3ccb6c6653e24e61072ee9227e870a2f211cd114 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237617 Reviewed-by: Shik Chen <shik@chromium.org> Commit-Queue: Shik Chen <shik@chromium.org> Commit-Queue: Stimim Chen <stimim@chromium.org> Tested-by: Stimim Chen <stimim@chromium.org>
* vboot: add vb2api_use_short_dev_screen_delay() to 2api.hYu-Ping Wu2020-06-105-9/+31
| | | | | | | | | | | | | Add vb2api_use_short_dev_screen_delay() to vboot2 API. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests Change-Id: Ice4852a7505e8dba73fa2026e8d433b8e487f556 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2235292 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: publicize vb2_get_dev_boot_target()Yu-Ping Wu2020-06-1013-84/+109
| | | | | | | | | | | | | | | | Publicize vb2_get_dev_boot_target() as vb2api_get_dev_default_boot_target(), and move enum vb2_dev_default_boot to 2api.h as enum vb2_dev_default_boot_target. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests TEST=emerge-puff depthcharge Change-Id: I8336e63cc273c32a41e6b1f2aad886c3940a6aef Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2234788 Reviewed-by: Joel Kitching <kitching@chromium.org>
* crossystem: arm: switch to VBNV using flashrom from mosysstabilize-lazor-13278.BJack Rosenthal2020-06-091-4/+8
| | | | | | | | | | | | | | | | | | | | | Most ARM platforms will store VBNV in SPI flash by calling out to mosys, which in turn calls out to flashrom. The set of parent CLs to this commit port this functionality from mosys directly to vboot's host libraries. This CL switches to use the new functionality. (The CL to switch is provided as a separate CL for ARM only so it's an easy and clean revert should something go wrong.) BUG=chromium:1032351,chromium:1030473,chromium:789276 BRANCH=none TEST=On scarlet, read and write VBNV using crossystem Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1949522b665170ebeb35f3c46177f1957980d6a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218891 Reviewed-by: Joel Kitching <kitching@chromium.org>
* crossystem: x86: switch to VBNV backup using flashrom instead of mosysJack Rosenthal2020-06-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Previously, x86 platforms with vboot2 will backup VBNV in SPI flash using mosys, which will in turn execute flashrom to preform the underlying operation. The set of parent CLs to this commit port this functionality from mosys directly to vboot's host libraries. This CL switches to use the new functionality. (The CL to switch is provided as a separate CL for x86 only so it's an easy and clean revert should something go wrong.) BUG=chromium:1032351,chromium:1030473,chromium:789276 BRANCH=none TEST=On octupus, write VBNV using crossystem and manually inspect RW_NVRAM region in SPI flash. Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9f945dca99ebd394abea1490fa25d3763834bfa1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218890 Reviewed-by: Joel Kitching <kitching@chromium.org>
* crossystem: add functions to read and write VBNV via flashromJack Rosenthal2020-06-094-0/+396
| | | | | | | | | | | | | | | | | | | | This will replace the usage of "mosys nvram vboot {read,write}" on x86 platforms, and all ARM platforms except veyron (chromebooks only) and nyan_kitty (which use VBNV storage in the ChromeOS EC, deprecated for new platforms). These affected ARM devices will be going AUE sometime this summer, and we can expect to remove the mosys usage in crossystem later this year. The code to find the active VBNV in SPI flash was modeled to match the logic in mosys (see mosys/lib/vbnv/vbnv_flash.c). BUG=chromium:1032351,chromium:1030473,chromium:789276 BRANCH=none TEST=provided unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I4f42af2f9a6b0703302635f8d8ebb2d7599d9847 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218889
* host/lib: add lightweight flashrom wrapper libraryJack Rosenthal2020-06-095-0/+453
| | | | | | | | | | | | | | | | | | | | | | Lightweight wrapper around flashrom, exposing two APIs: flashrom_read(programmer, region, data_out, size_out) flashrom_write(programmer, region, data, size) |region| can be NULL, in which case operate on the whole flash chip. The intended usage of this wrapper library is to read/write VBNV from SPI flash directly, avoiding the call thru mosys (which has deprecated the command). Bringing this logic into crossystem directly will also help with expanding VBNV to 64-bytes. BUG=chromium:1032351,chromium:1030473,chromium:789276 BRANCH=none TEST=provided unit tests Change-Id: I3997bd03a2db7e58e4e76fc200c637dd3b5b20a4 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218888
* vboot: fix legacy_clamshell_tests when PHYSICAL_PRESENCE_KEYBOARD=1Joel Kitching2020-06-091-113/+126
| | | | | | | | | | | | | | | | | | Physical presence checks in VbUserConfirms are only invoked when PHYSICAL_PRESENCE_KEYBOARD=0. Disable these tests when PHYSICAL_PRESENCE_KEYBOARD=1. BUG=chromium:943150 TEST=PHYSICAL_PRESENCE_KEYBOARD=0 make runtests TEST=PHYSICAL_PRESENCE_KEYBOARD=1 make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I0c32913549a856855918c54378e5d265851abe37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237086 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* Revert "futility: Adds platform check quirk for zork"Rob Barnes2020-06-093-33/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8dac1697aef0114584d737e6a3027b55abdae5f0. Reason for revert: Case sensitivity was turned off in https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2192537. This quirk is no longer needed. It could result in accidental overwriting with incompatible firmware. Original change's description: > futility: Adds platform check quirk for zork > > Adds a quirk for futility on zork boards. > Zork boards before 13073 used lowercase for the firmware > names which causes the compatible platform check fail. > > This adds the disable_compatible_platform_check quirk and > enables it by default for zork boards. > > BUG=b:156119908, b:155941790 > TEST=flashed Google_trembyle.13066.0.0 using servo > chromeos-firmwareupdater --force > rebooted and confirmed Google_Trembyle.13073.0.0 was flashed > BRANCH=none > > Change-Id: I6fc6bf5bb42b725b5e7c9d0166f945b9c123bab4 > Signed-off-by: Rob Barnes <robbarnes@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2191089 > Reviewed-by: Edward Hill <ecgh@chromium.org> > Reviewed-by: Eric Peers <epeers@google.com> > Commit-Queue: Edward Hill <ecgh@chromium.org> Bug: b:156119908, b:155941790 Change-Id: I4688a380dbcd722e8875bf0b5331ecf797efd6a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2197277 Tested-by: Rob Barnes <robbarnes@google.com> Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Commit-Queue: Rob Barnes <robbarnes@google.com> Auto-Submit: Rob Barnes <robbarnes@google.com>
* futility: vb1_helper: Fix sanity size check for parsing kernel partitionJulius Werner2020-06-061-2/+4
| | | | | | | | | | | | | | vbutil_kernel --verify didn't check if the size of the kernel body fit the file it was in. Now it does. BRANCH=None BUG=None TEST=make runtests Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I9cdfd50bd70b72650cdc0fd62bf59a394746ad84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2225663 Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: updater: Add '--servo_port' to select from multiple servodsHung-Te Lin2020-06-063-15/+62
| | | | | | | | | | | | | | | | | | | | | | | When multiple servo boards are connected to the host, we usually want to select the right servo by specifying its port, get the servo serial number, and pass that to flashrom programmer. The new --servo_port (or environment variable SERVOD_PORT) now allows developers to flash firmware via specific servod using futility updater easily: futility update --servo_port 9998 -i PATH_TO/image.bin BRANCH=None BUG=None TEST=make runtest; sudo futility update --servo_port 9998 -i image.bin Change-Id: Ic302f841abf745801995ff233fc209726ed039c8 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228258 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Douglas Anderson <dianders@chromium.org>
* chromeos-tpm-recovery: Add support for v1 secdata_kernelJulius Werner2020-06-061-18/+71
| | | | | | | | | | | | | | | | | | | | The recent format changes to the kernel TPM NVRAM space weren't reflected in the chromeos-tpm-recovery utility yet. This patch fixes that. Since this may require upgrading from the old to the new format (or even the other way around), we also have to fix the longstanding limitation of not recreating TPM spaces for TPM 2.0. We still cannot do that for the firmware TPM space, but at least we can add it for the kernel one. BRANCH=none BUG=chromium:1020578,b:155149943 TEST=Ran on a Trogdor Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Iaf9bc6b29f76cfeaab90ae4f99099735c4f9441b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2227260 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Add tests for advanced optionsHsuan Ting Chen2020-06-051-0/+143
| | | | | | | | | | | | | | | | | | | Unit tests paired with CL:2186958. BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests BRANCH=none Cq-Depend: chromium:2228256 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ife471db3f1f2e945f1517e865b22cf0d0fdfe451 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2217549 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Split out screen testsHsuan Ting Chen2020-06-052-144/+275
| | | | | | | | | | | | | | | | | | | | | Split out screen tests with individual test items. Add three macros which record line numbers: DISPLAYED_EQ, DISPLAYED_PASS, and DISPLAYED_NO_EXTRA. BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I712e009658fecad66553423c2d05e8e7c9df7e08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228254 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Fix access on to_dev screenHsuan Ting Chen2020-06-041-1/+2
| | | | | | | | | | | | | | | Broken recovery mode should not access to_dev screen. BUG=b:146399181 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I3e5802c14968aafe40d25e69505c518c0c5b45d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228256 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: implement phone recovery screensJoel Kitching2020-06-012-5/+23
| | | | | | | | | | | | | | | | Finish implementing phone recovery screen step 1, and implement step 2. (Step 3 is in initramfs.) BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I3b18aa0d6c5ec93cb9b69fec7976db434270db79 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2220820 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: implement disk recovery screensYu-Ping Wu2020-06-011-4/+44
| | | | | | | | | | | | | Implement disk recovery screens for all the 3 steps. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Iea8fe4650cecb63ea519084ec8a71325ba4e3ebb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2211981 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: implement language selection screenYu-Ping Wu2020-06-017-71/+328
| | | | | | | | | | | | | | | | | | Implement language selection screen, and add language item to all the other screens. Add a default screen init function default_screen_init() to initialize the default selection to the second item if the first item is the language selection. BRANCH=none BUG=b:146399181, b:144968920 TEST=make runtests TEST=USE="menu_ui" emerge-nami depthcharge Cq-Depend: chromium:2193151, chromium:2192508 Change-Id: I3251b0095ec29ec26cc27745b1089e60894c892c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2196095 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Add tests for to_dev transition flowfirmware-endeavour-13259.BHsuan Ting Chen2020-05-303-32/+320
| | | | | | | | | | | | | | | | | Unit tests paired with CL:2168072. BUG=b:146399181, b:156448738 TEST=make clean && make runtests TEST=make clean && DETACHABLE=1; make runtests TEST=make clean && PHYSICAL_PRESENCE_KEYBOARD=1; make runtests BRANCH=none Cq-Depend: chromium:2214457 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ic6b109c514e1582d7eb29040135aeaa884b243be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2198274 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Synchronize mock inputs for vb2_ui_testsHsuan Ting Chen2020-05-301-26/+28
| | | | | | | | | | | | | | | | | | | | | | | | We have two different mock inputs currently, and soon to be three. Since the input-solving order should not be strictly defined, it is difficult to write complicated scenarios under current approach. We cannot make sure if the ui_loop implementation exits earlier and ignores certain mock inputs. This CL synchronizes mock inputs with an iteration counter. We can write detailed scenarios by assigning the inputs iter-by-iter. BUG=b:146399181, b:156448738 TEST=make clean && make runtests TEST=make clean && DETACHABLE=1; make runtests TEST=make clean && PHYSICAL_PRESENCE_KEYBOARD=1; make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ia839a6614eb0453b9f64075298a89a2db59d4070 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2217532 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot: have consistent output for testing macrosYu-Ping Wu2020-05-291-44/+39
| | | | | | | | | | | | | | Extract print_passed() and print_failed() from test_eq(), and use them consistently in all testing functions in test_common.h. BRANCH=none BUG=none TEST=make runtests Change-Id: I1d4dbf13c9ae1a8130ea7af2733044d0556fa974 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2217547 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: do not request recovery for VB2_REQUEST_* from VB2_TRY()Yu-Ping Wu2020-05-294-153/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the returned value is not an error (such as VB2_REQUEST_*), do not call vb2api_fail() from VB2_TRY() to request recovery. During EC sync, instead of explicitly setting VB2_NV_RECOVERY_REQUEST in nvdata to request recovery, utilize vb2api_fail() instead to try the other AP slot before giving up on EC sync and going into recovery. In addition, remove the retry of EC RO sync for the following reasons. EC sync rarely fails, and even if it does, it's not very likely to be a transient problem that disappears on the next attempt. Besides, the RO sync is just a debug feature that only people who have a servo attached and can manually reflash should be using. Therefore, the retry is removed and hence we no longer need to restore the recovery request in nvdata. BRANCH=none BUG=chromium:1075488 TEST=make runtests Change-Id: I9ad8e5e0886679a9a342449553170317b010237b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2145272 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* trivial: fix spelling in add_loem_keys.shGeorge Engelbrecht2020-05-291-1/+1
| | | | | | | | | | | | | | | | ...also inflate my personal CL stats. BUG=None TEST=None BRANCH=master Signed-off-by: George Engelbrecht <engeg@chromium.org> Change-Id: I4af2d8b2aa42b4e6d4d4ea36a6ca73a340aa4814 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2220336 Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: George Engelbrecht <engeg@google.com> Tested-by: George Engelbrecht <engeg@google.com> Auto-Submit: George Engelbrecht <engeg@google.com>
* vboot: fix two return values in vboot_api_stub.cJoel Kitching2020-05-281-3/+4
| | | | | | | | | | | | | | | Also add the 2api.h include for vboot2-style stubs. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id6522ea139126adce6cee5ba225ab3eb78f31b7e Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218539 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: create VB2_ERROR_EX_SET_VENDOR_DATAJoel Kitching2020-05-281-7/+3
| | | | | | | | | | | | | | | | | Create VB2_ERROR_EX_SET_VENDOR_DATA error code for use in VbExSetVendorData callback. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2218538 Change-Id: I9d75a608185e475837d9cb4a53b943fd2dae6438 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218537 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: move PERIPHERAL_BUSY to vboot2 namespaceJoel Kitching2020-05-281-2/+3
| | | | | | | | | | | | | | | | | Move VBERROR_PERIPHERAL_BUSY to vboot2 namespace as: VB2_ERROR_EX_AUXFW_PERIPHERAL_BUSY BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Iebc7d73e3a87a8bd4d999be56ad23d6b77d9785c Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2158865 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2158512 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: move timer and beep functions to vboot2 namespaceJoel Kitching2020-05-2820-177/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move these functions from vboot_api.h into 2api.h: VbExGetTimer --> vb2ex_mtime (usec -> msec) VbExSleepMs --> vb2ex_msleep VbExBeep --> vb2ex_beep Rename the constants: VB_USEC_PER_MSEC --> VB2_USEC_PER_MSEC VB_MSEC_PER_SEC --> VB2_MSEC_PER_SEC Remove the constant VB_USEC_PER_SEC. The error code VBERROR_NO_BACKGROUND_SOUND is dropped since it is not currently used. Update a few printf lines to use VB2_DEBUG instead. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I887112ffd5f68fb6a9c4d9ad624aa420cbd55b4b Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2158665 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2158666 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: return error if booting from internal failedYu-Ping Wu2020-05-271-5/+1
| | | | | | | | | | | | | | | | When booting from internal disk failed, return error and request recovery. This behavior is consistent with legacy UIs, and is necessary for FAFT firmware_CorruptBothKernelAB.dev to pass. BRANCH=none BUG=b:146399181, b:156880836 TEST=make runtests TEST=firmware_CorruptBothKernelAB.dev passed on puff Change-Id: Id927961ec7fa1788ddd817c133b5bc905b1e8335 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2213210 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: map Ctrl+S to the TO_NORM screenJoel Kitching2020-05-271-0/+2
| | | | | | | | | | | | | | | | Add hotkey to simplify FAFT mode_switcher for new Groot UI. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I91e00c5365c8f5a587786ab7dcfa67765a342824 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2213384 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: stop centralizing keyboard input actionsJoel Kitching2020-05-275-157/+127
| | | | | | | | | | | | | | BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: Ia63537fb13be5f04ae81a6be7e0fac6eaf47cfb7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2210017 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: improve menu navigation docstringsJoel Kitching2020-05-276-110/+172
| | | | | | | | | | | | | | BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I8cd47503384a8b8f48ccbc12fa6f24c71d02b755 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2210016 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* image_signing: Activate file hash cache for watchlist service for signed builds.Yury Khmel2020-05-271-1/+4
| | | | | | | | | | | | | | | This follows the logic introduced in crrev.com/i/2523754 BUG=b:148229706 TEST= ./sign_official_build.sh usb source_image \ ~/trunk/src/platform/vboot_reference/tests/devkeys out_image BRANCH=None Cq-Depend: chrome-internal:3022044 Signed-off-by: Yury Khmel <khmel@google.com> Change-Id: I5398a9ea2984f0be11cb512f845507309d5f8f8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2210771 Reviewed-by: Mike Frysinger <vapier@chromium.org>