summaryrefslogtreecommitdiff
path: root/futility
Commit message (Collapse)AuthorAgeFilesLines
* vboot: introduce minios_kernel.keyblockJoel Kitching2021-07-053-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | miniOS requires a distinct kernel data key, whose dev key pair is added in this CL as minios_kernel_data_key.vb{pub,priv}k. A distinct keyblock is also required. The keyblock should set the kernel keyblock flag MINIOS_1. Other keyblocks are modified appropriately to set MINIOS_0. Keyblocks were generated using the following commands: $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/ec_data_key.vbpubk --signprivate tests/devkeys/ec_root_key.vbprivk --pack tests/devkeys/ec.keyblock Keyblock file: tests/devkeys/ec.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 7 RSA4096 SHA256 Data key version: 1 Data key sha1sum: 5833470fe934be76753cb6501dbb8fbf88ab272b $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/firmware_data_key.vbpubk --signprivate tests/devkeys/root_key.vbprivk --pack tests/devkeys/firmware.keyblock Keyblock file: tests/devkeys/firmware.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 7 RSA4096 SHA256 Data key version: 1 Data key sha1sum: e2c1c92d7d7aa7dfed5e8375edd30b7ae52b7450 $ futility vbutil_keyblock --flags 27 --datapubkey tests/devkeys/recovery_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/recovery_kernel.keyblock Keyblock file: tests/devkeys/recovery_kernel.keyblock Signature valid Flags: 27 !DEV DEV REC !MINIOS Data key algorithm: 11 RSA8192 SHA512 Data key version: 1 Data key sha1sum: e78ce746a037837155388a1096212ded04fb86eb $ futility vbutil_keyblock --flags 43 --datapubkey tests/devkeys/minios_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/minios_kernel.keyblock Keyblock file: tests/devkeys/minios_kernel.keyblock Signature valid Flags: 43 !DEV DEV REC MINIOS Data key algorithm: 8 RSA4096 SHA512 Data key version: 1 Data key sha1sum: 65441886bc54cbfe3a7308b650806f4b61d8d142 $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/kernel_data_key.vbpubk --signprivate tests/devkeys/kernel_subkey.vbprivk --pack tests/devkeys/kernel.keyblock Keyblock file: tests/devkeys/kernel.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 4 RSA2048 SHA256 Data key version: 1 Data key sha1sum: d6170aa480136f1f29cf339a5ab1b960585fa444 $ futility vbutil_keyblock --flags 26 --datapubkey tests/devkeys/installer_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/installer_kernel.keyblock Keyblock file: tests/devkeys/installer_kernel.keyblock Signature valid Flags: 26 DEV REC !MINIOS Data key algorithm: 11 RSA8192 SHA512 Data key version: 1 Data key sha1sum: e78ce746a037837155388a1096212ded04fb86eb BUG=b:188121855 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I5b3e4def83ff29ca156b3c84dfcb8398f4985e67 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2965485 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/vboot_kernel: move kernel/fw struct functionsJoel Kitching2021-06-157-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Relocate currently-in-use kernel struct functions out of lib20 namespace, and into: * 2struct.c for functions required at runtime * host_common.c for functions required by host Relocate firmware struct functions from 2common.c into 2struct.c vb2_common.h may be deleted as a result. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ic162d9633b6112ddc4a819b3e58d313dc484f304 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2825269 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: correct the rootkey in manifest.jsonstabilize-14029.Bstabilize-14026.Bstabilize-14023.BIsaac Lee2021-06-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | For customization projects, the bios image should be patched by model first, then the gbb got from the image could be correct. Reason: In the function, patch_image_by_model, it will apply the rootkey, vblock_a and vblock_b of the customization project to the gbb part of the image. This change moves the function "find_gbb" to the position after the function "patch_image_by_model" is called. BUG=b:188861251 BRANCH=none TEST=build Change-Id: I5d80405a2a3b0ecc45e86ca3322b328479b83702 Signed-off-by: Isaac Lee <isaaclee@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2929924 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* portability fixes: support building vboot on OpenBSDstabilize-13983.Bstabilize-13982.88.Bstabilize-13982.82.Bstabilize-13982.70.Bstabilize-13982.69.Bstabilize-13982.60.Bstabilize-13982.51.Brelease-R92-13982.BIdwer Vollering2021-05-205-7/+10
| | | | | | | | | | | This was done on OpenBSD 6.8. Required packages are: e2fsprogs and gcc. Change-Id: I86ec080e1ddb90053d81f1edd17d3406e7e737c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2903352 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* cleanup: remove ryu roothash functionalityJack Rosenthal2021-05-013-186/+0
| | | | | | | | | | | | | | | | | | Ryu was a canceled Chrome OS project (it launched with Android instead). 6 years later and this unused code is still kicking around. Delete it. BUG=b:186777279 BRANCH=none TEST=compile futility Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ic359413bc22a51ac8839e3e062234b1fd99a262c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2861022 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* vboot_reference: migrate out of flashrom deprecated optionsDaniel Campello2021-04-281-1/+1
| | | | | | | | | | | | | | This change replaces --diff and --fast-verify for the supported equivalent flashrom options BRANCH=none BUG=b:186479007 TEST=tryjobs Change-Id: I614ba71c606dbe4e3a1b4988df845bcbbd61dd01 Signed-off-by: Daniel Campello <campello@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2853623 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* futility: Do not update Trogdor firmware when rev# < 2Philip Chen2021-03-081-1/+1
| | | | | | | | | | | | | BRANCH=None BUG=None TEST=None Change-Id: I9eeb580f720ceb42a5950b1de7fbc961058f5970 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2739702 Tested-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
* futility: update: Add "servo_noreset" opt to tell CCD not to resetDouglas Anderson2021-01-211-1/+33
| | | | | | | | | | | | | | | | | | | | | | | As can be seen in <https://crrev.com/c/2325190>, flashrom can take a "custom_rst=true" parameter. Flashrom passes this on to Cr50 and tells it not to reset. Among other things, this can be useful to work around hardware bugs where asserting reset puts us in a bad state. Let's add a parameter to futility can specify this mode. We'll enable this just for "--servo" mode of flashrom and not "--ccd" mode. Presumably we want "--ccd" to remain simple / autoconfiguring and this is a bit more of an advanced tweak. BRANCH=None BUG=b:177664356 TEST=Can flash coachz with futility Change-Id: Iab188a92c4eae6373d38fe68ee4107f3e8aa5851 Signed-off-by: Douglas Anderson <dianders@chromium.org> Disallow-Recycled-Builds: test-failures Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2638108 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bob Moragues <moragues@chromium.org>
* vboot: move lib20/packed_key.c into 2lib namespaceJoel Kitching2021-01-204-4/+0
| | | | | | | | | | | | | | | | | | | lib20/packed_key.c functions are currently called throughout 2lib namespace, so move to 2lib/2packed_key.c. Move function declarations from vb2_common.h to 2packed_key.h, and include 2packed_key.h from 2common.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I151b2d41cbbfa1bfd03de301bd4ee69c49e81f3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2635220 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: update: add new quirk 'no_check_platform'Hung-Te Lin2020-12-093-1/+22
| | | | | | | | | | | | | | | | | | | | | | Some devices may have flashed firmware with different platform name in their early stage (especially in the first build of leading devices), so we do want to provide an explicit way (not just --force) to skip checking platform name. The change CL:2059621 does not help because the loaded system firmware looks good. This is implemented as a quirk so we can enable it using a CBFS quirk file, making it easier to be deployed by auto update. BRANCH=None BUG=None TEST=make runtests Change-Id: I888d5848921d31c9b7cba1b96c42d38fda71927e Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2573999 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* Revert "Reland: Clean up implicit fall through."stabilize-rust-13613.BJulius Werner2020-11-202-3/+3
| | | | | | | | | | | | | | | | | | | This reverts commit 6208b9aa9c4e8b7c9ff8063965c9f9aa519c1740. Upstream coreboot has raised concerns that relying on GCC 7+ features for host utilities is too restrictive, so revert this and go back to customizing fallthrough annotations by compiler. Cleaned out some of the C++-specific stuff because vboot isn't built with C++. BRANCH=None BUG=None TEST=Built with clang and GCC. Change-Id: I75d796d289b0a6c249fc8ac2dadb1453be468642 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2547821 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: update: load quirks from firmware image CBFS filestabilize-rust-13555.BHung-Te Lin2020-10-163-7/+63
| | | | | | | | | | | | | | | | | | | | The firmware updater now looks at CBFS 'FW_MAIN_A' (RW A) and if a text file 'updater_quirks' is found, the contents will be fetched to setup default quirks. This helps sharing same customization across multiple firmware images (for different models) shared by same unibuild OS image. Without that, we have to maintain a large list of hard-coded model names in firmware updater source. BRANCH=none BUG=b:169284414 TEST=make runtests Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I938bffe9f16bc3adee0dc3efb6976efe581c6d8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2426093 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* futility/updater: Add quirk to preserve management engineKarthikeyan Ramasubramanian2020-10-153-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | In recent Intel platforms, updating Management Engine (ME) while SoC is in S0 state is an unsupported use-case. To work-around this issue for the devices that are in development, specifically during firmware update, this quirk is added to preserve the ME region. In the subsequent boot, ME region is updated as part of boot firmware update upstart script. BUG=b:165590952 BRANCH=None TEST=With the quirk enabled, ensured that the ME is preserved under the following scenario: chromeos-firmwareupdate --mode=autoupdate chromeos-firmwareupdate --mode=recovery futility update --mode=autoupdate -a /usr/sbin/chromeos-firmwareupdate futility update --mode=recovery -a /usr/sbin/chromeos-firmwareupdate In other scenarios, ME region is not preserved. Change-Id: I81a52d11d1fb363b7e07ef3439b927449456b28a Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2465286 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* futility: update: support multi-line quirksHung-Te Lin2020-10-151-2/+6
| | | | | | | | | | | | | | | To support loading quirks from external files, we want to skip tab (\t) and new line characters (\n, \r). BRANCH=none BUG=b:169284414 TEST=make runtests Change-Id: If314d6cf36907837ce9c36b73337976ee0c6fad1 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2467305 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* futility: updater: print flashrom execution logs on read failurestabilize-13505.1.BHung-Te Lin2020-09-261-0/+11
| | | | | | | | | | | | | | | | | | To prevent flooding AU logs, we don't want flashrom to print verbose logs especially when reading system SPI flash. However, if anything goes wrong it will be very helpful to have all the messages logged. With this patch, we will try reading system flash again with max verbosity. BUG=chromium:943262,b:169026171 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I5469182f2628855e65546bef3abf8791261aabca Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1545598 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* portability fixes: support building vboot on FreeBSDIdwer Vollering2020-09-114-5/+14
| | | | | | | | | | | Built on FreeBSD 12.1-RELEASE, 13-CURRENT, using gcc9 installed from packages. Change-Id: Ifa8bb343c7e916c1b545cf6c1e4bd0a18ea391cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2382790 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* futility: update: Add '--gbb_flags FLAGS' to override GBB flagsHung-Te Lin2020-08-293-6/+40
| | | | | | | | | | | | | | | Developers may want to use the new GBB flags when flashing a firmware image. That can be done by --factory, but it's also more convenient to have a new parameter for overriding the flags with a new value. BRANCH=none BUG=b:166569397 TEST=make runtests Change-Id: If9dce9b1f2fbb27655ad2a111ba75ab83375fb7a Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2382991 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Work around clang/GCC problem with libzip headersJulius Werner2020-08-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | I don't even want to get into why this is needed. I'm so tired of having to deal with new clang-specific toolchain bullshit 2-3 times a year. libzip did this https://github.com/nih-at/libzip/commit/1d949dd77339fb59605dc8f3a30f76604d693795 and then we upreved to it in CL:2245845 and now building upstream coreboot in a Chrome OS chroot is broken. I have to get back to wasting time on the other three random things that broke when I ran repo sync, so someone please just approve... BRANCH=None BUG=None TEST=None Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic578e8f8e47f7fafd98d8c3148cbe24d9156886b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2366053 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* inclusive: change usage of sanityDaisuke Nojiri2020-08-192-3/+3
| | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "sanity" with inclusive alternatives. BUG=b:163883397 BRANCH=None TEST=grep -ir sanity TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I708a044d89050c442f14fb11a8ae5e98490d56af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353420 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Allow --force to override min_platform_version quirkBob Moragues2020-08-181-3/+6
| | | | | | | | | | | | | | BUG=b:162747154 BRANCH=none TEST=verify that update runs for rev1, but not rev0 without --force TEST=verify that update runs for both rev1 and rev0 with --force Signed-off-by: Bob Moragues <moragues@chromium.org> Change-Id: I1594d6a4c83d8a0c13494f8f108225618612db8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2360590 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* futility: updater: always set new boot/try cookiesHung-Te Lin2020-08-081-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | If the update target is same as the active image, the firmware updater will do nothing on vboot2. However, if the system already have fw_try_next set to other slot (for example after multiple updates applied without rebooting) then the next boot will not pick the right firmware. So we have to ensure fw_try_next is set to right value. In the meantime, if fw_try_count and fw_result are not configured at the same time, the system may start "trying" again and increase the chance to fail. To fix that, we should clear trial cookies when there is no update, just like chromeos-setgoodfirmware. BUG=b:162866548 TEST=make runtests BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I41ecac445000a850d050d77f0f694ee431926424 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2340172 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* futility: Add version quirk for trogdorBob Moragues2020-08-061-0/+1
| | | | | | | | | | | | | | BUG=b:162747154 BRANCH=none TEST=verify that update runs for rev1, but not rev0 Signed-off-by: Bob Moragues <moragues@chromium.org> Change-Id: I19e88a3046c6e98968650b6d7b1296a1a47c1470 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2334360 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Douglas Anderson <dianders@chromium.org>
* flashrom: set umask before creating temporary filesJack Rosenthal2020-07-201-0/+6
| | | | | | | | | | | | | | | Good security practice. Set to 077; resultant file permissions are: -rw------- BUG=b:160717634 BRANCH=none TEST=unit tests Change-Id: Ib3b853c824be4c98e7b9ddd31797104ec4ab67a9 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2302962 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Revert "futility: Adds platform check quirk for zork"Rob Barnes2020-06-093-33/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8dac1697aef0114584d737e6a3027b55abdae5f0. Reason for revert: Case sensitivity was turned off in https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2192537. This quirk is no longer needed. It could result in accidental overwriting with incompatible firmware. Original change's description: > futility: Adds platform check quirk for zork > > Adds a quirk for futility on zork boards. > Zork boards before 13073 used lowercase for the firmware > names which causes the compatible platform check fail. > > This adds the disable_compatible_platform_check quirk and > enables it by default for zork boards. > > BUG=b:156119908, b:155941790 > TEST=flashed Google_trembyle.13066.0.0 using servo > chromeos-firmwareupdater --force > rebooted and confirmed Google_Trembyle.13073.0.0 was flashed > BRANCH=none > > Change-Id: I6fc6bf5bb42b725b5e7c9d0166f945b9c123bab4 > Signed-off-by: Rob Barnes <robbarnes@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2191089 > Reviewed-by: Edward Hill <ecgh@chromium.org> > Reviewed-by: Eric Peers <epeers@google.com> > Commit-Queue: Edward Hill <ecgh@chromium.org> Bug: b:156119908, b:155941790 Change-Id: I4688a380dbcd722e8875bf0b5331ecf797efd6a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2197277 Tested-by: Rob Barnes <robbarnes@google.com> Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Commit-Queue: Rob Barnes <robbarnes@google.com> Auto-Submit: Rob Barnes <robbarnes@google.com>
* futility: vb1_helper: Fix sanity size check for parsing kernel partitionJulius Werner2020-06-061-2/+4
| | | | | | | | | | | | | | vbutil_kernel --verify didn't check if the size of the kernel body fit the file it was in. Now it does. BRANCH=None BUG=None TEST=make runtests Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I9cdfd50bd70b72650cdc0fd62bf59a394746ad84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2225663 Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: updater: Add '--servo_port' to select from multiple servodsHung-Te Lin2020-06-063-15/+62
| | | | | | | | | | | | | | | | | | | | | | | When multiple servo boards are connected to the host, we usually want to select the right servo by specifying its port, get the servo serial number, and pass that to flashrom programmer. The new --servo_port (or environment variable SERVOD_PORT) now allows developers to flash firmware via specific servod using futility updater easily: futility update --servo_port 9998 -i PATH_TO/image.bin BRANCH=None BUG=None TEST=make runtest; sudo futility update --servo_port 9998 -i image.bin Change-Id: Ic302f841abf745801995ff233fc209726ed039c8 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228258 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Douglas Anderson <dianders@chromium.org>
* updater: Replace servo-v2 with google-servo-v2Nicolas Boichat2020-05-181-1/+1
| | | | | | | | | | | | | | servo-v2 will eventually be deprecated. BRANCH=none BUG=b:145175076 TEST=Flash with servo v2, no more "Warning: Use 'google-servo-v2' instead!" Change-Id: Ie7ae9e173a7cbe0fcd37d1c88b5746fb89cc8e22 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2206094 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* futility: updater: Platform name check should be case insensitiveHung-Te Lin2020-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Some platforms (e.g., Zork) may decide to change platform name from lower_case to CamelCase after early builds, and platform name check will be an AU blocker in that case. Considering there should be no devices having same name (and using incompatible firmware), it should be fine to change the strncmp to strncasecmp so the platform name check will be case insensitive. BUG=b:156119908 TEST=make runtests BRANCH=None Change-Id: I5014c136976454dd0965a607e5a98bbe4543a41e Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2192537 Commit-Queue: Rob Barnes <robbarnes@google.com> Tested-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Rob Barnes <robbarnes@google.com>
* futility: Adds platform check quirk for zorkRob Barnes2020-05-113-0/+33
| | | | | | | | | | | | | | | | | | | | | | Adds a quirk for futility on zork boards. Zork boards before 13073 used lowercase for the firmware names which causes the compatible platform check fail. This adds the disable_compatible_platform_check quirk and enables it by default for zork boards. BUG=b:156119908, b:155941790 TEST=flashed Google_trembyle.13066.0.0 using servo chromeos-firmwareupdater --force rebooted and confirmed Google_Trembyle.13073.0.0 was flashed BRANCH=none Change-Id: I6fc6bf5bb42b725b5e7c9d0166f945b9c123bab4 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2191089 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Eric Peers <epeers@google.com> Commit-Queue: Edward Hill <ecgh@chromium.org>
* updater_utils.h: stop using 'dev=1' in flashrom commandNikolai Artemiev2020-04-171-1/+1
| | | | | | | | | | | | | | | Replace 'ec:dev=1' with equivalent 'ec:type=pd'. BUG=b:153024532 BRANCH=none TEST=emerge vboot_reference Change-Id: Ic8df99fcdc3769bec19054b1936b97b14bade0e7 Signed-off-by: Nikolai Artemiev <nartemiev@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2151492 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* Rewrite algorithm type parsers and make them globally availableJulius Werner2020-04-064-40/+17
| | | | | | | | | | | | | | | | | | | | | There is some code strewn around between futility and the vb21-specific part of hostlib to allow parsing of textual algorithm names to vboot enums, but it is somewhat disorganized and not written in a super efficient way. This patch rewrites it and centralizes all the algorithm mapping stuff under 2crypto.c so it can be a single source of truth for all of vboot. (String parsing routines still need to stay in hostlib since not all firmware targets support things like stroul() and strcasecmp().) BRANCH=None BUG=None TEST=make runtests Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I719b2499992a6e4395a29231bc8b9a7680c5b174 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2099447 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: stop using StrnAppend and Uint64ToStringJoel Kitching2020-03-311-1/+0
| | | | | | | | | | | | | | | | | | | Use snprintf instead. Remove utility_string library. Also, prepare VbDisplayDebugInfo to handle 64-byte nvdata. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests TEST=boot with 16-byte nvdata, check <TAB> output (one line) TEST=boot with 64-byte nvdata, check <TAB> output (five lines) BRANCH=none Change-Id: If6c4b3a4e9fa7b71cb2d8ca7ccd37e4f36b97fd6 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2122061 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2104880 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* updater: Add Drallion to the wilco quirk listDuncan Laurie2020-03-311-0/+2
| | | | | | | | | | | | | | | Add the Drallion board to the list of sarien/arcada so it gets the workaround to lock the CSME on dogfood units safely. BUG=b:152475734 BRANCH=none TEST=none Signed-off-by: Duncan Laurie <dlaurie@google.com> Change-Id: I2119f64d5935d3462f0f7ad27d255ec259733553 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2127313 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* Avoid zero-size VLA in cmd_dump_fmap.cinglorion2020-03-181-1/+2
| | | | | | | | | | | | | | | | | Zero-size variable length arrays are undefined behavior. UBSan reported a zero-size VLA in futility/cmd_dump_fmap.c when running tests. This change fixes that by making sure the size of the VLA is at least 1. BUG=chromium:1058086 TEST=FEATURES="test" USE="llvm-next ubsan" emerge -e --nodeps vboot_reference BRANCH=none Change-Id: I3c0eee0359668ce2e1ec3c0724f243788161fb13 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2103436 Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* vboot: stop using wpsw_boot and remove it from crossystemJoel Kitching2020-02-271-7/+1
| | | | | | | | | | | | | | | | | | wpsw_boot is being deprecated, so just use wpsw_cur. BUG=b:124141368, chromium:950273 TEST=make clean && make runtests BRANCH=none Change-Id: Iae63b2a76b19629a9ecd9b87e5dd6367767860b3 Cq-Depend: chromium:2066154, chromium:2068241, chromium:2068209 Cq-Depend: chromium:2068297, chromium:2067229, chromium:2067231 Cq-Depend: chromium:2068242 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2066192 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: updater: Fix failure by modifying released memoryHung-Te Lin2020-02-261-1/+1
| | | | | | | | | | | | | | | When deleting the temp files, the pointer to released head must not be used again. Setting 'next' to NULL should be done earlier. BUG=chromium:1055468 TEST=make clean && make runfutiltests BRANCH=none Change-Id: Ia4356ade5fcf85e2bfc917c5a3bcbb7f492c5a08 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2071179 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* futility: updater: Ignore image parsing error in --forceHung-Te Lin2020-02-213-41/+70
| | | | | | | | | | | | | | | | | | | | The firmware updater has been improved to support flashing outside DUT (--ccd, --servo) that also implies more people will use it for devices with corrupted (or empty) firmware. It's pretty confusing for developers to see "Cannot load system active firmware" while the flashrom can actually read and write to the SPI firmware. The solution here is to allow updating on such devices when --force is specified (which is automatically applied for --servo and --ccd). BUG=b:148405957 TEST=make runtests BRANCH=None Change-Id: I19e63e3464616bc508639cbfad0d1cf8e99507b0 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2059621 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move vboot 2.1 functions and structs into host codeJoel Kitching2020-02-119-19/+19
| | | | | | | | | | | | | | | | | | These structs and functions need to stick around for futility to use, but they are no longer supported in firmware code. Rename host/lib21/include/* files to end in 21 instead of 2. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I01e181e2f03553d60724fbdc826f5ada63777303 Cq-Depend: chromium:1969172 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1963621 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Reland: Clean up implicit fall through.Manoj Gupta2020-02-012-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: Ifcdcd3822eddea41aeb88f4a55bd09aa483f6054 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2031766 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* Enable format string warnings for vb2ex_printf()stabilize-12859.BJulius Werner2020-01-255-17/+17
| | | | | | | | | | | | | | | | | | | This patch enables the -Wformat warning and tags vb2ex_printf() with the appropriate attribute so the compiler recognizes it as a printf variant. This shows a bunch of (sometimes pretty bad) issues in existing code that are hereby fixed. Cannot enable -Wformat-security yet since a lot of code still uses non-constant format strings and it's unclear whether we can/want to change that in all circumstances (e.g. stuff like DoError()). BRANCH=None BUG=None TEST=make runtests Change-Id: I917a4982a97a668a5c0f793f7c771573f2bd3949 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2013857
* 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>