summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* vboot: Add language selection screen to vb2_screenstabilize-quickfix-13099.93.Bstabilize-13099.94.Bstabilize-13099.90.Bstabilize-13099.85.Bstabilize-13099.73.Bstabilize-13099.72.Bstabilize-13099.70.Bstabilize-13099.118.Bstabilize-13099.110.Bstabilize-13099.101.Brelease-R84-13099.Bfactory-test-13099.17.BYu-Ping Wu2020-05-151-0/+2
| | | | | | | | | | | | Add VB2_SCREEN_LANGUAGE_SELECT to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_UI" emerge-nami depthcharge Change-Id: I441e5dd65c8c1f91ec868d3ab477b61b0c3e9cc5 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2200577
* vboot/ui: Split UI testsHsuan Ting Chen2020-05-144-567/+751
| | | | | | | | | | | | | | | | | | Rearrange UI tests into three files: vb2_ui_utility_tests for utility functions and core UI functions, vb2_ui_action_tests for hooked actions, and vb2_ui_tests for UI entries. This CL does not add any extra tests. BRANCH=none BUG=b:156448738 TEST=make clean && make runtests TEST=make clean && DETACHABLE=1; make runtests Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I36a0a43aa3295b06cf32446dcc107652d64d2b8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2198268 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: enable phone recoveryYu-Ping Wu2020-05-142-5/+5
| | | | | | | | | | | | | Enable the phone recovery functionality and UI. BRANCH=none BUG=b:153596126 TEST=make runtests Change-Id: If4fc29db44903e79cecd959a9b558c509ad19e1a Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2196093 Reviewed-by: Joel Kitching <kitching@chromium.org>
* 2sha: Add SHA-224 and SHA-384 hash algorithmsJulius Werner2020-05-129-31/+173
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the SHA-224 and SHA-384 hash algorithms, which are basically just variants of SHA-256 and SHA-512 (respectively) with different initialization vectors and truncating a bit of the final output. They are only added to serve vboot's role as all-purpose crypto toolbox for callers (e.g. coreboot, where I need SHA-384 to support a certain SoC boot descriptor right now) and not intended for actual use as signature or firmware body hashes -- therefore, we only add the hash algorithms themselves and don't create enum values for them in enum vb2_crypto_algorithm or other structures. Also clarify the difference between UNROLL_LOOPS and UNROLL_LOOPS_SHA512 in the Makefile, since it was totally not obvious to me. BRANCH=None BUG=None TEST=make runtest and make runtest UNROLL_LOOPS=1 Cq-Depend: chromium:2191082 Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic132d4dfe5967f03be4666b26c47d32c1235f4a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2183551 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: implement advanced_optionsJoel Kitching2020-05-111-6/+31
| | | | | | | | | | | | | | | Implement advanced_options menu item and screen. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I870133db74d773771ea92a280fdfb4864706bd71 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2186958 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: Platform name check should be case insensitiveHung-Te Lin2020-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Some platforms (e.g., Zork) may decide to change platform name from lower_case to CamelCase after early builds, and platform name check will be an AU blocker in that case. Considering there should be no devices having same name (and using incompatible firmware), it should be fine to change the strncmp to strncasecmp so the platform name check will be case insensitive. BUG=b:156119908 TEST=make runtests BRANCH=None Change-Id: I5014c136976454dd0965a607e5a98bbe4543a41e Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2192537 Commit-Queue: Rob Barnes <robbarnes@google.com> Tested-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Rob Barnes <robbarnes@google.com>
* futility: Adds platform check quirk for zorkRob Barnes2020-05-113-0/+33
| | | | | | | | | | | | | | | | | | | | | | 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>
* vboot: Add developer screens to vb2_screenYu-Ping Wu2020-05-091-0/+4
| | | | | | | | | | | | | Add VB2_SCREEN_DEVELOPER_MODE and VB2_SCREEN_DEVELOPER_TO_NORM to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Ie949eedbf5d564f73fd6288bbc3630af83335dbb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2186571 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: implement to_dev transition flowJoel Kitching2020-05-076-23/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce three new action hooks: - vb2_screen_info.init Init function runs once when changing to the screen. - vb2_screen_info.action Action function runs repeatedly while on the screen. - vb2_menu_item: Action function takes precedence over target screen if non-NULL. Create the VB2_SCREEN_RECOVERY_TO_DEV screen, and add a keyboard shortcut to get to that screen directly when in manual recovery mode: Ctrl+D. The TO_DEV screen repeatedly checks for the correct physical verification state. When that state is triggered, it switches to dev mode and reboots. The trigger depends on physical presence type: - PHYSICAL_PRESENCE_KEYBOARD: wait for ENTER key on the confirm button, pressed by internal keyboard - !PHYSICAL_PRESENCE_KEYBOARD: wait for the physical presence button (recovery or power) to be pressed and released - SPACE character also cancels in order to preserve prior behaviour Note that currently there is no way to exit developer mode once it has been enabled. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: If3ff248d98859d530c3a24524618c6282a5ac5b5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2168072 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: remove validate_selection functionJoel Kitching2020-05-073-93/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Given that we are sending the full vb2_ui_context into UI-related functions, it's impossible to fully validate that called functions don't modify UI state in unexpected ways. Assume UI-related functions are mutating vb2_ui_context data correctly. Screen init functions (see CL:2168072) will be used to set selected_item and disabled_mask before displaying a screen for the first time. change_screen() is also changed to return a vb2_error_t value to be more consistent with action functions. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: Icda68f95a835b9143b8dd085d8dbdb7bced04775 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2182084 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Rename VB_AUX_FW_* to VB2_AUXFW_*factory-drallion-13080.BYu-Ping Wu2020-05-058-59/+59
| | | | | | | | | | | | | | For naming consistency, rename any variations of "AUX_FW" to "auxfw". BRANCH=none BUG=none TEST=make runtests Cq-Depend: chromium:2154265 Change-Id: Icf74215f5babf19228f2f362c3c29c9b14794dfc Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2154266 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: move locale_id from screen_state into ui_contextJoel Kitching2020-05-054-67/+57
| | | | | | | | | | | | | | | | | locale_id is not tied to the current screen -- i.e. it shouldn't revert if we return to the previous screen. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: I691bdf7938d2a14cfbe68c7f60dc0103c236733c Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2182083 Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: initialize vb2_ui_context memory to 0Joel Kitching2020-05-051-0/+1
| | | | | | | | | | | | | | | | Members of vb2_ui_context are undefined unless initialized. memset() the entire struct to 0 initially. BUG=b:146399181 TEST=make clean && make runtests BRANCH=none Change-Id: Ieeb77c576231c4a4afb204e47983e35916be8fe4 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2182082 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Remove reboot-related vboot1-style errorsYu-Ping Wu2020-05-051-13/+2
| | | | | | | | | | | | BRANCH=none BUG=b:124141368, chromium:988410 TEST=make runtests Cq-Depend: chromium:2154269, chromium:2175864 Change-Id: Ib3996ecc83a69ce6780d48f1aa446e81dfd75589 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2167622 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Add advanced options screen to vb2_screenYu-Ping Wu2020-05-051-0/+2
| | | | | | | | | | | | | Add VB2_SCREEN_ADVANCED_OPTIONS to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: I14f96f870c5f2f7dc462dfd138d4466b3e99d74c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2175720 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: fix up EC/auxfw sync includesJoel Kitching2020-05-053-12/+6
| | | | | | | | | | | | | BUG=b:124141368, chromium:1016688 TEST=make clean && make runtests BRANCH=none Change-Id: Iabf62e4df5e554da28b191878b76d926299d73b9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2171544 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Implement common UI loopHsuan Ting Chen2020-05-048-70/+1718
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add config DETACHABLE to control the navigation in menu UI. Implement 4 screens: - VB2_SCREEN_RECOVERY_SELECT - VB2_SCREEN_RECOVERY_INVALID - VB2_SCREEN_RECOVERY_PHONE_STEP1 - VB2_SCREEN_RECOVERY_DISK_STEP1 Handling user inputs. - Shutdown request through VbExIsShutdownRequested. - Navigate with up, down, and enter key. - Navigate with volume up, volume down, and power button in DETACHABLE. Implement common UI loop, currently used for manual and non-manual recovery (developer forthcoming). BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge TEST=USE="menu_ui detachable" emerge-nami depthcharge TEST=make clean && make runtests TEST=DETACHABLE=1; make clean && make runtests Cq-Depend: chromium:2152212 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4e0f2cdf053f75935529826df215b06c8a9af4cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2117810 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: fix a typo in CL:2112321stabilize-13070.BJoel Kitching2020-04-301-1/+1
| | | | | | | | | | | | | | | | | CL:2112321 inadvertently removed the escape on a \n newline in a VB2_DEBUG string. Put it back. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I19ee4a77d3cc58d6995212151b381ae76c602a42 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2174039 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* 2crypto: Force correct section flags for .rodata arraysJulius Werner2020-04-291-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up fix to CL:2157900. That CL put the problematic arrays into sections with the right name, but they still didn't set the right ELF flags for them (specifically the READONLY flag). This made the assembler unhappy in coreboot, although it still seems to have built things correctly in the end: {standard input}: Assembler messages: {standard input}:359: Warning: setting incorrect section attributes for .rodata.vb2_hash_names {standard input}:369: Warning: setting incorrect section attributes for .rodata.vb2_sig_names This patch throws more ugly hacks at the problem to make it disappear. BRANCH=None BUG=None TEST=Build coreboot for both Arm and x86 boards, confirmed that error messages are gone and objdump shows intended section flags. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Iea93788a13e9fd14d6b5a16626294d5a4b0e5411 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2169480 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Convert reboot-related errors to vboot2-styleYu-Ping Wu2020-04-2814-199/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error codes are renamed as follows: VBERROR_SHUTDOWN_REQUESTED --> VB2_REQUEST_SHUTDOWN VBERROR_REBOOT_REQUIRED --> VB2_REQUEST_REBOOT VBERROR_EC_REBOOT_TO_SWITCH_RW --> VB2_REQUEST_REBOOT_EC_SWITCH_RW VBERROR_EC_REBOOT_TO_RO_REQUIRED --> VB2_REQUEST_REBOOT_EC_TO_RO VBERROR_KEEP_LOOPING --> VB2_REQUEST_UI_CONTINUE Since these are not really "errors", they're renamed to VB2_REQUEST_* instead, with larger values to separate from real errors. The old vboot1-style errors will be removed once the errors are renamed in coreboot and depthcharge. BRANCH=none BUG=b:124141368, chromium:988410 TEST=make runtests Change-Id: Ide1328f9c0f2803534fb3f1f1ecd16ad8ea36a4e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2143030 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* crossystem: add support for ADL gpiochipSubrata Banik2020-04-281-0/+3
| | | | | | | | | | | | | | On Alderlake platform, the pinctrl (gpiochip) driver label is "INTC105x:00", hence declare it properly. TEST=run 'crossystem wpsw_cur' and see '0' rather than an error on ADLRVP platform. Change-Id: I7c8ead83717b7be35ce68026768f6f0f5b1efa1c Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2167671 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Tested-by: Subrata Banik <subrata.banik@intel.corp-partner.google.com>
* crossystem: Add quirk reading wpsw_curLukasz Majczak2020-04-231-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | As GPIO numbering has changed with kernel 4.16, so we have to change the finall offset when reading wpsw_cur. Before there was a gap (3.18): 0: INT33FF:02 GPIOS [373 - 384] PINS [0 - 11] and 12: INT33FF:02 GPIOS [385 - 396] PINS [15 - 26]a with 4.19 it looks like below: 0: INT33FF:02 GPIOS [314 - 325] PINS [0 - 11] and 12: INT33FF:02 GPIOS [329 - 340] PINS [15 - 26] BUG=b:143174998 BRANCH=none TEST=crossystem wpsw_cur (on Kefka) 1. with wp present it should return 1 2. without present wp it should return 0 Change-Id: I7c8ead83717b7be35ce68026768f6f0f5b0ff91c Signed-off-by: Lukasz Majczak <lma@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2153155 Reviewed-by: Brian Norris <briannorris@chromium.org> Commit-Queue: Brian Norris <briannorris@chromium.org>
* vboot: Add screens for recovery using diskYu-Ping Wu2020-04-221-0/+4
| | | | | | | | | | | | | Add VB2_SCREEN_RECOVERY_DISK_STEP* to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Ibfaeb25d00ee340adfb9f7de9188f20a947bae24 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2156701 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Add broken screen to vb2_screenYu-Ping Wu2020-04-221-0/+2
| | | | | | | | | | | | | Add VB2_SCREEN_RECOVERY_BROKEN to enum vb2_screen for broken screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: I7f535094de216157591eab9d17a8e4aa2fdd772e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2156699 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Add recovery select screen to vb2_screenYu-Ping Wu2020-04-223-10/+23
| | | | | | | | | | | | | | | | | | | Add VB2_SCREEN_RECOVERY_SELECT to enum vb2_screen for the recovery select screen. Also add arguments 'selected_item' and 'disabled_item_mask' to vb2ex_display_ui() for menu items, and rename argument 'locale' to 'locale_id'. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Cq-Depend: chromium:2124025 Change-Id: Ifff67ded8196288cdb3c1558c64c09b7ffc5011e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2138876 Reviewed-by: Joel Kitching <kitching@chromium.org>
* 2crypto: Force exported const arrays to .rodataJulius Werner2020-04-221-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, there is no way to define really immutable data in the C language. Making something 'const' is just a sign, not a cop, because in theory any code can just cast the const away. Compilers instead use sophisticated static analysis to determine what data is never written to by the code and put that into the .rodata (instead of .data) section. But for externally available global variables, they cannot do that (because the analyzer doesn't cross compilation units). Unfortunately some platforms in coreboot really care about everything being in .rodata (because they're accessing it in-place on flash), and some "benign" refactoring like making a const variable externally available can break that. There is no easy fix for that. So in this case, let's just go for the ugly fix of forcing the offending arrays into the right section. BRANCH=None BUG=None TEST=Built SIEMENS_MC_APL2 with CB:40503 and this patch. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ife508f98e3f8ed40a4488b5fe1967d00a62f347c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2157900 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* 2api: Add kernel version getter and make dev-signed check fail softJulius Werner2020-04-213-1/+15
| | | | | | | | | | | | | | | | | | | | | | | This patch adds a function to retrieve the kernel rollback version from secdata, which may be interesting to callers that have more advanced ways of retrieving bootable images and want to be able to spot check whether an image can be booted without passing the full thing to vboot. Also reduce the penalty from calling vb2api_is_developer_signed() out of turn from an immediate DIE() to an angry error message, to support a case in depthcharge where for all practical purposes the call should never happen too early, but the framework can't quite guarantee it. BRANCH=None BUG=b:153758197 TEST=None Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic7c2fc62e1ba80f69f70421907b9686f0b3dae77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2153592 Reviewed-by: Jes Klinke <jbk@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Jes Klinke <jbk@chromium.org>
* vboot: Add vb2api_phone_recovery_enabled() to vboot APIYu-Ping Wu2020-04-209-12/+111
| | | | | | | | | | | | | | | | | | | In order to implement a kill switch for phone recovery in recovery UI, add VB2_SECDATA_KERNEL_FLAGS to enum vb2_secdata_kernel_flags, and add VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_DISABLED to the flags to indicate whether to disable phone recovery. Set this flag to 1 in vb2api_kernel_phase1(). Also add vb2api_phone_recovery_enabled() to vboot API. BRANCH=none BUG=b:146399181, b:147744345 TEST=make runtests Change-Id: I65c8faa593f5f90dd762f0092058048983c5b3a2 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2131236 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move recovery reason strings to vboot2 namespaceJoel Kitching2020-04-208-128/+257
| | | | | | | | | | | | | | | | | | | | Make recovery reason strings more widely available, and print them in kernel verification console messages. Note that we purposely do not print strings in firmware verification in order to avoid linking recovery reason strings into coreboot stages. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests TEST=trigger recovery, check console logs BRANCH=none Change-Id: Ica82a60075da53e4ad0a0403eb8a88685c3bdbd6 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2112321 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* secdata: Initialize secdata kernel in vb2api_fw_phase1dnojiri2020-04-186-36/+24
| | | | | | | | | | | | | | | | | | | | | | | Currently, secdata kernel is initialized in vb2api_kernel_phase1. Since we'll be using secdata kernel in romstage for EFS2, it needs to be initialized earlier. This patch makes vb2api_fw_phase1 call vb2_secdata_kernel_init. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=b:147298634, chromium:1045217, b:148259137 BRANCH=none TEST=Verify Hmir is updated in romstage on Puff. Cq-Depend: chromium:2155377 Change-Id: I8a537126a952ecccc9cc496ce60fc6dc81541a8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2153852 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: remove some trailing spacesJoel Kitching2020-04-173-4/+4
| | | | | | | | | | | | | | BUG=b:124141368 TEST=none BRANCH=none Change-Id: I054e668d96e1c76d6ce464e182fd05d17ef3fca0 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2154342 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: decouple EC/AUXFW sync from UIYu-Ping Wu2020-04-177-176/+81
| | | | | | | | | | | | | | | | | | | | | | | | | Since we don't always want to show a UI on EC sync (for example, in coreboot, where display hasn't been initialized), decouple vb2api_ec_sync() from VbDisplayScreen() by leaving screen display out of vboot and letting the caller (such as depthcharge) handle it. Similarly, stop calling screen display function from vb2api_auxfw_sync(). In order to display screen from depthcharge, it needs to know the locale. Therefore, add vb2api_get_locale() to vboot API, which returns the locale from nvdata. After this change, the constant EC_SLOW_UPDATE is no longer used, so remove it from Makefile. BRANCH=none BUG=chromium:1055125 TEST=make runtests Cq-Depend: chromium:2117776 Change-Id: I0e2e8ebdd26d48a2e94d36495c2e45a5734cdc5d Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2087016 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: remove VBERROR_TPM_SET_BOOT_MODE_STATE error codeJoel Kitching2020-04-178-40/+48
| | | | | | | | | | | | | | | | | | | | | | Since secdata and nvdata get/set functions no longer return error codes, and instead use VB2_ASSERT and VB2_DIE to abort on failure, vb2_enable_developer_mode no longer has any error code to return. Change the function return type to void, and remove checks around the function call. As a result, VBERROR_TPM_SET_BOOT_MODE_STATE becomes unused and we may remove it. Finally, move the USB_BOOT_ON_DEV logic (enable USB boot when on transition to dev mode) into vb2_enable_developer_mode. Also add unit tests. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I286d9343c4c751ff24bf4c149a26fbe5306e383a Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2152212 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* updater_utils.h: stop using 'dev=1' in flashrom commandNikolai Artemiev2020-04-171-1/+1
| | | | | | | | | | | | | | | Replace 'ec:dev=1' with equivalent 'ec:type=pd'. BUG=b:153024532 BRANCH=none TEST=emerge vboot_reference Change-Id: Ic8df99fcdc3769bec19054b1936b97b14bade0e7 Signed-off-by: Nikolai Artemiev <nartemiev@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2151492 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* vboot: Add VB2_ERROR_UI_MEMORY_ALLOC to vb2_error_tYu-Ping Wu2020-04-161-0/+3
| | | | | | | | | | | | | | Add VB2_ERROR_UI_MEMORY_ALLOC for memory allocation failure in UI. BRANCH=none BUG=b:146399181 TEST=emerge-nami vboot_reference Change-Id: Ib6d8ccbfe73f90297f400430b4ae1204adbf7ee4 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2152331 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove more unused pre-vboot1 and vboot1 error codesJoel Kitching2020-04-161-25/+0
| | | | | | | | | | | | | | BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I24c867af25726f84a4ada18477de66579975a383 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2150182 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Remove VB2_SCREEN_TOUCHPAD_SYNC from vb2_screenYu-Ping Wu2020-04-141-2/+0
| | | | | | | | | | | | | | | The touchpad sync screen is rendered in kernel instead of firmware, so remove it from enum vb2_screen. BRANCH=none BUG=none TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: I5929ecec51bee1aa36d6abf04bb733fde46ac29c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2148552 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: clear recovery request in all boot modesJoel Kitching2020-04-143-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>
* vboot: Add a leading space before labelsYu-Ping Wu2020-04-092-2/+2
| | | | | | | | | | | | | | The following command is run: grep -rlE '^\w+:' firmware | xargs -l sed -i -E 's/^\w+:/ \0/g' BRANCH=none BUG=none TEST=emerge-nami vboot_reference Change-Id: I4dedd1107e71add07f51e32925757680e780c882 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2143017 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Add VB2_ERROR_UI_INVALID_LOCALE to vb2_error_tYu-Ping Wu2020-04-071-0/+3
| | | | | | | | | | BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: I8c0e37adc4f37900a5e426f24a581befb07c6a34 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2137152
* vboot: Add firmware sync screens to vb2_screenYu-Ping Wu2020-04-071-1/+5
| | | | | | | | | | | | | Add VB2_SCREEN_FIRMWARE_SYNC and VB2_SCREEN_TOUCHPAD_SYNC screens to enum vb2_screen. BRANCH=none BUG=b:146399181 TEST=USE="menu_ui" emerge-nami depthcharge Change-Id: Iddcd77bb79be7a29346d82b70a8dbb82d0b33fcb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2137151
* Rewrite algorithm type parsers and make them globally availableJulius Werner2020-04-0618-353/+460
| | | | | | | | | | | | | | | | | | | | | There is some code strewn around between futility and the vb21-specific part of hostlib to allow parsing of textual algorithm names to vboot enums, but it is somewhat disorganized and not written in a super efficient way. This patch rewrites it and centralizes all the algorithm mapping stuff under 2crypto.c so it can be a single source of truth for all of vboot. (String parsing routines still need to stay in hostlib since not all firmware targets support things like stroul() and strcasecmp().) BRANCH=None BUG=None TEST=make runtests Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I719b2499992a6e4395a29231bc8b9a7680c5b174 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2099447 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* 2secdata_kernel: Fix debug messagesstabilize-sylas-13019.Bdnojiri2020-04-021-3/+3
| | | | | | | | | | | BUG=none BRANCH=none TEST=Verified on Puff. Signed-off-by: dnojiri <dnojiri@chromium.org> Change-Id: I7e33abcf0832f83530e94cc37117c03fe164bbdb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2132716 Reviewed-by: Julius Werner <jwerner@chromium.org>
* ec_sync: Ignore NO_BOOT when GBB says DISABLE_EC_SOFTWARE_SYNCdnojiri2020-04-012-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, there is a final guard in VbSelectAndLoadKernel to enforce NO_BOOT unconditionally. This makes a board with VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC unable to boot if Hmir != Heff because Hmir will never be synced. If a system doesn't boot, set_gbb_flags.sh can't be used to enable software sync. This patch skips the final guard if VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC is set. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=chromium:1045217 BRANCH=none TEST=make runtests Change-Id: I0c7f8c90cb0a6bb54ce30ef42e4d62554decb872 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2129107 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* ec_sync: Reset EC after updating Hmirdnojiri2020-04-013-0/+27
| | | | | | | | | | | | | | | | | | | | | | This patch makes vb2api_sync_ec reset EC whenever Hmir is update because the verification result should be revoked. When Hmir is corrupted, the system enters NO_BOOT mode (and EC stays in RO). Since Heff == Hexp, EC RW won't be updated but we need to reset EC so that EC can jump to RW by EFS2. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=chromium:1045217 BRANCH=none TEST=Verify firmware_SoftwareSync passes. Change-Id: I21887e212cfefedeadf4c146ecec290022bb2b34 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2122587 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Add a blinking cursor to the vendor promptMathew King2020-03-313-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>
* vboot: stop using StrnAppend and Uint64ToStringJoel Kitching2020-03-3140-393/+66
| | | | | | | | | | | | | | | | | | | Use snprintf instead. Remove utility_string library. Also, prepare VbDisplayDebugInfo to handle 64-byte nvdata. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests TEST=boot with 16-byte nvdata, check <TAB> output (one line) TEST=boot with 64-byte nvdata, check <TAB> output (five lines) BRANCH=none Change-Id: If6c4b3a4e9fa7b71cb2d8ca7ccd37e4f36b97fd6 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2122061 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2104880 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* firmware: Add VB2_TRY() helper macroYu-Ping Wu2020-03-3117-284/+189
| | | | | | | | | | | | | | | | | | | | | | | Add variadic macro VB2_TRY() to vboot2 APIs, which supports the following usage: - VB2_TRY(func_call()) - VB2_TRY(func_call(), ctx, recovery_reason) and will return the error code if func_call() failed. Also utilize the macro whenever possible throughout vboot. BRANCH=none BUG=chromium:1049032 TEST=make runtests TEST=emerge-nami coreboot coreboot-utils depthcharge -j Cq-Depend: chromium:2115423, chromium:2125616, chrome-internal:2817320 Change-Id: Ie5532a8beaa9372fa6fde0a68bda5ecb640087c4 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2084062 Reviewed-by: Julius Werner <jwerner@chromium.org>
* updater: Add Drallion to the wilco quirk listDuncan Laurie2020-03-311-0/+2
| | | | | | | | | | | | | | | Add the Drallion board to the list of sarien/arcada so it gets the workaround to lock the CSME on dogfood units safely. BUG=b:152475734 BRANCH=none TEST=none Signed-off-by: Duncan Laurie <dlaurie@google.com> Change-Id: I2119f64d5935d3462f0f7ad27d255ec259733553 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2127313 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* Makefile: Explicitly signal success at the end of 'make runtests'Julius Werner2020-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | If you run 'make runtests' with -j (as you should because it takes forever), it can be hard to see if it passed successfully. A 'make: *** [Makefile:XXX: ...] Error 255' line might hide somewhere in the middle with a lot of successful output from other tests running in parallel hiding it. It's hard (I think?) to have make output something at the end (after joining all processes) when it has encountered an error, but at least it is easy to output something when the 'runtests' target finishes successfully. This patch adds such a highly visible success message, so that its absence will make it clear that there was an error further up. BRANCH=None BUG=None TEST='make runtests', both passing and failing Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: If979a7635f5c05c44a92daca12d31e344563794c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2116750 Reviewed-by: Joel Kitching <kitching@chromium.org>