summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* futility: updater: quirks: Support special released SNOW ROstabilize-atlas-11512.Bstabilize-atlas-11512.6.BHung-Te Lin2018-12-283-1/+6
| | | | | | | | | | | | | | | | A special Snow RO firmware had been released and would break existing platform check: 'Google_Snow_Rev4.2695.128.0'. As a result, we want to bypass platform check in quirk 'daisy_snow_dual_model'. BUG=chromium:917581 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I10b0e4c2b8a11faff979b4add368f342a72a6cec Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1390083 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Joel Kitching <kitching@chromium.org>
* image_signing: drop support for old_verity_argv imagesLaMont Jones2018-12-231-13/+1
| | | | | | | | | | | | | | | | | We changed the verity kernel command line form before R16 was released and included backwards compat support in the scripts for it. But all the devices that were released for these old versions are EOL, and we don't need to sign images that old anymore, so drop support. BRANCH=None BUG=chromium:891015 TEST=precq passes Change-Id: I5cc37fae19fb4b3db229598aa0f5c69a6f32005a Reviewed-on: https://chromium-review.googlesource.com/1387904 Commit-Ready: LaMont Jones <lamontjones@chromium.org> Tested-by: LaMont Jones <lamontjones@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: updater: Correct output version for Snowstabilize-atlas.11448.BHung-Te Lin2018-12-191-0/+2
| | | | | | | | | | | | | | | In quirk daisy_snow_dual_model, after RO is preserved the actual RO version should be updated as well from current image. Without this, reported version may look weird as RO=132, RW=117. BRANCH=None BUG=chromium:915013 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility Change-Id: I1bc6c47a8bd548265fd654dae6ab2a5971d59a1c Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1383631 Reviewed-by: Duncan Laurie <dlaurie@google.com>
* image_signing: fix breakage from dropping <R16 supportMike Frysinger2018-12-151-1/+1
| | | | | | | | | | | | | | | | | Commit 16ceb9625ed13b0da4ae6306f9187b672b9b382f dropped support for old versions, but it also accidentally dropped the salt= setting which ended up breaking newer recovery kernels. Restore that line and drop an unused var from the old code path. BRANCH=None BUG=chromium:891015, chromium:891764 TEST=running `./sign_official_build.sh verify` against the images in crbug.com/891764 works again Change-Id: I8ae619c9243f9c2638962ae439b9df5090d6c535 Reviewed-on: https://chromium-review.googlesource.com/1376831 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>
* futility: update: Fix 'smm_store' unit testHung-Te Lin2018-12-131-2/+2
| | | | | | | | | | | | | | In CL:1351178 the SMM store file name has been changed to 'smm_store' so we have to also change test script. BUG=b:120060878 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility Change-Id: Idc98517cc46a848bb77335214a11fbc9303590f2 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1375494 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot_reference: Merge error beeping, printing, and loggingNick Crews2018-12-134-48/+84
| | | | | | | | | | | | | | | | | | | Added a vb2_error_notify() function that bundles a log message, screen notification message, beep, and flash into one function, since callers were often calling these three things separately. BUG=chromium:899762 TEST=Image still builds and runs on an Aleena, function works on at least one of the calls, the others are harder to test. TEST=make runtests BRANCH=none Change-Id: I82224f8ffa1c326c5e7293a2c00db4dc5d80bf3a Reviewed-on: https://chromium-review.googlesource.com/1330013 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Eugene Hermann <yherman@google.com> Reviewed-by: Nick Crews <ncrews@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: Add 'image.bin' as host image name in archiveHung-Te Lin2018-12-115-19/+42
| | | | | | | | | | | | | | | | | | The firmware updater archive is going to rename the prefix of host (AP) firmware image from 'bios' to 'image' (CL:1318712), to be more consistent with firmware package output. We need to include both old and new names in updater manifest construction. For --mode=output, we will produce both 'bios.bin' and 'image.bin'. In future there should be only 'image.bin' after migration is completed. BUG=b:65745723 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I8b7e3bc2953b70525fb14fcf6aadaf6d1e00e4aa Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1327862
* cgpt: enable calling CgptEditMatt Delco2018-12-063-1/+6
| | | | | | | | | | | | | | | | | | | | | This change allows CgptEdit to be called via the API. Prior to this change link fails in an app that uses CgptEdit due to undefined reference. The underlying implementation wasn't checking set_unique so I've fixed that as well. BRANCH=none BUG=None TEST=Added CgptEdit(0) call to extern.c and verified that build failed. Added cgpt_edit.c to Makefile and confirmed that build is now successful. Successfully ran unit tests on both vboot_reference and the app I'm working on that calls CgptEdit (which also has a unit test for setting the drive ID). Change-Id: Ie0a46ff96406eb83d0564d3f1eac978e0565ed76 Signed-off-by: Matt Delco <delco@google.com> Reviewed-on: https://chromium-review.googlesource.com/1361948 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* rollback_index: add newline to VB2_DEBUG callfirmware-kalista-11343.BJoel Kitching2018-12-031-1/+1
| | | | | | | | | | | BUG=None TEST=None Change-Id: I789caf6fd4410820b9a0c9ef4ed39ad4f4568737 Reviewed-on: https://chromium-review.googlesource.com/1354144 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility/updater: update smm store filename to use an underscoreJoel Kitching2018-12-031-3/+3
| | | | | | | | | | | | | | | Rename "smm store" to "smm_store". Depends on CL:1351857. BUG=b:120060878 TEST=None Change-Id: Iae511ecdc6d918d06218de1b651b1e5e3821d2f1 Reviewed-on: https://chromium-review.googlesource.com/1351178 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* futility: updater: Skip applying white label for local buildHung-Te Lin2018-12-011-1/+8
| | | | | | | | | | | | | | | | | | | | | | For developers running a local build on white label models, currently the chromeos-firmwareupdate will always fail if VPD `whitelabel_tag` is set because the `keyset/` folder does not exist (which was created by signer bot). Developers in this case usually don't really care about which key to use and will be happy with the default (DEV signed) keys, also the key compatibility will be still checked later, so we can skip the white label patching if no keyset folder, which would allow developers getting same experience on WL and non-WL devices. BUG=b:120268135 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I3992301ff4c406096e11e1ae8129f2f68b2319b5 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1356688 Reviewed-by: C Shapiro <shapiroc@chromium.org>
* futility: updater: quirks: Fix firmware names for Veyron familyHung-Te Lin2018-12-011-3/+3
| | | | | | | | | | | | | | The firmware name for Veyron devices are Google_Veyron_XXX and we have to correct the names in quirks database. BUG=chromium:910085 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I3bf3bbb32fe90ebf370c1bc51c54d0280ddb7e98 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1354147 Reviewed-by: Youcheng Syu <youcheng@chromium.org>
* futility: updater: Revise error message when model is not defined in manifeststabilize-11306.BHung-Te Lin2018-11-272-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | "Model '%s' is not defined in manifest." is not very easy to understand for people who are debugging devices in early stages. We should provide better instructions. For example, running with Coral updater will now show: ERROR: manifest_find_model: Cannot get model name. You are probably running an image for wrong board, or a device in early stage that 'mosys' command is not ready, or image from old (or factory) branches that Unified Build config is not updated yet for 'mosys'. Please check command 'mosys platform model', which should output one of the supported models below: unprovisioned_meep sparky orbatrix unprovisioned_fleex grabbiter bobba unprovisioned_bobba mimrock fleex meep yorp phaser360 sparky360 phaser bobba360 unprovisioned_phaser bip BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ib17fcb654d1530b94c44cf21aaa28717841f11ed Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1351171 Reviewed-by: Cheng-Han Yang <chenghan@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* firmware: tpm2_lite: Implement TlclGetRandom()Stephen Boyd2018-11-273-3/+57
| | | | | | | | | | | | | | | | | | Implement support for getting random bytes from the TPM in the tpm2 library. The intent is to use this to seed the kaslr-seed DT property on ARM devices. BRANCH=None BUG=None TEST=Generate some random bytes in depthcharge using this API, and 'stop trunksd; tpmc rand <size>' with sizes (0, 1, 0xf0, and 0xf1) on the device and see the last one fail Change-Id: Ied0dc1ead70ac4daa2cee315516160ec100039be Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1327187 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* test/ec_sync_test: Add mock test for VB_AUX_FW_NO_DEVICE severityKarthikeyan Ramasubramanian2018-11-271-2/+13
| | | | | | | | | | | | | | | | | Add a mock test to handle VB_AUX_FW_NO_DEVICE severity BUG=chromium:896451 BRANCH=None TEST=/mnt/host/source/chromite/bin/cros_run_unit_tests --board=octopus --packages=chromeos-base/vboot_reference Change-Id: Ifdabdf3cee1130a8c853d57c278f0e557ebbb96f Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1299994 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* vboot_api: Add new VB_AUX_FW_NO_DEVICE update severityKarthikeyan Ramasubramanian2018-11-271-3/+5
| | | | | | | | | | | | | | | | | | | There is a possibility that a registered device is not present at run-time and this scenario needs to be handled a little different. Add a new update severity to handle this situation. BUG=chromium:896451 BRANCH=None TEST=bootup to ChromeOS by connecting and disconnecting the USB daughterboard Change-Id: I8a2044ce6a10fe611ee1f47262a7b54598a53ce3 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1299993 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* futility: updater: Revise output messages for debug logsHung-Te Lin2018-11-245-51/+54
| | | | | | | | | | | | | | | | | | | | | | | | In auto update and recovery, the firmware updater was executed with both stdout and stderr logged. However, the logs usually comes with all stderr first then all stdout. This makes it harder to debug because the messages logged in out of order. TO solve that, few macros are introduced: INFO: for useful information. STATUS: the most common information, usually comes with a prefix code. And all messages should now go to stderr except the final execution result (and those output commands, for example --manifest). BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility CQ-DEPEND=CL:1345250 BRANCH=None Change-Id: Ie0dc6594ece10e7e15caf9c36353e2b3ec8754c5 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1345611 Reviewed-by: Youcheng Syu <youcheng@chromium.org>
* futility: updater: Add new quirk 'allow_empty_wltag'Hung-Te Lin2018-11-244-6/+33
| | | | | | | | | | | | | | | There were devices shipped as "only device" (no key set) and then became one of the "white label" family. This is now no longer valid on newer devices but we have to support the legacy ones, for example Reks. BUG=chromium:906962 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I437be08726ab2c46229062689bf765ac6837ca5d Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1345610 Reviewed-by: Youcheng Syu <youcheng@chromium.org>
* futility: updater: Load quirks immediately after host image is loadedHung-Te Lin2018-11-241-13/+32
| | | | | | | | | | | | | | | There may be quirks needed during image archive setup (for example loading white label tags) so we have to move quirks setup to some earlier place. BUG=chromium:906962 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I1f6eddb0119c64098df75bad72809ba8366625c7 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1345609 Reviewed-by: Youcheng Syu <youcheng@chromium.org>
* vboot: correct spacing in 2nvstorageJoel Kitching2018-11-191-0/+4
| | | | | | | | | | | BUG=None TEST=None Change-Id: Ia9a0a7d9aabc298fcbda72371c9b1d2e6b822b17 Reviewed-on: https://chromium-review.googlesource.com/1333092 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: correct spacing for Alt OS in help messagesJoel Kitching2018-11-191-2/+4
| | | | | | | | | | | | | Also, add (writable) at the end. BUG=None TEST=None Change-Id: I34eb1e8e02ba3c837ba5fa452f9f6da64ce7b6e0 Reviewed-on: https://chromium-review.googlesource.com/1328391 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: add alt_os_enabled to show Alt OS stateJoel Kitching2018-11-192-0/+6
| | | | | | | | | | | | | | | | | | | | | Some user-space applications need to know whether Alt OS is currently enabled or disabled. Add alt_os_enabled to crossystem as a read-only flag for this purpose. It is currently based off of reading VBSD_ALT_OS_SHOW_PICKER from VbSharedDataHeader. We may want to change that to a field dedicated to showing Alt OS state in the future (see b/117195332). BUG=b:117195332,b:117142023 TEST=emerge-eve vboot_reference && \ cros deploy --force --board=eve dut vboot_reference Change-Id: Ic9a120e7d24021eb984d501f09ce4d7b6f85d730 Reviewed-on: https://chromium-review.googlesource.com/1328390 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* CHERRY-PICK: vboot: create NVRAM flag to pause after EC software syncJoel Kitching2018-11-196-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, it is impossible to programmatically enable/disable Alt OS mode in eve. This is because only EC-RW supports the kbatboot keyboard matrix functionality. But, as part of the campfire boot flow, the keyboard matrix is retrieved *immediately* after jumping into EC-RW. We need to insert a small pause in order to allow for some entity (autotest/servo) to send a kbatboot command, simulating the Alt OS keyboard press hotkey. BUG=b:117140648,b:118786884 TEST=Manually use crossystem to set post_ec_sync_delay=1 Reboot, and wait for the delay to begin Run `kbatboot 1 4 1` in EC console Check that AP console contains: "vb2_post_ec_sync_hooks: post_ec_sync_delay 5000 ms..." TEST=make clean && make runtests Note that we are only cherry-picking the changes which affect crossystem in this CL. Firmware changes will still live in campfire-eve branch only. Change-Id: I1305357199d87b80b4edc4e311015106ab07de65 Reviewed-on: https://chromium-review.googlesource.com/c/1256644 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Trybot-Ready: Joel Kitching <kitching@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 64d7369976b88b21d8d8a860252023776a2f119e) Reviewed-on: https://chromium-review.googlesource.com/1328389 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: Need --force when re-keying to DEV keysHung-Te Lin2018-11-191-13/+47
| | | | | | | | | | | | | | | | | | | For dogfood devices, we usually will only re-key from DEV to PreMP, and then PreMP to MP. It was found that for retail devices, if WP was disabled (unintended), user may accidentally re-key to DEV keys if they (1) recover with a DEV-signed image, or (2) received an AU that didn't have right signing keys. As a result, we want to make it harder when recovering to DEV keys. BUG=chromium:894324 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Id3f7788e6c86d12b6e37b77818a1b4c2ceda1e2f Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1312596 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* make_dev_ssd.sh: Remind user to reboot after using this script.firmware-rammus-11275.BEnrico Granata2018-11-161-0/+1
| | | | | | | | | | | | | | | | I have one too many times being bitten by forgetting to reboot my DUT between running this tool and trying to flash a new kernel. Make the script remind me of this requirement. BRANCH=none BUG=none TEST=ran script, saw new output Change-Id: I5c4738317087ec7654b13c1c9c3cd67273ba3bf1 Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1330016 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Add a screen showing a menu for alternative firmwareSimon Glass2018-11-1610-63/+320
| | | | | | | | | | | | | | | | | | | | | | | | | | At present we allow the user to press a keypad number to boot into another bootloader but there is no indication which one is which. Add a new screen for this. It is entered via Ctrl-L and shows the available bootloaders, along with the number to press for each. The contents of the screen is rendered by the bootloader, as usual. This is supported by two new screens, one for the keyboard UI and one for the menu UI. Also a new function, VbExGetAltFwIdxMask(), is added to find out what bootloaders are available. Note: This CL combines changes for both UIs. The changes may be easier to review separately. CQ-DEPEND=CL:1273269 BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: Ib3227545dc677c8f9587944753e32f3b49647360 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1273268 Reviewed-by: Julius Werner <jwerner@chromium.org>
* image_signing: make_dev_ssd: Drop max kernel size checkStephen Boyd2018-11-151-5/+0
| | | | | | | | | | | | | | | | | | | We recently expanded the kernel size from 16M to 64M for the generic amd64 image and that's causing problems for this script. Let's drop the check for a maximum size as we have other sanity checks for reading the kernel command line and modifying vboot headers later on anyway. BRANCH=None BUG=chromium:905093 TEST=deploy_chrome for amd64-generic image Change-Id: Id08ad0a1feb28fda850c611e1e993d15b32e502d Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1336109 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Achuith Bhandarkar <achuith@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: updater: Check EC/PD WP state again before updatingHung-Te Lin2018-11-141-6/+25
| | | | | | | | | | | | | | | | | | | | | | | There are devices, especially during or after RMA, may have WP states not synced; for example HW = 1 SW (AP) = 0 SW (EC) = 1 In this case, we can still update host firmware but not EC. This happens more often on EC that needs an extra reboot to change WP states. As a result, we do want to check real programmer again before updating optional images. BUG=chromium:902546 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I9a526cde19a1ab3c41afecb4f7247bd941edc3f4 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1322295 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: update: Strip \xFF from version stringHung-Te Lin2018-11-071-6/+17
| | | | | | | | | | | | | | | If some system that firmware RW sections were damaged, the firmware string may become '\xFF' (flash erased content). We do not want to see that as version string, and this will help FAFT testing. BUG=chromium:899901 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I947ec3c8286a022163abf01ae1d8ab5747aacf08 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1317050 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: updater: Add more legacy optionsHung-Te Lin2018-11-041-0/+10
| | | | | | | | | | | | | | | | | | To simplify the migration plan, we want to support the legacy arguments used by FAFT: --noupdate_ec => --host_only --noupdate_pd => --host_only --nocheck_keys => --force --update_main => ignore BUG=chromium:882445,b:118509893 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I31652806085937fe5ca2f2facc7321021977cbb7 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1310253 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Pass all calls to VBExLegacy() through a single functionstabilize-11217.BSimon Glass2018-11-015-60/+41
| | | | | | | | | | | | | | | | | | | | | | | | | It is important that we lock the TPM before calling this function. We have several places where the function is called. Reduce the risk that the TPM is no locked by running all calls through a single point. Drop the vb2_exit_altfw() function as it is not needed now. We rely on being able to call RollbackKernelLock() multiple times since it ignores subsequent calls and does not attempt to lock the TPM twice. With the menu UI this causes a small change in behaviour: when starting legacy firmware fails the screen flashes AFTER the beep instead of before. Hopefully this difference is not important. Future work will unify the two UI more. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I0ee0b52eb57c30c1e1bb4a7e60e11d060025ab17 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1292248 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Create a new file for common vboot UI functionsSimon Glass2018-11-016-26/+51
| | | | | | | | | | | | | | | | | Rather than having vboot_ui be the common file between that and vboot_ui_menu, create a new file. For now just move over vb2_error_beep(). The other common functions are being removed in future CLs. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: Iff6917642ff79ea0b5cce60b383876b6f7174d20 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1310794 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Unify the rest of the beepsSimon Glass2018-11-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | In some cases we use a a single high beep to signal an error. It does not seem important to distinguish this from any other kind of error, so just use the existing case. All beeping now goes through vb2_error_beep(), except for one beep in vboot_audio.c. We could move vb2_error_beep() to vboot_audio.c, but the beeps seem to be a part of the UI rather than the audio system. Of course, vb2_audio_looping() arguable is also... BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I55807b4548987a621e8bbced97e7710d6cd6d5fb Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1292247 Reviewed-by: Julius Werner <jwerner@chromium.org>
* tpmc: Make 'tpmc def' replace the existing space by defaultMeng-Huan Yu2018-11-011-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In chromium:895549, we want to have consistent behavior of 'tpmc def' between TPM 1.2 and TPM 2.0. In TPM 1.2, define space command will undefine the existing space, and create a new one. So we make the 'tpmc def' act as this by default. Also, provide a option for whom may want to define a new space only if it is not defined yet. It will return TPM error code at that case. BUG=chromium:895549 BRANCH=None TEST=unit test; manually test: # For TPM 2.0 use AUTHREAD|AUTHWRITE tpmc tpmversion | grep 2.0 && export PERM=0x40004 tpmc tpmversion | grep 1.2 && export PERM=0x1 # Define the space tpmc def 0x1020 0x1 "$PERM" # Redefine the space, default will overwrite tpmc def 0x1020 0x1 "$PERM" # Expected: Success tpmc def 0x1020 0x1 "$PERM" --no-overwrite # Expected: output error for the space is already defined. # For TPM 2.0, it should output: # command "def" failed with code 0x14c # the TPM error code is unknown to this program # For TPM 1.2, it should output: # The space is existing but --no-overwrite is set. Change-Id: I9b4e742f2935578443ebcc69e91d0aebc84deed8 Reviewed-on: https://chromium-review.googlesource.com/1298098 Commit-Ready: Meng-Huan Yu <menghuan@chromium.org> Tested-by: Meng-Huan Yu <menghuan@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* tpmc: Add 'undef' command support to undefine NV spaceMeng-Huan Yu2018-11-011-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For TPM 1.2, the undef command only works when NvLocked is not set which is usually set before boot, even for recovery mode. For TPM 2.0, it will automaticly choose the correct authorization according to the TPMA_NV_PLATFORMCREATE attribute of that index. BUG=chromium:895549 BRANCH=None TEST=No test for TPM 1.2 Manually test for TPM 2.0: 1. Boot with platform hierarchy is disabled, then # perm: TPMA_NV_AUTHREAD | TPMA_NV_AUTHWRITE tpmc def 0x1020 0x10 0x40004 tpmc getp 0x1020 # check the space exists, expect success tpmc undef 0x1020 2. Boot with platform hierarchy is enabled, then run # perm: TPMA_NV_AUTHREAD | TPMA_NV_AUTHWRITE | # TPMA_NV_PLATFORMCREATE tpmc def 0x1020 0x1 0x40040004 tpmc getp 0x1020 # check the space exists, expect success tpmc undef 0x1020 Change-Id: I1d814287fda3e7c11933eca7334fdc3ab1ebf895 Reviewed-on: https://chromium-review.googlesource.com/1298097 Commit-Ready: Meng-Huan Yu <menghuan@chromium.org> Tested-by: Meng-Huan Yu <menghuan@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* tpmc: Add TlclUndefineSpace/Ex for TPM 1.2/2.0Meng-Huan Yu2018-11-017-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | For TPM 1.2, to undefine the space is just define a size 0 space. And all operation should be done under physical presence is set if NvLocked is set. Iirc, NvLocked is usually set before boot. For TPM 2.0, support to undefine space regardless platform hierarchy state. We will use platform authorization when TPMA_NV_PLATFORMCREATE of that space is set. Otherwise, we will try to use owner authorization with NULL password. For owner authorization with customized password is still not supported in UndefineSpace since it is also not support in DefineSpaceEx. BUG=chromium:895549 BRANCH=None TEST=vboot_reference unit test passed and added new link test for TPM 1.2. For TPM 2.0, there is no unit test, but passed manually test with tpmc in the following commit. Also passed depthcharge unit test for TPM 2.0 and TPM 1.2 board. Change-Id: I06dcc70c63a88a04d19f3b248666ff2492a1d2b0 Reviewed-on: https://chromium-review.googlesource.com/1291131 Commit-Ready: Meng-Huan Yu <menghuan@chromium.org> Tested-by: Meng-Huan Yu <menghuan@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* crossystem: add support for ICL gpiochipSubrata Banik2018-10-311-0/+1
| | | | | | | | | | | | | | On Icelake platform, the pinctrl (gpiochip) driver label is "INT3455:00", hence declare it properly. TEST=run 'crossystem wpsw_cur' and see '0' rather than an error on dragonegg platform. Change-Id: I34e24478934a8fbaf9777a8340672697f7642ba3 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1307200 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* futility: updater: Fix model detection errorHung-Te Lin2018-10-291-1/+1
| | | | | | | | | | | | | | | In mosys, $(mosys platform name) currently returns the board (family) name while the real model name needs $(mosys platform model). BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ie3355ca94d577e88a2140567b9284da40c0b39c5 Reviewed-on: https://chromium-review.googlesource.com/1301013 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add a parameter to vb2_error_beep()Simon Glass2018-10-263-20/+32
| | | | | | | | | | | | | | | | | | | | We have two different types of beep each with its own meaning: - two high beeps: not allowed - single low beep: allowed but it failed Add an enum to cover this and update all callers. In VbTryUsb() there is a delay after the beep but that does not seem to be needed, so drop it. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I824d088d1a51aeb5a35b5978a05533e8eabcf8f6 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1292246 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: replace 'chromeos_arm' device with new GPIO chardev APIBrian Norris2018-10-261-3/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream Linux supports a new ioctl API for GPIO chips, via new /dev/gpiochip* device nodes. This new API supports name lookups, which is a much nicer way than the index-based stuff in /sys/class/gpio/. We can finally use this instead of our custom, downstream "chromeos_arm" driver. GPIO line names are defined in a 'gpio-line-names' property in the Device Tree. For now, we have exactly one board using this, and we're calling it 'AP_FLASH_WP_L'. We will need to ensure future devices use this same naming. Per others' suggestions, I'm avoiding using libgpiod, because it's a relatively new library (with breaking changes in v1.0 as recently as this year), and vboot_reference is used by plenty of other projects. And it wasn't that hard to hand-roll the ioctls. Side note: the chromeos_arm device is not guaranteed to be found at /sys/devices/platform/chromeos_arm any more (especially on kernel >=4.14), so this is a handy excuse to just kill use of the driver entirely. BRANCH=none BUG=chromium:897992 TEST=`crossystem wpsw_cur` on 4.14 kernels (with this API) and older kernels (without this API) Change-Id: I7553801fb0e97c8a0aa6f4341d297ad0071c3dac Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1298274 Reviewed-by: Douglas Anderson <dianders@chromium.org>
* image_signing: make_dev_ssd: Revise backup output when inside chrootHung-Te Lin2018-10-261-2/+9
| | | | | | | | | | | | | | | | | | Storing backup files inside /mnt/stateful_partition should be done only on DUTs running ChromeOS. For chroot or other environment, we should just store in current folder if available. Also fixed that the warning message when backup files can't be generated should be printed using "warn" instead of "warning". BUG=None TEST=./make_dev_ssd.sh -i image --edit_config --partitions 2 Change-Id: Ie81e810951e7fc72f350de847440a8f0372bc9be Reviewed-on: https://chromium-review.googlesource.com/1300893 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: updater: Support --repack and --unpackHung-Te Lin2018-10-244-16/+182
| | | | | | | | | | | | | | | | In order to make the firmware updater package more consistent file contents (for example, we don't want time stamps, and better if the files are always physically located in same order) we want to create and manipulate the ZIP based package directly using updater. BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ie4c5aafe51f633729de2879c73bf7074a695151f Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1286173 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* futility: Preserve programmer in free_firmware_imageHung-Te Lin2018-10-232-3/+9
| | | | | | | | | | | | | | | | | The `programmer` cannot be decided in `load_firmware_image` and is always specified (and managed) by an outer context, and should be preserved even when we call `free_firmware_image`. This helps reloading or removing loaded images at runtime. BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I22f698d4a7118197379e11556b18f70ecd023ca2 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1295209 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: update: Add `--host_only` argumentHung-Te Lin2018-10-234-4/+17
| | | | | | | | | | | | | | | | | | | | | | | The legacy firmware updater can update explicitly only some type of images by using `--[no]update_main`, `--[no]update_ec`, `--[no]update_pd`. Since software sync is introduced, usually it does not make sense to only update EC or PD; instead the real request is to "ignore provided EC and PD images and update only host". The new `--host_only` argument provides an easy way to ignore images in command line (`--ec_image`, `--pd_image`) and archives (`ec.bin`, `pd.bin`). BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Idf403680880cd58a00867172ccec97fd60c1b826 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1295210 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: updater: Support --mode=output and --output_dirHung-Te Lin2018-10-224-0/+55
| | | | | | | | | | | | | | For backward compatibility, we need to support the 'output' mode in legacy firmware updater. The output must select right files according to system model, and apply all white label transform if needed. BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ib433647317fa97387aa4a7f8f2101b47e6ca2123 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1282084
* futility: updater: Support white label from VPD and --signature_idHung-Te Lin2018-10-226-13/+229
| | | | | | | | | | | | | | | | | | | | For white label devices, we have to select and patch key files (root key and vblock) by VPD (`whitelabel_tag` or `customization_id`). The white label tag VPD will be processed and converted to a "signature ID" for key selection. To support that, updater has to fetch current (system) image if the matched model is following white label (so we can read VPD from it). For developers who want to load and use particular files, they can use --signature_id to override VPD values. BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I3630bae28d1a8493b56d0e5efd29f3c61a470379 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1278420
* futility: updater: Add '--model' and select images by system modelHung-Te Lin2018-10-227-35/+206
| | | | | | | | | | | | | | | | | For devices using Unified Build, we have to select and load images from archive by model configuration (setvars.sh). The system model can be retrieved by $(mosys platform model), but for developers who want to simulate or get images for particular platform, a command line argument --model is needed. BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I8f4a6735b34bc694a05808b001c7309623b2afa3 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1278419 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add a constant for the escape keystabilize-atlas-11177.BSimon Glass2018-10-193-5/+6
| | | | | | | | | | | | | We use this in a few places, so add a constant. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I7182d0ac52c23c01397de08683ad83b818486f91 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1286221 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Export vb2_error_beep()Simon Glass2018-10-193-14/+15
| | | | | | | | | | | | | | This code is used in both the keyboard and detachable UIs. Make it into a common function and export it. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I1e2cf67ec3fce9bc78ad412ddcc34e0eaecab5eb Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1286220 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Split out functions which handle alternative firmwareSimon Glass2018-10-192-17/+58
| | | | | | | | | | | | | | | | | | | At present we have all the logic for this feature in VbTryLegacy(). In preparation for adding a new menu for alternative firmware, split the logic into two pieces: preparing to start alternative firware, and cleaning up afterwards if nothing booted. Also export these functions so that they can be used by the detachable UI. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I560634ebb03a7f02a488defa32b83e51001d018e Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1286219 Reviewed-by: Randall Spangler <rspangler@chromium.org>