summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: Cover a few assorted new casesstabilize-10443.BRandall Spangler2018-02-266-6/+61
| | | | | | | | | | | | | Assorted addtional tests to improve coverage of the firmware libraries. BUG=none BRANCH=none TEST=make runtests Change-Id: Iaf707bd54ca5dc10745eb19dfa9e9afbf0d74112 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/927608 Reviewed-by: Julius Werner <jwerner@chromium.org>
* tpm: Add extern "C" declaration for C++ compatibility.firmware-kbl-10431.BMattias Nissler2018-02-221-0/+8
| | | | | | | | | | | | | | | | | The mount-encrypted utility, which includes tlcl.h is in the process of being converted to C++. To simplify inclusion in C++ code, add the standard extern "C" linkage specifiers. BRANCH=none BUG=chromium:808303 TEST=compiles Change-Id: I8a99a0e5cfcce64b27cad10735b08ba40434b222 Reviewed-on: https://chromium-review.googlesource.com/915345 Commit-Ready: Mattias Nissler <mnissler@chromium.org> Tested-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* Always enter BROKEN screen in non-manual recovery, even in dev modeJulius Werner2018-02-203-15/+13
| | | | | | | | | | | | | | | | | | | | Previously, non-manual recovery behavior would depend on the developer mode switch: in normal mode it would get stuck at the BROKEN screen, but in developer mode it would proceed exactly like manual recovery. This behavior was mostly just confusing to people and it seems that we have no real use case for it anymore. Remove the developer mode special case so that non-manual recovery will always go to the BROKEN screen from now on. BRANCH=scarlet? BUG=None TEST=make runtests, verified manually on Scarlet and Kevin Change-Id: Iaf33f82d7cb709a5ee309c08d1ad3015859738b3 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/924458 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Clear OPROM_NEEDED on EC update before rebootDaisuke Nojiri2018-02-161-0/+3
| | | | | | | | | | | | | | | | | | This patch makes ec_sync_all clear OPROM_NEEDED flag when ec_sync_phase2 updates EC and requests reboot. Without this change OPROM_NEEDED flag will stay forever because after reboot need_wait_screen won't be set (thus line 90 won't be reached). BUG=b:72387533 BRANCH=none TEST=Verify firmware screens are displayed on type-c monitor: developer warning screen, critical update screen, recovery screen. Change-Id: I9cc072efbf937ac438b55f3812f677612f79eaf9 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/916635 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Allow 'Tab' to display debug info on all screensJulius Werner2018-02-082-0/+55
| | | | | | | | | | | | | | | | | Since we're continuing to support the boot shortcuts Ctrl+D, Ctrl+U and Ctrl+L, it makes sense to also continue to support the debug info shortcut Tab, just in case somebody may want to use it from an external keyboard. This does not affect the existing method to display debug info through the appropriate menu option in any way. BRANCH=None BUG=b:73080278 TEST=make runtests, booted Scarlet and pressed Tab on UART. Change-Id: Ia08404e0ffd1f8cac3d85f3b2fc4ce17a21d743d Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/907759 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* image_signing: delete old crosh_workarounds logicMike Frysinger2018-02-081-8/+0
| | | | | | | | | | | | | | | We deleted crosh workarounds logic years ago (e.g. CL:178932), so drop references here too. BUG=None TEST=precq passes BRANCH=None Change-Id: I2b195a7ca863101be35a4bfde29d7950a96c1edd Reviewed-on: https://chromium-review.googlesource.com/907069 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>
* Request cold reboot when switching to dev modeDaisuke Nojiri2018-02-082-2/+2
| | | | | | | | | | | | | | | | | | When switching from normal to dev mode, the EC is in RO. AP requests warm reboot, whic causes EC to jump to RW. After sysjump, RW tries to renegotiate PD but it's too late for type-c monitor to function because VBIOS has already run. This patch makes AP request EC reboot when switching to dev mode. BUG=b:73083750 BRANCH=none TEST=Dingdong connected to Teemo. Verify norm-to-dev screen is displayed. make -j runtests. Change-Id: I763cd6968406f7b904604b2588a9db6d567cbd4e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/907734
* vboot_api: Remove unused VB_SCREEN constantsJulius Werner2018-02-072-12/+3
| | | | | | | | | | | | | | | | | Some of the defined screens have never been used or we've stopped using them a while ago. Remove the respective constants to make it clearer that callers of the library are not expected to handle them. CQ-DEPEND=CL:903362 BRANCH=None BUG=None TEST=make runtests Change-Id: I82308fc76dc10b2c8b408af7a15a819120043632 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/902899 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* image_signing: Support AOSP dev signing keysNicolas Norvez2018-02-061-10/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | Following ag/3536780, aosp_cheets targets have their APKs signed with keys https://android.googlesource.com/platform/build/+/master/target/product/security/ The image signing script now: - detects if it's an aosp_cheets or cheets build - checks the correct signing keys have been used in either case - logs more information about the Android image BUG=b:72947583 TEST=manually test sign_framework_apks against AOSP and cheets builds TEST=aosp_cheets builds prior to ag/3536780 are now failing (expected) TEST=aosp_cheets builds posterior to ag/3536780 are passing TEST=cheets builds (before and after) are passing TEST=check that commenting out ro.product.name in build.prop triggers an error TEST=check that an invalid value in ro.product.name triggers an error BRANCH=None Change-Id: I72abea5182fbfe76820e3f48831be04f39cb334e Reviewed-on: https://chromium-review.googlesource.com/904726 Commit-Ready: Nicolas Norvez <norvez@chromium.org> Tested-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* cgpt: add support for managing GPT platform required partition bitBen Chan2018-02-0612-5/+69
| | | | | | | | | | | | | | | | Bit 0 in the GPT partition attributes is defined to indicate whether a partition is required by the platform. This CL adds the support for managing this bit to cgpt. BUG=b:70807006 BRANCH=None TEST=Run unit tests. Change-Id: Iaf87c828438b3df6730de502ae420fcf4c61277b Reviewed-on: https://chromium-review.googlesource.com/902196 Commit-Ready: Ben Chan <benchan@chromium.org> Tested-by: Ben Chan <benchan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* make_dev_firmware.sh supports switching EC RO keyWai-Hong Tam2018-02-023-134/+240
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the EC supporting EFS boot, the RO section contains a public key, and the RW is signed. For running FAFT, should replace the RO key to a known one (the dev key under vboot_reference), such that FAFT tests can resign the RW using a known private key. For BIOS image, we use make_dev_firmware.sh to do a similar job to replace the key in BIOS. This CL makes the make_dev_firmware script support changing EC key. BUG=b:71769443 BRANCH=none TEST=Modify files $ # Check the original BIOS and EC images $ futility show ec.bin $ futility show bios.bin $ ./make_dev_firmware.sh --change_ec -f bios.bin -t new_bios.bin \ -e ec.bin -o new_ec.bin --backup_dir backup $ # Check the new images, using new keys and verification succeeded $ futility show new_ec.bin $ futility show new_bios.bin TEST=Modify live firmware $ ./make_dev_firmware.sh --change_ec And then run firmware_ECUpdateId with a Type-C charger. TEST=Run sign_official_build.sh $ sign_official_build.sh recovery recovery_image.bin \ ~/trunk/src/platform/vboot_reference/tests/devkeys /tmp/out.bin TEST=make runalltests Change-Id: Id51e2c411a4e6d016e619cec91453ce918b7fff7 Reviewed-on: https://chromium-review.googlesource.com/889406 Commit-Ready: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* detachables: Ensure menu_idx can't be used uninitalizedMartin Roth2018-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | This fixes a warning with GCC 6.3: firmware/lib/vboot_ui_menu.c: In function 'enter_developer_menu': firmware/lib/vboot_ui_menu.c:211:2: error: 'menu_idx' may be used uninitialized in this function [-Werror=maybe-uninitialized] vb2_change_menu(VB_MENU_DEV, menu_idx); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST=Build BUG=None BRANCH=None Change-Id: Idd9449322cccca66d8bd8796a444b9a8ceea9d11 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://chromium-review.googlesource.com/897910 Commit-Ready: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Test ALL the units!Julius Werner2018-02-011-397/+1705
| | | | | | | | | | | | | | | This patch adds a bunch of new unit tests for the detachable UI and enhances some of the existing ones to more explicitly check more things. BRANCH=None BUG=b:65025540 TEST=make runtests. I actually found a real bug in my previous patch, so that's nice... and COV=1 make gives me 96.9% of lines covered in vboot_ui_menu.c, with 28 out of 28 functions touched. Change-Id: I7737a7e62d4b7e01ea98e6a0f1dd098716582794 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/894292
* detachables: Refactor BROKEN screen handling, add OPTIONS menu to itJulius Werner2018-01-311-42/+45
| | | | | | | | | | | | | | | | | | | | This patch factors the code handling the BROKEN screen out of the recovery_ui() function since it's already pretty much a completely separate piece anyway. It is also rewritten to more closely match the other UI loops and to use the same OPTIONS menu that allows language and debug info access as the existing manual recovery UI. BRANCH=None BUG=b:64400036 TEST=make runtests, boot Scarlet in non-manual recovery mode and play with OPTIONS menu. Also check manual recovery mode menu again, and confirm that language selections and recovery reasons persist when initiating manual recovery from the BROKEN screen. Change-Id: Ib680c4e30d728c16a3661041d9b2987648e592e3 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/892280 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Factor out common UI loop input handlingJulius Werner2018-01-311-73/+58
| | | | | | | | | | | | | | | | | | Most of the UI loop input handling is essentially the same between the developer and recovery mode interfaces. This patch factors it out into a separate function, which reduces duplication and will make it easier to add a third UI for non-manual recovery mode. BRANCH=None BUG=None TEST=make runtests, played around with menus on Scarlet Change-Id: I75751770a81eb373f8bc7ed0e5f5dfcb6d2bd464 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/892279 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: The Big RefactorJulius Werner2018-01-314-806/+585
| | | | | | | | | | | | | | | | | | | | | | | | | This patch shuffles around most of the detachable UI code to try to make it more readable and maintainable. The goal is to get the business logic out of the main UI loop functions as much as possible, and concentrate the code handling each individual menu option in a single location. This is a pure refactor and should not change behavior in any (important) way. The adjustments to unit tests are only needed since the old code displayed the same screen twice in certain circumstances, and returning from the LANGUAGE menu to DEVELOPER selected the default option Power Off, although other transitions to that screen select the current default boot target. BRANCH=None BUG=None TEST=make runtests, boot Scarlet and play with all screens. Change-Id: Ibe05cbcb23c964d81f80de741bbd6f2231a2522d Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888082 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: Combine set_menu_items and set_disabled_idx_maskJulius Werner2018-01-311-58/+35
| | | | | | | | | | | | | | | | | | The disabled_idx_mask always needs to be set according to the current menu, so it makes sense to combine this task with the function that changes menus. Call the new function vb2_change_menu() to indicate its broader set of responsibilities. BRANCH=None BUG=None TEST=make runtest Change-Id: I122783cbc0b35d0d9e866f614646865c5c8a0ed0 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888081 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: Remove obsolete RECOVERY menuJulius Werner2018-01-313-54/+1
| | | | | | | | | | | | | | This patch removes the RECOVERY menu that is no longer being used. BRANCH=None BUG=None TEST=make runtests Change-Id: I069101ab1418779e2cc4a9f6d1b39166ba2b37ed Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888080 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Replace RECOVERY with OPTIONS menuShelley Chen2018-01-253-198/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the new OPTIONS menu which will function in stead of the old basic RECOVERY menu. The TO_DEV menu is now directly reachable through the VolUp+VolDown key combo. Cancelling any menu or changing USB state will immediately drop back to the menuless base screens (INSERT or NOGOOD). Also contains some minor clean-up here and there, like decoupling code from tests a bit more by reducing reliance on global initializers. Code for the now obsolete RECOVERY menu will be removed in a follow-up patch. BUG=b:67371896, b:64400036 BRANCH=None TEST=Go through all recovery screens, trry various back-and-forth transitions between OPTIONS, LANGUAGE and TO_DEV, in addition to inserting/removing USB at various times. CQ-DEPEND=CL:884840 Change-Id: I95319778e14ce07fe2ada3edf95990560ac7081a Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/770258 Commit-Ready: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* detachables: Define options menuShelley Chen2018-01-233-0/+23
| | | | | | | | | | | | | | | | | This menu will be used by any of the legacy screens. The idea is that when the user hits volume up/down, then they will enter this options menu, which will allow the user to change languages or show debug info. BUG=b:67371896, b:64400036 BRANCH=None TEST=None Change-Id: I31d3e312388b56613368276ec72e5c68ded2264e Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/770257 Commit-Ready: Benjamin Gordon <bmgordon@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ec_sync: Commit NVRAM updates before battery cutoffBrian Norris2018-01-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Battery cutoff may cause the entire system to lose power, which means that any uncommitted nvram updates will be lost. This can leave us in a battery cutoff loop, where we never completely clear the BATTERY_CUTOFF_REQUEST flag before actually cutting off power. The only way to escape this potential cutoff loop is if we manage to cleanly exit to vb2_kernel_cleanup(), where we perform a similar commit. But this requires us to retain power for some time after VbExEcBatteryCutOff(). BRANCH=none BUG=b:70176744 TEST=`crossystem battery_cutoff_request=1` on scarlet, then reboot; see battery cutoff; plug in AC and observe whether we reliably boot on first attach Change-Id: I1acf3aaeaf76f97f7603f79dbfef7a24a96f36dc Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/876783 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* image_signing: Add sha1sum of keys in keyset to VERSION.signer.stabilize-10323.31.Bstabilize-10323.30.Bstabilize-10323.29.Bfactory-soraka-10323.BMarco Chen2018-01-161-0/+9
| | | | | | | | | | | | | | | | | | | | To record sha1sum of keys in keyset can help loem or unibuild projects to verify 1. whether rekey process is performed correctly during the factory build. 2. whether HWID database is updated correctly. BUG=chromium:763328 TEST=1) modify loem.ini to match what coral is. 2) ~/trunk/src/platform/vboot_reference/scripts/image_signing/sign_official_build.sh recovery ./chromeos_10308.0.0_coral_recovery_dev-channel_mp-v4.bin ./src/platform/vboot_reference/tests/loemkeys ./output.bin 3) verify output file - VERSION.signer. BRANCH=none Change-Id: I80deadb04d9dc0eb66fc5ac45dce84e6f41f1a16 Signed-off-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/866522 Reviewed-by: Simon Glass <sjg@chromium.org>
* image_signing: Fix the wrong output to VERSION.signer.Marco Chen2018-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | The helper function - info redirects msg to stderr and appends some backslash escapes so 1. it can't be redirected to VERSION.signer via stdout again. 2. Even if change to stderr, we also don't want these appended msg. BUG=chromium:760879 TEST==~/trunk/src/platform/vboot_reference/scripts/image_signing/sign_official_build.sh recovery ../build/images/coral/latest/recovery_image.bin ../platform/vboot_reference/tests/devkeys BRANCH=None Change-Id: I46d560fb4cb93756fd02e32412410afb3a4db0e2 Reviewed-on: https://chromium-review.googlesource.com/861694 Commit-Ready: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Revert "Makefile: Build futility without utillib to extend arch support"Randall Spangler2018-01-111-25/+22
| | | | | | | | | | | | | | | | This reverts commit f59d2e41977032f8f3eac113358b93574fc27b4f. The change breaks 'make runtests'. More specifically, 'make runfutiltests'. Also, fix the duplicate FWLIB20 in LDLIBS when linking futility. BUG=None BRANCH=None TEST=make runtests (more specifically, make runfutiltests) Change-Id: Ia079924a814d98e1a3937b8de6ade7b001ff70ef Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/832848
* Makefile: Add pthread library to the futility static buildPaul Kocialkowski2018-01-111-1/+1
| | | | | | | | | | | | | | This adds the pthread library to the linker flags for the static futility build, which allows it to build with recent GCC versions. BUG=None BRACH=None TEST=Build futility and futility_s with a recent GCC version Change-Id: I16d9b94b76d6e9586278cfdc0b99ae749160138a Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/805374 Reviewed-by: Martin Roth <martinroth@chromium.org>
* firmware: Stop using vboot1 cparams internallyRandall Spangler2018-01-0918-217/+161
| | | | | | | | | | | | | | | | | | Now that vb2_shared_data / vb2_context provides all the same data to lower-level kernel verification code that cparams did, stop passing cparams down to those functions. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I86eb1801ee96d8b56404b74843a8d09e3122567f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852814 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Prune down old region APIRandall Spangler2018-01-0925-635/+188
| | | | | | | | | | | | | | | | | | | | | | | | The region API was a way for firmware and kernel verification to get at various blocks of caller-provided data. In practice, we only used it internally as a way to get at parts of the GBB. Prune it down to access only the bits of GBB we still need, from the buffer we already know we have. In the long run we should use the same vb2ex_read_resource() API that vb2 firmware verification does, but that should be done in a follow-up CL since it'll need to be coordinated with support in depthcharge. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I5715cb8d88274164a1a73ed4a56bbd93af46f9bf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852798 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Include vb1 shared data in vb2 structRandall Spangler2018-01-0918-54/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, firmware verification uses entirely vb2 structs, including vb2_shared_data. This goes through an ugly translation to the old vb1 VbSharedData to pass it to depthcharge. The vboot kernel verification maintains an equally ugly translation back to the vb2 struct internally. Eventually, we want to get rid of all that and use vb2 all the way down to what crossystem picks up from the OS. But before we can do that, we need to finish translating kernel verification code to use the new vb2 structs. This is a step on that path, using vb2_shared_data equivalents where present and hiding the old vb1 shared data struct as a member of vb2_shared_data so at least the vboot functions don't need to pass around cparams to get at it. This will be followed by more CLs which convert more vboot internals to use vb2 structs directly, and eventually coreboot/depthcharge CLs which pass the vb2 structs from firmware verification directly to kernel verification. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I5df8ce81ba3c3ac3f2cb4229db5461757cd89d8d Reviewed-on: https://chromium-review.googlesource.com/852856 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Remove bmpblk codeRandall Spangler2018-01-0915-656/+61
| | | | | | | | | | | | | | | | | | | | All screens are now drawn by depthcharge. ToT firmware does not include a bmpblk / bmpfv section in the GBB. Remove the code paths which are no longer used. Also drop a few cparams parameters from functions that no longer use it, now that those functions don't need to access the GBB. BUG=chromium:502066 BRANCH=none TEST=make -j runtests; build bob firmware and check recovery screens Change-Id: I4d2d0a3ba57c34151e65c6f42581df823192a4ae Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852371 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* ec_sync: Use vboot2 context instead of cparamsRandall Spangler2018-01-096-58/+84
| | | | | | | | | | | | | | | | | | | Copy sync-related flags from cparams / vboot1 shared data to the equivalent vboot2 structs. This removes the need for ec_sync to access the old structs, which are on their way out. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I50ee76cf275a7fba894c2ec2c3dd83b9a8d91b53 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852489 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* image_signing: ensure_no_password.sh: support mounted rootfs dirsMike Frysinger2018-01-081-7/+16
| | | | | | | | | | | | BRANCH=None BUG=chromium:714598 TEST=signing images still works Change-Id: Icc848e49b35aa29c1a1206fa9f351be6ec252b13 Reviewed-on: https://chromium-review.googlesource.com/852675 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>
* firmware: Align workbuf used sizeRandall Spangler2018-01-0517-114/+160
| | | | | | | | | | | | | | | | | | | | | | | | Previously, workbuf used was not rounded up to a multiple of VB2_WORKBUF_ALIGN. The next allocation would be aligned, but not until it was made. Change this to round up used size when more workbuf is used. This provides better predictability of where the next allocation will be placed. Uncovered this problem when I added a new member to vb2_shared_data which changed its size so it wasn't a multiple of VB2_WORKBUF_ALIGN, and the vb20 and vb21 unit tests which tried to simulate not enough buffer broke in strange ways. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I0157a1c96326f7fce6be6efbd74d90c3d2942268 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852488 Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: simplify audioRandall Spangler2018-01-0511-854/+261
| | | | | | | | | | | | | | | | | | | | | | Vboot firmware previously supported a rather complex audio looping library. Our original intent was to allow developers to flash a custom beep sequence / tune as an easter egg. We never fully supported that, but the code to allow it lived on. Get rid of that. Vboot also previously made no assumptions about the frequency of VbExGetTimer(), which was only used by the vboot_audio library. So it spent 10ms every boot measuring the frequency. Which is silly now, because depthcharge implements that as a microsecond timer. Get rid of that measurement and define the timer as a microsecond timer. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I350246874fb36b00149423696285cfcaca0fc526 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847311 Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: use sd->gbb_flagsRandall Spangler2018-01-0510-60/+81
| | | | | | | | | | | | | | | | | | Vboot1 code directly referenced the GBB from cparams even though now it has access to the GBB flags via the vb2 context. Refactor all existing code to use the vb2 context, since that takes us one step closer to getting rid of the old vboot1 cparams. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: Ic4a5bf215b723a2eacbf0a4cf0eba8b1338155a2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847310 Reviewed-by: Shelley Chen <shchen@chromium.org>
* make_dev_ssd: Fix help message.You-Cheng Syu2018-01-041-1/+1
| | | | | | | | | | | | | | Fix the indent and content of the help message. BRANCH=none BUG=none TEST=./make_dev_ssd.sh -h Change-Id: I12f0de807cf5cb8d6edf7f4a6acdc7c11d0114d9 Reviewed-on: https://chromium-review.googlesource.com/848620 Commit-Ready: Youcheng Syu <youcheng@chromium.org> Tested-by: Youcheng Syu <youcheng@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* image_signing: fix zeroing free spaceAmin Hassani2018-01-031-5/+1
| | | | | | | | | | | | | | | | We are not zeroing the free space properly before signing official images. This patch fixes it by using fstrim instead of dd. More info can be found in CL:751809. BRANCH=none BUG=chromium:780291 TEST=used sign_official_build.sh to sign two recovery images (these images produced <zero-space> file) with dev keys. Then generated delta update between the two new images. This time there was no <zero-space> file between the two images. Change-Id: Ib97fb206f5c8bcfd97c43d075990c7fcdaad6f7e Reviewed-on: https://chromium-review.googlesource.com/848237 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot: introduce get_gbb_flags.shRuben Rodriguez Buchillon2017-12-214-59/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce get_gbb_flags.sh command to make automatic annotation of power measurements easier. Also, fix issue where declaring local variables on same line as executing a command would obfuscate error code, thus not triggering set -c and continuing execution. https://github.com/koalaman/shellcheck/wiki/SC2155 Usage: $ /usr/share/vboot/bin/get_gbb_flags.sh [...] ChromeOS GBB set flags: 0x00000329. $ /usr/share/vboot/bin/get_gbb_flags.sh -e [...] ChromeOS GBB set flags: 0x00000329. ChromeOS GBB set flags listed: GBB_FLAG_DEV_SCREEN_SHORT_DELAY GBB_FLAG_FORCE_DEV_SWITCH_ON GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK GBB_FLAG_FAFT_KEY_OVERIDE GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC BUG=chromium:760267 BRANCH=none TEST=manual emerge-soraka vboot_reference cros deploy <IP> vboot_reference (on DUT) /usr/share/vboot/bin/get_gbb_flags.sh -e <same output as above> Change-Id: Idb3b993706c03e7f2831eed2cef12a04b9469fea
* detachables: Add unit testsShelley Chen2017-12-192-0/+936
| | | | | | | | | | | | | | | | | | Initial unit tests for detachable menu UI. With these tests, the coverage is at 81.2% for lines for code and 87.5% for function coverage. I will improve this to closer to 100%, but wanted to get this in as it's still significantly better than before, which was 0%. There are still a lot of tests in the code that are #if 0'd out currently. I still need to go through an enabled/delete those. BUG=b:65025540 BRANCH=None TEST=run COV=1 make and make sure passes without errors Change-Id: If17bfc24fb7f65deb3d2286cc39cdc311d8a6d93 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/830680 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detach_ui_test: Move variables needed for unit tests to private fileShelley Chen2017-12-182-69/+85
| | | | | | | | | | | | | | | Creating a unit test for testing the detachable UI menus. It'll need access to some previously static variables that we will move into this new file. BUG=b:65025540 BRANCH=None TEST=emerge-fizz vboot_reference with no errors Change-Id: I249b152380dd55160e151506e00efd23bbbd1a5b Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/830679 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile: Build futility without utillib to extend arch supportPaul Kocialkowski2017-12-181-23/+26
| | | | | | | | | | | | | | | | | | | This removes utillib from the futility build and adds only the required files from utillib to its build. Utillib includes arch-specific components (required for crossystem) that only have a limited number of supported architectures, which is undesirable for futility. The number of archs that futility can run on is no longer restricted. BUG=None BRACH=None TEST=Build futility and futility_s Change-Id: Ia9ad2a72b374b5cc3d6004d36c0b7090dbcc97a2 Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/666625 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* Makefile: Add support for aarch64 arch for crossystem buildPaul Kocialkowski2017-12-181-0/+2
| | | | | | | | | | | | | | This handles the aarch64 machine returned by uname as arm to allow crossystem to build. BUG=None BRACH=None TEST=Build futility and futility_s on ARMv8 Change-Id: I1d847568a36f47d084e7572b28e2603b9b6ec673 Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/785911 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Revert "vboot: Fix INSERT screen error when valid Kernel USB is not inserted"Philip Chen2017-12-121-3/+1
| | | | | | | | | | | | | | | BUG=b:70538502 BRANCH=none TEST=enter VB_MENU_TO_DEV reliably This reverts commit 805726997cc7c3a95b1fd24de5e6909712e4f11c. Change-Id: I08a29084ac9ae53794fd5c44128e06ad6e2faea9 Reviewed-on: https://chromium-review.googlesource.com/822050 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* vboot: Use 2nvstorage instead of vboot_nvstorageRandall Spangler2017-12-1135-1549/+413
| | | | | | | | | | | | | | | | | | Remove the old vboot1 vboot_nvstorage library (VbNv*() functions) and use the vboot2 library (vb2_nv_*()) instead. This is needed in preparation for moving to 64-byte records; no sense in implementing that change twice... Should be (better be) no change in system behavior. BUG=chromium:789276 BRANCH=none TEST=make runtests compare output of crossystem before/after change (should be identical) Change-Id: I10f9975b0824263064b9a74a3c6daadcecc085d3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/794732
* vboot_ui_menu: honour power button press in RECOVERY_NO_GOOD_SCREENRizwan Qureshi2017-12-111-1/+2
| | | | | | | | | | | | | | | | | Curretly power button press is ignored in RECOVERY_NO_GOOD_SCREEN, Allow user to power off system from RECOVERY_NO_GOOD_SCREEN. BUG=None Branch=None Test=verify that the system powers of from NO_GOOD screen. Change-Id: I768cd5a448c4493a4d9de756b2047c19cdf961ef Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/812304 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: Fix INSERT screen error when valid Kernel USB is not insertedBarnali Sarkar2017-12-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | In Recovery Mode, when an USB key is inserted where valid OS is not present, it shows "VB_SCREEN_RECOVERY_NO_GOOD" screen. But, once removing that USB key, the screen should go back to INSERT screen again. This functionality was not working after the below Commit - I2bab22fcbb0bb3cdfffe585eb633231ba8015fc3 This patch fixes this issue by assigning the current_menu as "VB_MENU_RECOVERY_INSERT" every time when there is No Disk found. BUG=none BRANCH=none TEST=Tested on Soraka to check that INSERT screen comes back once Non-Valid OS Pendrive is removed from board. Change-Id: I74efff562ba00a3e96b82ee158f9613f53c059b5 Signed-off-by: Barnali Sarkar <barnali.sarkar@intel.com> Reviewed-on: https://chromium-review.googlesource.com/810824 Commit-Ready: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot_ui: Let keyboard power button shut down systemDaisuke Nojiri2017-12-082-17/+54
| | | | | | | | | | | | | | | | | | This patch allows a power button on a keyboard to shut down the system when waiting for a user interaction at a firmware screen. The firmware menu, which is implemented by vboot_ui_menu, shouldn't be affected. BUG=b:70244028 BRANCH=none TEST=Verify power button on Fizz can shut down the system at recovery screen, broken screen, todev scree, and user confirmation screen using a USB keyboard and a servo. Verify recovery button can confirm dev mode transition. Run 'make runmisctests' successfully. Change-Id: Icc7d7a774da19acac3d2938d5748ad2323ba4856 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/811444 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* firmware: header tweaks for depthchargeRandall Spangler2017-12-012-1/+2
| | | | | | | | | | | | | | | | | | | Depthcharge currently includes vboot_nvstorage.h directly, instead of including only the API header files directly. Add 2nvstorage.h to the list of headers which can be requested impolitely. Also fix the definition of ARRAY_SIZE to match exactly what depthcharge and coreboot provide, so that the compiler does not get sad when it's included from both libpayload.h and 2common.h. BUG=chromium:789276 BRANCH=none TEST=make runtests; emerge-reef depthcharge coreboot Change-Id: Idc0390eaf813c3079df1676781e8bf5bc9b46450 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/802176 Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: create menu items for legacy screensstabilize-10176.65.Bstabilize-10176.58.Bstabilize-10176.54.Bstabilize-10176.47.Bstabilize-10176.13.Brelease-R64-10176.BShelley Chen2017-11-231-2/+18
| | | | | | | | | | | | | | | | | Previously, we didn't require any action on these legacy screens, so didn't update current_screen when displaying these. Now, will be adding language switching and debug display for these screens, so need to keep track of them. BUG=b:65470853, b:67371896, b:64400036 BRANCH=None TEST=None Change-Id: I2bab22fcbb0bb3cdfffe585eb633231ba8015fc3 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/676269 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix vboot compilation with coreboot-sdkStefan Reinauer2017-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=Upstream builder does not fail with uninitialized variable anymore like this: firmware/lib/vboot_ui_menu.c: In function 'vb2_get_current_menu_size': firmware/lib/vboot_ui_menu.c:255:15: error: 'temp_menu' may be used uninitialized in this function [-Werror=maybe-uninitialized] *menu_array = temp_menu; ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Change-Id: Idb1690c7b0becf3556cad379160fe152707ae843 Reviewed-on: https://chromium-review.googlesource.com/777805 Commit-Ready: Stefan Reinauer <reinauer@google.com> Tested-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: Use kernel max rollforward NV storage fieldRandall Spangler2017-11-172-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel verification will now roll forward the minimum allowable version in the TPM no farther than the kernel_max_rollforward setting. Note that CL:765573 changes chromeos-setgoodkernel so it always sets kernel_max_rollforward to 0xfffffffe when marking a kernel as good. That ensures that firmware with this setting will behave the same for now as existing firmware. BUG=chromium:783997 BRANCH=none CQ-DEPEND=CL:765573 TEST=make runtests Manual testing: crossystem tpm_kernvel --> print current kernel version in TPM - Resign the kernel with a higher version - Reboot - Wait a minute for chromeos-setgoodkernel to run crossystem kernel_max_rollforward=0 - Reboot crossystem tpm_kernvel --> has not changed - Wait a minute for chromeos-setgoodkernel to run crossystem kernel_max_rollforward -> 0xfffffffe - Reboot crossystem tpm_kernvel --> has changed to the higher version Change-Id: Ia32ecb7fa4078548cd311541ccbe120570cf1bc5 Reviewed-on: https://chromium-review.googlesource.com/765574 Commit-Ready: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>