summaryrefslogtreecommitdiff
path: root/futility
Commit message (Collapse)AuthorAgeFilesLines
* futility: updater: Add '--servo' for updating via Servo-V2 and ServoMicroHung-Te Lin2020-01-203-0/+69
| | | | | | | | | | | | | | | | | | | | | Flashing via Servo V2 and Servo Micro was known to be a complicated. With the new virtual control 'cpu_fw_spi' we have a better way to prepare servo in an unified way. The new '--servo' will detect servo type and pick up the right params (for servo v2, servo micro, servo v4 with ccd, or servo v4 + micro) for programming. BRANCH=None BUG=None TEST=make runtest; sudo futility update --servo -i image.bin Cq-Depend: chromium:1966176 Change-Id: Ia14288b1bd5f24acfc4fb85ba64c2c445152a3a7 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1966872 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* futility: updater: override signature id for phaser360Paul Ma2020-01-085-1/+86
| | | | | | | | | | | | | | | | | | | | | | Because of lacking CL:1501614 in octopus factory branch, dopefish root key is written to some phaser360 devices. That will lead to firmware updater not be able to verify RW vblock and AU will fail. This CL will fix that by using root key info and model name to make firmware updater get a proper sig_id so that in-field machines can be updated by AU. BUG=b:146876241, b:133901651, b:146482979 BRANCH=none TEST=using a DUT of phaser360 (without whitelabel_tag = dopefish) which is flashed dopefish rootkey and hwid, using command 'chromeos-firmwareupdate -m autoupdate --wp=1' to flash firmware, RW firmware can be updated and DUT can boot normally. Change-Id: I163c16189c28a996ed08bf2a7b162e6ee3b13be6 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1981650 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* vboot: fix up some host key functions for host_key2.cfactory-excelsior-12812.BJoel Kitching2019-12-257-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Deprecate: PublicKeyInit --> vb2_init_packed_key PublicKeyCopy --> vb2_copy_packed_key Rename: packed_key_looks_ok --> vb2_packed_key_looks_ok Move vb2_packed_key_looks_ok from host_key.c to host_key2.c. Move tests/vboot_common_tests.c to tests/vb2_host_key_tests.c. Remove firmware/lib/vboot_common.c. Remove host/lib/host_key.c. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I627b2af0416ac69460f9860614a69cad8bdb76a7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844597 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove VerifyVmlinuzInsideKBlob functionJoel Kitching2019-12-211-4/+5
| | | | | | | | | | | | | | | | Replace the use of VerifyVmlinuzInsideKBlob with vboot2-style vb2_verify_member_inside. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I2ffb52a4e7d7b93b2512923145db5f6ff4f3dfd5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844599 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: merge vb2_struct.h into 2struct.hJoel Kitching2019-12-103-3/+0
| | | | | | | | | | | | | | | Also remove unused preamble structs in vboot_struct.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I8b41f24b55eba91b1f952415eda1b532732848eb Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844601 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove unnecessary vboot_common.h includesJoel Kitching2019-12-067-6/+1
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I7daf97a88c71ff188c5812a30ca71d6c84823ae9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844595 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: Remove quirk 'daisy_snow_dual_model'Hung-Te Lin2019-11-293-91/+0
| | | | | | | | | | | | | | | | Daisy snow has set its AUE version to R75 and R76 went stable for a long time, so we can now remove the quirk for it. BUG=None TEST=make clean && make runtests Change-Id: I8a955f1e02221c6562958f584dabdb27ab5d870d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1940401 Tested-by: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: updater: refactor: unify getting temp files for firmware imagesHung-Te Lin2019-11-273-32/+19
| | | | | | | | | | | | | | | | Unify "create a temp file and write firmware image contents" to the new API get_firmware_image_temp_file with better error messages. BRANCH=none BUG=chromium:1024401 TEST=make clean && make runtests Change-Id: I441f24053a8d94def587cf8270c44a4bdce9a4fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1928359 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* futility: updater: refactor: isolate tempfile functions from updater_configHung-Te Lin2019-11-225-94/+135
| | | | | | | | | | | | | | | | | | | | The updater_utils.c should not deal with updater_config directly. Currently everything relates to generating temporary files will need updater_config due to updater_create_temp_file. By moving that out (let every caller to pass &cfg->tempfiles) we can detach updater_utils.c from updater_config. BRANCH=none BUG=chromium:1024401 TEST=make clean && make runtests Change-Id: I44bc4df0152596a822b1e0672f41c16825472249 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1928358 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* futility: updater: move "EC partial recovery" to be a quirk.Hung-Te Lin2019-11-223-122/+174
| | | | | | | | | | | | | | | | | | | | | The "EC update" (either calling flashrom or using EC RO software sync) logic has been bloated and is really not a typical updater feature (that only makes sense for dogfooders). And we have seen enough special cases that some boards may not want to use it (or causing problems). Move that to a quirk so we can turn on or off in a more flexible way. BRANCH=none BUG=chromium:1024401 TEST=make clean && make runtests Change-Id: I2d4fe0d9ee0d98ad41b8cbdcaff848846d120d07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1926010 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* futility: updater: move system-related utility functions to updater_utilsHung-Te Lin2019-11-225-760/+853
| | | | | | | | | | | | | | | | | | | | | The firmware updater (updater.c) is bloated so we should move functions that are not really related to 'updating logic' to a new file, updater_utils.c. Refactor only by moving functions (and renamed few functions), no changes in updater logic. BRANCH=none BUG=chromium:1024401 TEST=make clean && make runtests Change-Id: I98339c5c4a81845b36daf842c79625fa2389c7f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1926009 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* futility: updater: fix wrong arguments passed by --ccdHung-Te Lin2019-11-213-5/+10
| | | | | | | | | | | | | | | | | | | When flashing using CCD, we should: - Set programmer to raiden_debug_spi:target=AP - Set write protection argument to "0" instead of number 0 (which means NULL). - do_check_compatible_tpm_keys should not raise failure if force_update is set. BRANCH=None BUG=None TEST=make runtest; sudo futility update --ccd -i image.bin Change-Id: I01121791bbbae0ffbcbc7a56c24b506d48ef7394 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1926011 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* futility: updater: Check and use larger regions in EC RO updateHung-Te Lin2019-11-181-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Unlike STM32 (used on ARM Chromebooks), EC images on most x86 Chromebooks used to have a header before EC_RO section describing the size and attributes of firmware to load. However, partial updating with only 'EC_RO' by flashrom will not include those data. So we should use 'WP_RO' to update whole RO area. This also implies EC RO software sync, which usually only updates ec.RO.bin in EC_RO, is not safe on devices with extra data. A quick solution is to only allow RO software sync when EC_RO is aligned to top of EC firmware image. Also in future devices cannot run EC software sync may skip generating EC RO blobs in AP coreboot CBFS so the updater won't try to do RO software sync. BUG=chromium:1024401 TEST=(kukui) chromeos-firmwareupdate --mode=recovery # updated and boot (laser) chromeos-firmwareupdate --mode=recovery # updated and boot also verified we can update from old x86 EC (EC_RO does not include header) to new style (EC_RO contains header). Change-Id: I2c90320ffbfd79ba0cbaf70016446d8ab489e6ac Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1919097 Reviewed-by: Shelley Chen <shchen@chromium.org>
* futility: updater: Correct EC RO name in CBFSHung-Te Lin2019-11-141-2/+2
| | | | | | | | | | | | | | The EC RO name inside CBFS is actually 'ecro' instead of 'ec_ro'. BRANCH=None BUG=b:141965252 TEST=make clean && make runtests Run 'futility update -i image.bin -e ec.bin --mode=recovery' Change-Id: I2ede0bfbd550d343726df893ce707e82d77d5f30 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1913689 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: align workbuf to VB2_WORKBUF_ALIGNJoel Kitching2019-11-139-11/+18
| | | | | | | | | | | | | | | Also standardize on position and spacing of __attribute__. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ic61d6193c2413824837a51af98eb2dcd9ea4ab85 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1902843 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: sync mtimesMike Frysinger2019-11-133-21/+41
| | | | | | | | | | | | | | | | | | | | | When unpacking files, unzip will retain timestamps on the outputs. This makes it easy to recreate the firmware unpacker with the same exact contents. futility doesn't copy update timestamps anywhere, so all the mtimes are $now, which makes it impossible to recreate the same archive. Update the API to pass around mtimes by reading them from inputs, setting them on outputs, and copying them across. BUG=None TEST=`futility update -a chromeos-firmwareupdate --unpack out` has timestamps on outputs BRANCH=None Change-Id: Icc0ae833390115082e1677d190d1b2a029b78439 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1913067 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* futility: updater: Clean up hard-coded section names to preservestabilize-volteer-12665.Bstabilize-12669.Bfirmware-hatch-12669.BHung-Te Lin2019-11-081-13/+1
| | | | | | | | | | | | | | | | | | The following sections can be now deleted from hard-coded list: - RO_PRESERVE: no boards use it. - RO_FSG: new images have set the PRESERVE flag in CBFS. - SI_GBE, SI_PDR: already using PRESERVE flag since fw branch is cut. BUG=b:116326638,chromium:936768 TEST=make clean && make runtests Change-Id: I99759949104bf4f1c1db3556e273923dcb1c5887 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1902841 Tested-by: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* Revert "Clean up implicit fall through."Mathew King2019-11-052-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6a703f5b0edfdbf2eee72d59499f73585262a46f. Reason for revert: This change breaks building coreboot Original change's description: > Clean up implicit fall through. > > Directly use the __attribute__ ((fallthrough)) instead of > a macro. > This was suggested in CL:1772474. > > BUG=chromium:997709 > TEST=CQ > BRANCH=None > > Change-Id: Ic6cd417d7c735395a4b136dbb0879a6f1716da98 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1897360 > Tested-by: Manoj Gupta <manojgupta@chromium.org> > Reviewed-by: Julius Werner <jwerner@chromium.org> > Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Bug: chromium:997709 Change-Id: Icd0de8bcdee44d1b41f313a4f5aaba8108f734ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1899735 Reviewed-by: Mathew King <mathewk@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org>
* Clean up implicit fall through.Manoj Gupta2019-11-052-3/+3
| | | | | | | | | | | | | | | | Directly use the __attribute__ ((fallthrough)) instead of a macro. This was suggested in CL:1772474. BUG=chromium:997709 TEST=CQ BRANCH=None Change-Id: Ic6cd417d7c735395a4b136dbb0879a6f1716da98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1897360 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* futility: update: Try EC-RO software sync if availableHung-Te Lin2019-10-291-41/+154
| | | | | | | | | | | | | | | | | | | For devices with EC that will reset TCPC when updating RO, dogfood units without write protection will always see failure in recovery process. To fix this, we want to apply EC RO software sync if available. BRANCH=None BUG=b:141965252 TEST=Boot device in recovery mode, same EC RO and run futility -i image.bin -e ec.bin # see EC RO in next boot Change-Id: I60552facc059b894a4922738207fd885008cb40c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1864534 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* vboot: remove BUILD_ASSERT macroJoel Kitching2019-10-232-13/+8
| | | | | | | | | | | | | | | Use _Static_assert() instead. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I42a18442a8bff1ab346f8ba784e9e6fc0366de9a Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1786388 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: relocate vb2_signature and vb2_keybock structsJoel Kitching2019-10-232-8/+8
| | | | | | | | | | | | | | | Move from vboot20 to vboot2. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: Ib1fe0e2cfb0865fffe33ad35e7bd67d416da4589 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776291 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: standardize on "keyblock" as one wordJoel Kitching2019-10-237-44/+44
| | | | | | | | | | | | | | | | Stardardize on inconsistency between "keyblock" and "key block" both in code, comments, and textual output. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: Ib8819a2426c1179286663f21f0d254f3de9d94a4 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1786385 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: format hex numbers with %#x instead of 0x%xJoel Kitching2019-10-239-55/+55
| | | | | | | | | | | | | | | | Also standardize on using hex for printing ASCII key values across vboot_ui.c and vboot_ui_menu.c. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ib10288d95e29c248ebe807d99108aea75775b155 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1840191 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: updater: Try to update only EC RO when software sync is availableHung-Te Lin2019-10-161-1/+43
| | | | | | | | | | | | | | | | | | | | | For devices with EC that will reset TCPC during sysjump, updating firmware in recovery mode may cause problems. However, for developers manually updating firmware in developer mode (Ctrl-U), the EC firmware should be running in EC RO and we may have a chance to update successfully. BRANCH=None BUG=b:141965252 TEST=Boot device in recovery mode and run futility -i image.bin -e ec.bin; see correct message and then I/O error. Boot device in developer mode (Ctrl-U) and run futility -i image.bin -e ec.bin; see correct message. Cq-Depend: chromium:1837564 Change-Id: I9aa79df35094ab0c8eecc68c6652327d3325246a Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1835487 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Make vboot_version extern in headerLeonard Chan2019-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When enabling `-fno-common` in Fuchsia, we get a bunch of linker errors when linking futility: ``` ld.lld: error: duplicate symbol: vboot_version >>> defined at futility.h:43 (../../third_party/vboot_reference/futility/futility.h:43) >>> host_x63-asan_no_detect_leaks/obj/third_party/vboot_reference/futility/futility.cmd_bdb.c.o:(vboot_version) >>> defined at futility.h:43 (../../third_party/vboot_reference/futility/futility.h:43) >>> host_x64-asan_no_detect_leaks/obj/third_party/vboot_reference/futility/futility.cmd_create.c.o:(.bss.vboot_version+0x0) ``` and think this is because -fno-common places vboot_version for unitialized global variables in the BSS section of each object file. Making it extern instead resolves each reference to its definition in futility/misc.c. Change-Id: I591f07abd1f975a8a9d078bb4366e2e0861390b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1839207 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org>
* futility: also clamp to natural valuesPatrick Georgi2019-09-231-1/+3
| | | | | | | | | | | | | | | Found by Coverity Scan #242 BUG=none BRANCH=none TEST=none Change-Id: I384044d36ee5e2e9d344c7af40d61c5e27fd75b4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815239 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* futility/cmd_update.c: free cfg before leaving contextPatrick Georgi2019-09-231-0/+1
| | | | | | | | | | | | | | | Found by Coverity Scan #198897 BUG=none BRANCH=none TEST=none Change-Id: Ib7e049c912a77fa5ad15a0f4638befd5596b7df4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815238 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* vboot: fix up some more includesJoel Kitching2019-09-2317-44/+39
| | | | | | | | | | | | | | | | Should have no extra line breaks in between local includes, and should be sorted alphabetically. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I83c25d30d7376712857314965a7d93f57190aa3f Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776281 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility/cmd_update.c: free cfg before leaving contextPatrick Georgi2019-09-201-0/+1
| | | | | | | | | | | | | | | Found by Coverity Scan #198897 BUG=none BRANCH=none TEST=none Change-Id: I171571afe2492d15256df8388fa4a05bd8b10bf2 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789711 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* futility/updater: clamp revision numberPatrick Georgi2019-09-201-2/+10
| | | | | | | | | | | | | | | Found by Coverity Scan #198901 BUG=none BRANCH=none TEST=none Change-Id: I6ebf5caa286bd64cddaa589a9e14f93185afbf90 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789710 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* futility/updater: verify that data copied from stdin is completePatrick Georgi2019-09-201-1/+4
| | | | | | | | | | | | | | | Found by Coverity Scan #198910 BUG=none BRANCH=none TEST=none Change-Id: I609a3a1fe4d38b5c417608ef8574df6286dfbfda Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789709 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* futility/updater: Check that image exists before digging into itstabilize-12515.Bstabilize-12499.18.Brelease-R78-12499.BPatrick Georgi2019-09-091-0/+5
| | | | | | | | | | | | | | | | Found by Coverity Scan BUG=none BRANCH=none TEST=none Change-Id: I2544a4e84ecadc262e08aaa4e6f056d710d807f5 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1771972 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* Fix fall through warning reported by ToT clang.Manoj Gupta2019-08-282-3/+3
| | | | | | | | | | | | | | | | | | | | Clang is diagnosing implicit fallthrough in C code past https://reviews.llvm.org/rL369414. Detect the support for the fallthrough attributes in gcc/clang and enable it as VBOOT_FALLTHROUGH (copied from boringssl). This is needed to fix ToT clang builds. Note: GCC apparently does not diagnose fallthrough to another case with break but clang does (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432). And clang does not detect the fallthrough based on code comments. Bug: chromium:997709 Test: CQ Change-Id: Id8b4be4deabca2d0f1b2efd80efa72a485a5dc8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1772474 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* futility: avoid leak in eve's smmstore quirkPatrick Georgi2019-08-281-1/+1
| | | | | | | | | | | | | | | | Minor but Coverity Scan noticed it. BUG=none BRANCH=none TEST=none Change-Id: I08e889f8515681e4065b0c93180aec4d083c5012 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1771971 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org>
* vboot: fix up some headers, includes, comments, spacingJoel Kitching2019-08-2828-75/+56
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id97f544da845f7070555e5e8cc6e782b2d45c300 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758151 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: updater: Fix incorrect line break in error messageHung-Te Lin2019-08-221-2/+2
| | | | | | | | | | | | | | | | The 'incompatible key' error message added the new line in wrong location, causing the message to be truncated unexpectedly. We should put the line break after whole message (including URL) is printed. BUG=None TEST=make runfutiltests BRANCH=None Change-Id: Ic74da1c2657b9517dce786a72435275e7141348c Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1763968 Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: Add load_firmware_image() error checkJacob Garber2019-08-141-1/+2
| | | | | | | | | | | | | | | | It is possible for load_firmware_image() to fail, in which case there will be a null pointer dereference of image.data in find_gbb(). Prevent this by returning early if load_firmware_image() fails. BUG=none TEST=make clean && make runtests BRANCH=none Change-Id: If60fdff2f3a39f07ef0b1e87f0800ac4fb8d5895 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 198902 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1752522 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* vboot: replace VBERROR_SUCCESS with VB2_SUCCESSJoel Kitching2019-08-131-2/+2
| | | | | | | | | | | | | | | | | Replace vboot1-style VBERROR_SUCCESS with VB2_SUCCESS (trivial change since both are equal values). BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I46e02471a031e9f36ec869d11d0b957d1c1b5769 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728114 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722915 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: update vboot2 functions to use new vb2_error_tJoel Kitching2019-08-131-19/+18
| | | | | | | | | | | | | | | | | | To make explicit when vboot2 error codes should be returned, use the new vb2_error_t type on all functions which return VB2_ERROR_* constants. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Idd3ee8afe8c78347783ce5fa829cb78f1e5719e2 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728113, chromium:1728499 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728292 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: remove Boot Descriptor Block (BDB) library and utilitiesJoel Kitching2019-07-243-875/+0
| | | | | | | | | | | | | | | | Remove unused BDB code, previously created for a cancelled SoC project. BUG=b:124141368, chromium:986177 TEST=make clean && make runtests BRANCH=none Change-Id: I91faf97d9850f8afb816fa324ad9a4d9f3842888 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1710336 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/futility: update fatal errors to use FATALJoel Kitching2019-07-2213-94/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a mix of: - DIE - Fatal (customly defined in cmd_vbutil_kernel.c) - VbExError ... were all used to print an error message and exit. In the case of futility, standardize on using the FATAL macro defined in futility.h. BUG=b:124141368 TEST=Check that FATAL works correctly: $ build/futility/futility vbutil_key --in a --out a --algorithm 18 FATAL: do_vbutil_key: Unknown option TEST=make clean && make runtests BRANCH=none Change-Id: I97ca1153dc36e7208c69185883518c52d5d75293 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1679799 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: use Fatal instead of VbExError in cmd_vbutil_kernelJoel Kitching2019-07-151-5/+3
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Iff20dcc3aa47bfa29776609e5b352ea464c18241 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1680189 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: replace Min macro with VB2_MINstabilize-12331.BJoel Kitching2019-07-062-3/+3
| | | | | | | | | | | | | | | | Replace old vboot1-style Min macro with VB2_MIN, and relocate tests accordingly. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I73d630147eaf23f97dd750769fb1e911dae01848 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675866 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: updater: Report EC and PD images on emulationHung-Te Lin2019-07-031-6/+14
| | | | | | | | | | | | | | | | | | | | | When testing updater behavior with emulation (--emulate), there was no way to know if EC and PD images were correctly found from archive and expected to be flashed (for example if we want to test the difference between modes). Since we do flash EC/PD in recovery and factory modes, it is better to still allow loading EC/PD images, and simply not writing them (and print some messages as indication) in emulation. BUG=chromium:965092 TEST=make runfutiltests BRANCH=None Change-Id: I3bbbd75cb8adf2e238a593d3dee0b2491abe7719 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1626190 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Dana Goyette <dgoyette@chromium.org>
* futility: drop mtd support via android_mtdutilsMike Frysinger2019-06-261-37/+0
| | | | | | | | | | | | | | | No one is using this, so drop the dependency. BUG=chromium:978563 TEST=cq passes BRANCH=None Change-Id: I50595675f7f24f8af06a5a8ec3de21690e2ecb34 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1677105 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* updater: Add quirk for wilco devicesDuncan Laurie2019-06-152-0/+41
| | | | | | | | | | | | | The ME unlock needs a different pattern for these devices. BUG=b:135216986 BRANCH=none TEST=test update from unlocked to locked image on sarien Change-Id: I928ee3de522937d5b972daaec4460dcc731b495e Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1659534 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* vboot: move vb2_packed_key and several functions from lib20 to 2libJoel Kitching2019-06-072-0/+2
| | | | | | | | | | | | | | | | | | | * Move vb2_packed_key from vb2_struct.h to 2struct.h * Move vb2_verify_member_inside from lib20/common.c to 2common.c * Move vb2_packed_key_data and vb2_verify_packed_key_inside from lib20/packed_key.c to 2packed_key.c * Relocate tests accordingly BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I6a9338ffdb640aad071941c3768427e15cd2aa93 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1642773 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: Round up kernel blob to 4kEvan Green2019-06-061-0/+6
| | | | | | | | | | | | | | | | | | | When booting off of a 4kb device, depthcharge gets upset when reading the main kernel blob (after reading a 64k chunk initially) because the total size is not an even number of 4k sectors. Most of the parts of the kernel blob are rounded up to 4kb, except for one. Align the whole image up to 4kb so that it's an even number of sectors on a 4kb device. BUG=b:134061077 BRANCH=none TEST=Boot off a UFS card Change-Id: Iffa93cccd2b5902161fb373efb37f7414e816455 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1641958 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: Fix logging messagesstabilize-12222.BHung-Te Lin2019-05-233-7/+6
| | | | | | | | | | | | | | | | | In CL:1601678, few logging messages were not properly converted: - STATUS should add \n - INFO and WARN should not need __FUNCTION__ BUG=None TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ib01d9319815a5fbb579e49391fc4bff9d61ca214 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1626189 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>