summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* vboot: Switch key to exit RMA to ctrl+sfirmware-drallion-12930.BMathew King2020-04-202-21/+7
| | | | | | | | | | | | | | | | Make the key that exits the RMA process ctrl+s instead of esc so that it is less likely that the user will leave without setting the RMA data. BUG=b:138812835 TEST=emerge-drallion depthcharge chromeos-bootimage ctrl+s exits RMA BRANCH=drallion Signed-off-by: Mathew King <mathewk@chromium.org> Change-Id: Ia9b4f3492a3569fd93e0ea0cc70a305f42bed955 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2157896 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* vboot: Remove the inital RMA screenMathew King2020-04-202-86/+28
| | | | | | | | | | | | | | | | Do not show the initial RMA screen, go directly to vendor data entry. We do not want to give the user to the option to skip the RMA process. BUG=b:138812835 TEST=FEATURES=test emerge-drallion vboot_reference emerge-drallion depthcharge chromeos-bootimage Inital RMA screen no longer appears BRANCH=drallion Change-Id: I0d0f59e3915acd9082c148b69250a0e5d537c273 Signed-off-by: Mathew King <mathewk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2150509 Reviewed-by: Simon Glass <sjg@chromium.org>
* vboot: clear recovery request in all boot modesJoel Kitching2020-04-153-11/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, recovery requests are only cleared when user initiates a manual recovery. This causes problems with two cases specifically: * Transient failures - The recovery request remains in the subcode field for some unknown period of time, and then erroneously gets promoted to the "recovery reason" the next time the user initiates a manual recovery request. * TRAIN_AND_REBOOT - The recovery request remains in the subcode field after training has completed. The next time a manual recovery request is initiated, the subcode is promoted and training occurs yet again. When finished, a reboot occurs and the user ends up back in the OS. Make two changes to deal with these cases: * Clear recovery request (including subcode) unconditionally for non-recovery boot modes. * Stop promoting TRAIN_AND_REBOOT subcodes. BUG=b:153157134, b:35576380 TEST=make clean && make runtests BRANCH=none Change-Id: I79f8fbed72a9d052b5ed5f70e9a2515136b6ef10 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2139335 Tested-by: Joel Kitching <kitching@chromium.org> Tested-by: Frank Wu <frank_wu@compal.corp-partner.google.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Signed-off-by: Frank Wu <frank_wu@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2148571 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Convert more UI errors to vboot2-styleYu-Ping Wu2020-04-061-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Error codes are renamed as follows: VBERROR_INVALID_BMPFV --> VB2_ERROR_UI_INVALID_ARCHIVE VBERROR_NO_IMAGE_PRESENT --> VB2_ERROR_UI_MISSING_IMAGE Also remove unnecessary paddings 0x1000 for UI errors. BRANCH=none BUG=b:124141368, chromium:988410 TEST=emerge-nami depthcharge Cq-Depend: chromium:2082833 Change-Id: I8b7743d9ceecde6c9e3e88109422a99594ad6aab Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2082759 Reviewed-by: Joel Kitching <kitching@chromium.org> (cherry picked from commit 0227b80eb0d4d6331d7a8f0551b04ea26a3d7bf6) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2137171 Reviewed-by: Mathew King <mathewk@chromium.org> Commit-Queue: Mathew King <mathewk@chromium.org> Tested-by: Mathew King <mathewk@chromium.org>
* vboot: Add a blinking cursor to the vendor promptMathew King2020-04-033-2/+35
| | | | | | | | | | | | | | | | | Add support to show a blinking cursor after the vendor data entry so that users can tell that an entry is required. BUG=b:138812835 TEST=Test on a Drallion device with an updated Depthcharge BRANCH=drallion Cq-Depend: chromium:2120311 Change-Id: I02073d92d02a4171f337f86f880d660eb5d8b6f1 Signed-off-by: Mathew King <mathewk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2120310 Reviewed-by: Pranay Shoroff <pshoroff@google.com> (cherry picked from commit d3f563761a90e63b12fecf8d338a09d657eb0e3e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2131307
* vboot: clear recovery request subcode when recovery UI is reachedEric Lai2020-02-232-1/+2
| | | | | | | | | | | | | | | | | CL:2044954 moved clear recovery request into vboot_api_kernel. We'd like to leave the subcode so that we can pipe it through as a UMA statistic. But it's breaking FAFT at the moment. Unconditionally clear it until we have a more detailed design. BUG=b:124141368, b:35576380 TEST=make clean && make runtests BRANCH=none Change-Id: Ib90c746779ca58e0d0100bb0b42a29c2b5a100dd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2063198 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: EricR Lai <ericr_lai@compal.corp-partner.google.com>
* futility: updater: Ignore image parsing error in --forceHung-Te Lin2020-02-213-41/+70
| | | | | | | | | | | | | | | | | | | | The firmware updater has been improved to support flashing outside DUT (--ccd, --servo) that also implies more people will use it for devices with corrupted (or empty) firmware. It's pretty confusing for developers to see "Cannot load system active firmware" while the flashrom can actually read and write to the SPI firmware. The solution here is to allow updating on such devices when --force is specified (which is automatically applied for --servo and --ccd). BUG=b:148405957 TEST=make runtests BRANCH=None Change-Id: I19e63e3464616bc508639cbfad0d1cf8e99507b0 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2059621 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: use vboot2 for storing kernel rollback versionsJoel Kitching2020-02-1910-72/+21
| | | | | | | | | | | | | | | | | | | | | Migrate to using vboot2 shared data fields for storing kernel rollback versions: kernel_version_tpm_start(1) --> kernel_version_secdata(2) kernel_version_tpm(1) --> kernel_version(2) kernel_version_lowest(1) --> [removed] Also remove VBSD from tests which no longer need it. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I26c2ccede5fba52e1477b625ef5fc6181f60aadf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2053179 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove previous name VB2_NV_OPROM_NEEDEDJoel Kitching2020-02-191-3/+0
| | | | | | | | | | | | | | | | As part of go/vboot2-oprom-cleanup, VB2_NV_OPROM_NEEDED was renamed to VB2_NV_DISPLAY_REQUEST. Remove the old name since it is no longer in use. BUG=b:124141368, b:124192753, chromium:948529 TEST=make clean && make runtests BRANCH=none Change-Id: I72fb652043936f310e595eacadf6ad3f911187b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2059505 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: do not call vb2_commit_data at end of VBSLKJoel Kitching2020-02-188-138/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Under normal circumstances, data should be committed by depthcharge after execution flow leaves VbSelectAndLoadKernel API call. Since depthcharge needs to be able to respond with the appropriate vb2api_fail call for specific data commit errors anyways, this logic is moved directly into vb2ex_commit_data in CL:2053765. Remove the vb2_commit_data wrapper as was originally intended. vboot code may now directly call vb2ex_commit_data and depend on depthcharge to call vb2api_fail appropriately. BUG=b:124141368, chromium:972956, chromium:1006689 TEST=make clean && make runtests BRANCH=none Change-Id: I55bdb3274210869d4ad1411837b6ef6c579dccad Cq-Depend: chromium:2053765 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2037906 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: create vb2_internals_please_do_not_use.hJoel Kitching2020-02-181-0/+26
| | | | | | | | | | | | | | | | | | | Create vb2_internals_please_do_not_use.h to replace NEED_VB20_INTERNALS. NEED_VB20_INTERNALS will be removed in a separate commit in order to give coreboot code a chance to switch over to using the new header file. BUG=b:124141368, chromium:957880 TEST=make clean && make runtests BRANCH=none Change-Id: Ide3f69d45e4ebbd2b12d03ccffd1e3d8bb68aa5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2055600 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: implement vb2api_get_recovery_reasonJoel Kitching2020-02-183-0/+23
| | | | | | | | | | | | | | | This API function should be used rather than directly accessing vb2_shared_data.recovery_reason. BUG=b:124141368, chromium:1038260, chromium:957880 TEST=make clean && make runtests BRANCH=none Change-Id: I92c8f9a654400be69885a691b39c4b9e4e2031c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2055662 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: add vboot2 flags to vboot_displayJoel Kitching2020-02-181-0/+14
| | | | | | | | | | | | | | | | | Add debug information to vboot_display: - vb2_context.flags - vb2_shared_data.flags - vb2_shared_data.status BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I641f5a5cac041d0b9aac580e3216fb4153369fa7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2055661 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove vb2_packed_key reference from vboot_struct.hJoel Kitching2020-02-181-12/+5
| | | | | | | | | | | | | | | | | | Since CL:1651221, the vb2_packed_key "kernel_subkey" field in VbSharedDataHeader is no longer used. Replace the field with a reserved field of the same size, so that we can remove the awkward relative 2struct.h header include. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Ic755ae102cd3928f1dbec8f1e76f723a4411c2a4 Cq-Depend: chrome-internal:2576432 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2054269 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: fix up load_kernel_test to store subkey in workbufJoel Kitching2020-02-141-11/+11
| | | | | | | | | | | | | | | | Since CL:1651221, kernel subkey has been stored and accessed as part of vboot2 workbuf. We forgot to update the utility load_kernel_test to follow suit. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I67686dc9dd555d3cce9d1be287b56c108460239b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2054268 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: check for recovery mode with VB2_CONTEXT_RECOVERY_MODEJoel Kitching2020-02-144-7/+5
| | | | | | | | | | | | | | | | When the specific recovery reason is not needed, just use (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) to determine whether or not we are in recovery mode. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I37f1bc066d970a51dfd7ef38cba519c00e1e764f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2053252 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/vboot_display: fetch subkey from vboot2 structJoel Kitching2020-02-141-2/+5
| | | | | | | | | | | | | | | | Since CL:1651221, the kernel subkey is stored in vb2_shared_data and vboot2 workbuf. Update vboot_display.c to read from this location accordingly. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Id287ff595bc394d23837e946c0f711b79d2f19ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2051892 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: stop setting context mode flag in VBSLKJoel Kitching2020-02-142-10/+6
| | | | | | | | | | | | | | | | Stop setting mode flags (developer or recovery) in VbSelectAndLoadKernel; this has already been done in firmware verification. BUG=b:124141368, chromium:994060 TEST=make clean && make runtests BRANCH=none Change-Id: I659f406e0182f809ad46c92a2597b05f685d45dd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2054265 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: unmarry LoadKernel from VBSDJoel Kitching2020-02-143-124/+18
| | | | | | | | | | | | | | | | Create a function-local copy of VbSharedDataKernelCall rather than using the memory built-in to VBSD. Stop making any reference to vboot1 VBSD from LoadKernel. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I5dabfb33a0eb05c1f40509dcf00a4c5751af1ef5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2053182 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: use VB2_SD_FLAG_KERNEL_SIGNEDJoel Kitching2020-02-143-3/+9
| | | | | | | | | | | | | | | | Use vboot2 variant VB2_SD_FLAG_KERNEL_SIGNED instead of vboot1 VBSD flag VBSD_KERNEL_KEY_VERIFIED. Export the flag back to vboot1 at the end of VBSLK. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Ie7516195b95a9ef2ca254616c9486991b1a418fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2053181 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: integrate BROKEN screen recovery request logic into VBSLKJoel Kitching2020-02-147-93/+150
| | | | | | | | | | | | | | | | | | | | | | | | | CL:1940398 brought us towards the goal of deferring clearing recovery requests until kernel verification stage. However, now we are modifying recovery requests from multiple locations in kernel verification code -- namely, also on the BROKEN screen in UI code. Integrate the logic into a function called vb2_clear_recovery to be called from VbSelectAndLoadKernel. Add tests to ensure that recovery requests get properly updated *before* entering the UI. BUG=b:124141368, b:35576380 TEST=make clean && make runtests BRANCH=none Change-Id: I5b0f4f7556c045ccc0d0739acc2668905a2a93e9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2044954 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* 2lib: Add vb2api_is_developer_signed() to replace old dev key checkJulius Werner2020-02-133-54/+43
| | | | | | | | | | | | | | | | | | This patch removes the old check for developer keys from the firmware verification path and instead inserts a similar (but faster) check into vb2api_kernel_phase1(). This has the advantage that we can export the check function to the calling firmware which could use it to display this information in a more user-visible manner. BRANCH=None BUG=None TEST=Booted in normal and recovery mode with developer keys, confirmed they were recognized. Change-Id: I00af0d10e31b2789574c8e4f1875ccd8d01eb0d5 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2038245 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: remove -drop-ld-preload from qemu invocationJoel Kitching2020-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This flag is currently not supported in the qemu binary, and causes qemu process to end with a return code of 1, making all tests fail. The inability to enable this flag is likely the cause of all the warnings in test output: ERROR: ld.so: object 'libsandbox.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. BUG=b:124141368, chromium:605348 TEST=make clean && make runtests TEST=force QEMU_ARCH := ${ARCH} and run: FEATURES=test emerge-eve vboot_reference BRANCH=none Change-Id: Ie8c06da7a52638268d6ab318b591c995b18b98b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2050969 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Rename legacy UIsHsuan Ting Chen2020-02-1214-247/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to crbug.com/1033815, rename files and entry point functions for two legacy UIs. Ideally, these UIs will be deprecated after the detachable UI revamp (b:146399181) is done. common: - rename vboot_ui_common.{c,h} to vboot_ui_legacy_common.{c,h} LEGACY_CLAMSHELL_UI: - rename vboot_ui.c to vboot_ui_legacy_clamshell.c - rename vboot_ui_wilco.c to vboot_ui_legacy_wilco.c - rename VbBootRecovery() to VbBootRecoveryLegacyClamshell() - rename VbBootDiagnostic() to VbBootDiagnosticLegacyClamshell() - rename VbBootDeveloper() to VbBootDeveloperLegacyClamshell() LEGACY_MENU_UI: - rename vboot_ui_menu.c to vboot_ui_legacy_menu.c - rename vboot_ui_menu_private.h to vboot_ui_legacy_menu_private.h - rename VbBootRecoveryMenu() to VbBootRecoveryLegacyMenu() - rename VbBootDeveloperMenu() to VbBootDeveloperLegacyMenu() BRANCH=none BUG=b:146399181,chromium:1033815 TEST=USE="legacy_clamshell_ui" emerge-nami vboot_reference TEST=USE="legacy_menu_ui" emerge-nami vboot_reference Change-Id: I70dafbab0070b19ed963d2a4ba63a95f4a0f3224 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2008980 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move dumpRSAPublicKey from SDK into BOARD installJoel Kitching2020-02-111-1/+1
| | | | | | | | | | | | | | | | | This utility is used for firmware_UpdateFirmwareDataKeyVersion and firmware_UpdateKernelDataKeyVersion tests, and needs to be available on the DUT. BUG=b:149102664 TEST=None BRANCH=none Change-Id: I5e7d554356d891c165990a5cdda6ba47d5a3918f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2050423 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Greg Edelston <gredelston@google.com>
* vboot: more complete EC sync testingJoel Kitching2020-02-112-67/+226
| | | | | | | | | | | | | | | | | | | | Add more checks of updated and protected function calls. Check that VB2_SD_STATUS_EC_SYNC_COMPLETE is always set, regardless of whether EC sync actually runs. Only perform action in mock functions when return value is non-error. BUG=b:124141368, chromium:1042135 TEST=make clean && make runtests BRANCH=none Change-Id: I2e7d9770f4c105d372c6e068a95b4fbc78a085c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2004248 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* firmware: Add VB2_REC_OR_DIE() helper macroJulius Werner2020-02-116-32/+31
| | | | | | | | | | | | | | | | | After introducing VB2_DIE() recently, practical use has shown that we pretty much always want to check for recovery mode first, and avoid a hard abort in that case. This patch introduces a very similar macro that includes that extra check so we don't have to open-code it all over the place. BRANCH=None BUG=None TEST=make runtests Change-Id: I16e744859ba7a5c68269e06c7e7d071f3bfae67e Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2038244 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: merge different FWLIB_SRC versions into oneJoel Kitching2020-02-111-27/+18
| | | | | | | | | | | | | | | | Since we are only building one fwlib library now, merge FWLIB_SRCS, FWLIB2X_SRCS, and FWLIB_20_SRCS into one. Remove the corresponding OBJS variables appropriately. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I190f3ca99ca67063fe0013dd490ef8869cd8f57c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1969258 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: move vboot 2.1 functions and structs into host codeJoel Kitching2020-02-1138-202/+178
| | | | | | | | | | | | | | | | | | These structs and functions need to stick around for futility to use, but they are no longer supported in firmware code. Rename host/lib21/include/* files to end in 21 instead of 2. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I01e181e2f03553d60724fbdc826f5ada63777303 Cq-Depend: chromium:1969172 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1963621 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: purge unused vboot 2.1 codeJoel Kitching2020-02-1117-2260/+1
| | | | | | | | | | | | | | Only keep vboot 2.1 code that futility uses. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: Iee45d7a0f7c6a6d4b27997b2eff3117a12a48dcf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1961715 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: modify control flow for vendor data configPranay Shoroff2020-02-104-126/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | Modify logic for new vendor data configuration workflow. Current workflow contains little to no instruction for navigating vendor data workflow. UI is generally very scarce. New workflow aims to provide more instruction on how to proceed to next steps, escape from the workflow and boot normally, and a new YES/NO selection screen during the final confirmation phase of the workflow. BUG=b:138812835 BRANCH=none TEST=emerge-sarien depthcharge, chromeos-bootimage, flash firmware image on Sarien and test workflow Cq-Depend: chromium:1925665, chrome-internal:2180149 Change-Id: I3d7081f348a7dd68d10d1eba4879a359ccbdd6e5 Signed-off-by: Pranay Shoroff <pshoroff@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1926508 Commit-Queue: Mathew King <mathewk@chromium.org> Tested-by: Mathew King <mathewk@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org>
* vboot: Reduce unnecessary redraw of error messageYu-Ping Wu2020-02-101-4/+3
| | | | | | | | | | | | | | | | | | | When developer mode is disabled by the VB2_SECDATA_FWMP_DEV_DISABLE_BOOT flag, the error message will be redrawn per 20 ms even if no key is pressed. This patch reduces unnecessary redraw by moving the drawing inside enter_to_norm_menu(), which will be called only when changing screens. BRANCH=kukui BUG=chromium:1048094,chromium:1049029 TEST=emerge-nami vboot_reference Cq-Depend: chromium:2040844 Change-Id: I0e892086b25fc94800534c5a37bcab8b70a5fcd9 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2035056 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: update vb2api_kernel_phase1 to use GBB interfaceJoel Kitching2020-02-097-165/+156
| | | | | | | | | | | | | | | | | | | | vb2api_kernel_phase1 was previously written to read the GBB headers, locate the recovery key, and then load it. GBB headers are now saved directly on workbuf in firmware phase. Simply use the vb2_gbb_read_recovery_key function to retrieve the key. Update LoadKernel to read kernel subkey from vboot2 workbuf. Update tests/verify_kernel.c to write subkey to vboot2 workbuf. BUG=b:124141368, chromium:954774, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Ia85013da34bdab68bf486014a3401d48c95b3472 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1651221 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove fwlib2x, fwlib20, fwlib21 targetsJoel Kitching2020-02-081-45/+6
| | | | | | | | | | | | | | | All vboot "versions" are being coalesced into one, accessible via the vboot_fw.a library, which is built by the fwlib target. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I9ea7f067c9ac732eff7e63aa49e5303b340ede8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1961714 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: enable futility tests by defaultJoel Kitching2020-02-081-3/+1
| | | | | | | | | | | | | | | | | | Since CL:2039946, flakiness with test_update.sh should be fixed. Thus, we should enable futility tests. BUG=b:124141368, chromium:605348 TEST=make clean && make runtests TEST=attempt running on CQ BRANCH=none Change-Id: Ie97ca89fa9e4c792363c2a9cd467d8cbe7f373d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2043023 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: only clear recovery requests at kernel verificationJoel Kitching2020-02-085-21/+40
| | | | | | | | | | | | | | | | | | | | | | | | Instead of clearing recovery requests early on in firmware verification, defer this task until kernel verification has begun. If the system is rebooted for any non-vboot-related reason when entering recovery mode (e.g. FSP initialization), the recovery request will still be available in nvdata. Additionally, relocate the reboot triggered by memory training into VbSelectAndLoadKernel. BUG=b:124141368, b:35576380 TEST=make clean && make runtests BRANCH=none Change-Id: I787e45c7ed4f2bebf570bb9c1a8e9e371f2a040b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1940398 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Add a semicolon in commentYu-Ping Wu2020-02-061-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Change-Id: I04e0151655a9331750f5f5becfae2638c8e3ed17 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2037146 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Deprecate VBSD_BOOT_REC_SWITCH_VIRTUALYu-Ping Wu2020-02-063-15/+24
| | | | | | | | | | | | | | | | | | With the compile time constant PHYSICAL_PRESENCE_KEYBOARD passed (CL:2004267), replace the usage of the flag VBSD_BOOT_REC_SWITCH_VIRTUAL with PHYSICAL_PRESENCE_KEYBOARD. Also deprecate VBSD_BOOT_REC_SWITCH_VIRTUAL because it is no longer needed. BRANCH=none BUG=chromium:1038259, chromium:943150 TEST=make runtests Cq-Depend: chromium:2004267 Change-Id: I091825cf1367571bb50dec84dda6e44ed4d2bb19 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2037269 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/crossystem: Deprecate recoverysw_is_virtualYu-Ping Wu2020-02-062-10/+0
| | | | | | | | | | | | | | | | | | | | | | As part of chromium:943150, virtual recovery switch functionality is being deprecated. Physical presence should be chosen by specifying one of the following USE flags: - physical_presence_keyboard - physical_presence_recovery - physical_presence_power Fields VDAT_INT_DEPRECATED_DEVSW_VIRTUAL and VDAT_INT_RECSW_VIRTUAL are also removed from VdatIntField. BRANCH=none BUG=chromium:943150 TEST=make runtests Cq-Depend: chromium:2004370 Change-Id: I4342a2607538d1b4480d601073eb531e93e74b38 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2037268 Reviewed-by: Joel Kitching <kitching@chromium.org>
* test_update.sh: Avoid using grep -q together with -o pipefailJulius Werner2020-02-062-2/+2
| | | | | | | | | | | | | | | | | | | | | | Piping something into 'grep -q' when the shell option '-o pipefail' is set is racy: 'grep -q' exits immediately after seeing the first occurence of the pattern, so if the process at the front of the pipe hasn't written all its data into the pipe buffer yet, it will still try to write more after grep has already exited and die with a SIGPIPE. The recommended solution seems to be using a <<<"herestring" instead. (Also add the test's return code to the FAILED output in run_test_scripts.sh to aid future test script debugging.) BRANCH=None BUG=chromium:1048048 TEST=make runtests Change-Id: I2f2589f223d9179d694565f5733535d4270699ea Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2039946 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* vboot_ui: refactor vendor data codePranay Shoroff2020-02-058-340/+373
| | | | | | | | | | | | | | | | | | Refactored wilco-specific functions related to setting serial numbers to their own file and diagnostic UI feature BUG=b:138812835 BRANCH=None TEST=emerge-drallion vboot_reference, flashed drallion and tested vendor data setting Related to chromium:1983248, chromium:1926508, chrome-internal:2180149 Change-Id: I02b2a62943ea60af007b6fc084b74e990062f3c3 Signed-off-by: Pranay Shoroff <pshoroff@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1999050 Reviewed-by: Mathew King <mathewk@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Mathew King <mathewk@chromium.org>
* vboot: unify common.sh for testing scriptsstabilize-12881.BJoel Kitching2020-02-0314-166/+104
| | | | | | | | | | | | | | | | Use tests/common.sh instead of tests/futility/common.sh. Correct SCRIPT_DIR value to allow running run_test_scripts.sh standalone without using Makefile. BUG=b:124141368, chromium:605348 TEST=make clean && make runfutiltests BRANCH=none Change-Id: I107952826ea9a3a3816d9c13206aa48bee63ac6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2014236 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: get rid of MINIMAL in MakefileJoel Kitching2020-02-032-114/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Clean up install paths. The ebuild was adding /usr in the MINIMAL=1 case, making it look virtually exactly the same as the non-MINIMAL case. Just unify the two. - Introduce SDK_BUILD variable to take over part of the functionality previously implemented by MINIMAL. - One may now use rununittests for quick test runs instead of setting MINIMAL=1. - runtestscripts is added to the default test set under "runtests". runfutiltests is not yet enabled due to flakiness (see chromium:1048048). - Remove unused LZMA_LIBS and YAML_LIBS. - Stop installing dev-mode-only scripts into /usr/bin for an SDK build (VB_DIR). Presumably this was meant for board builds, but since everyone is used to these scripts living in /usr/share/vboot/bin, we may as well keep them there. - Stop installing crossystem for an SDK build. - Group SIGNING_SCRIPTS into UTIL_SCRIPTS_BOARD. - Have install_for_test depend on test_setup instead of vice versa. Targets which run tests should depend on install_for_test. BUG=b:124141368, chromium:605348, chromium:1048048 TEST=make clean && make runtests TEST=make clean && make rununittests TEST=sudo emerge vboot_reference, check installed files TEST=emerge-eve vboot_reference, check installed files TEST=USE=fuzzer emerge-eve vboot_reference TEST=FEATURES=test USE=fuzzer emerge-eve vboot_reference BRANCH=none Change-Id: I203e69143e40ee42729488bf0ab59f5120649bd1 Cq-Depend: chromium:2012183 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2012182 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Convert UI errors to vboot2-styleYu-Ping Wu2020-02-031-4/+15
| | | | | | | | | | | | | | | | | | | | | | Error codes are renamed as follows: VBERROR_INVALID_SCREEN_INDEX --> VB2_ERROR_UI_INVALID_SCREEN VBERROR_SCREEN_DRAW --> VB2_ERROR_UI_DRAW_FAILURE In addition, add new error code VB2_ERROR_UI_DISPLAY_INIT. BRANCH=none BUG=none TEST=emerge-nami depthcharge Cq-Depend: chromium:2002310 Change-Id: I1381762fbe1a9bb0c76e7e7d64a0732799c3bf0f Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2002309 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Reland: Clean up implicit fall through.Manoj Gupta2020-02-017-29/+8
| | | | | | | | | | | | | | | | Directly use the __attribute__ ((fallthrough)) instead of a macro. This was suggested in CL:1772474. BUG=chromium:997709 TEST=CQ BRANCH=None Change-Id: Ifcdcd3822eddea41aeb88f4a55bd09aa483f6054 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2031766 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* 2lib: Fix struct vb2_hash the way it was meant to bestabilize-quickfix-12871.27.Bstabilize-12871.91.Bstabilize-12871.65.Bstabilize-12871.57.Bstabilize-12871.253.Bstabilize-12871.24.Bstabilize-12871.103.Bstabilize-12871.102.Brelease-R81-12871.BJulius Werner2020-01-283-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | My goal in CL:1963614 was to write struct vb2_hash such that it can match the exisiting binary representation of the CBFS hash attribute, but no longer be dependent on endianness. Unfortunately I screwed up... if you want to match the binary representation of a big-endian integer for small numbers, the important byte you're interested in is the *last* one, not the first. Thankfully we still have time to fix the issue before this struct is really used anywhere, so this patch does that and adds a test to double check I got it right this time. Also clarify comments about how vboot is allowed to use this struct a bit to match the indended usage I'm planning in coreboot. In doing that I realized that you actually don't want to make it easy to sizeof() the |bytes| portion of the struct (because functions shouldn't rely on that size anyway, they should only touch what's valid for a given hash algorithm), so taking that out which also makes it a little more comfortable to work with the struct. BRANCH=none BUG=none TEST=make runtests Change-Id: I7e1a19f36d75acb69e5d1bfa79700c9d878f9703 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2019952
* Enable format string warnings for vb2ex_printf()stabilize-12859.BJulius Werner2020-01-257-18/+19
| | | | | | | | | | | | | | | | | | | This patch enables the -Wformat warning and tags vb2ex_printf() with the appropriate attribute so the compiler recognizes it as a printf variant. This shows a bunch of (sometimes pretty bad) issues in existing code that are hereby fixed. Cannot enable -Wformat-security yet since a lot of code still uses non-constant format strings and it's unclear whether we can/want to change that in all circumstances (e.g. stuff like DoError()). BRANCH=None BUG=None TEST=make runtests Change-Id: I917a4982a97a668a5c0f793f7c771573f2bd3949 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2013857
* keygeneration: add helper for generating update payload keysMike Frysinger2020-01-241-0/+8
| | | | | | | | | | | | | | We don't use this anywhere as we've only ever generated one key so far. But we never wrote this down, so this is more documentation. BUG=None TEST=ran the code manually BRANCH=None Change-Id: Ia9a318c686b1ad7ab1de31899b49ce73a4d5ad9f Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1947554 Reviewed-by: George Engelbrecht <engeg@google.com>
* vb2_sha_api_tests: Silence UBSAN warning for zero length array accessJulius Werner2020-01-241-1/+4
| | | | | | | | | | | | | | | | Looks like UBSAN doesn't like zero-length arrays. We use those all the time in firmware, but I guess that's the reason we don't even try to run UBSAN on the real firmware repos. For this particular case in vboot's tests, it's easy enough to work around. BRANCH=None BUG=chromium:1043405 TEST=make runtests Change-Id: Ia799fdc57ee17dc46b55920dd1d2601adf98d3f7 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2008766 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: convert several vboot1 flags to vboot2Joel Kitching2020-01-223-16/+14
| | | | | | | | | | | | | | | | | | | | | Use vboot2 flag as source of truth for NVDATA_V2, DEV_MODE_ENABLED, and NOFAIL_BOOT. Mark vboot1 flags LF_DEV_SWITCH_ON and NOFAIL_BOOT as deprecated. Fix up spacing of vboot1 flags in vboot_struct.h. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I6af8cd97ade8284e198f966d1b86f57101fcd070 Cq-Depend: chromium:2011415 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2011416 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>