summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* futility: updater: always add a \0 when reading files from archivesstabilize-14771.Bfactory-firmware-ti50-guc-14778.Bfactory-14778.BHung-Te Lin2022-05-031-1/+5
| | | | | | | | | | | | | | | To simplify parsing text files in future we want the archive_read_file to always return a NULL terminated string on success. BUG=None TEST=make; run test BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I0dd0105971a80d857a1b05d9680b34b42dbff7e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3612645 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* keygeneration: add ability to generate accessory GSC RW signing key pairVadim Bendebury2022-04-301-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GSC RW signing requires a 3070 bit RSA key. The codesigner tool when invoked expects the public key in .pem format, the same format is used by the RO codebase when incorporating the public key in the RO image. This patch introduces a new accessory key generating script, which invokes the appropriate opensssl command to generated the required key pair. BUG=b:221423468 BRANCH=none TEST=ran scripts/keygeneration/accessory/create_new_gsc_key.sh and observed two gsc keys generated: ls -l *gsc* -rw------- 1 vbendeb vbendeb 2451 Apr 21 20:42 gsc_3070.pem -rw-r--r-- 1 vbendeb vbendeb 625 Apr 21 20:42 gsc_3070.pem.pub in the FPGA setup confirmed that Ti50 RW can be signed and verified using the generated key pair. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I429c250f60aa1da28aa99f39dff40c3bcda71df6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3600151 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: updater: support /firmware as a raw archiveHung-Te Lin2022-04-291-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For early bring up and the lab deployment, the developers need a simple way to update the firmware directly from the build artifacts (either from CPFE firmware archives or /build/$BOARD/firmware) before the firmware is pinned and available via chromeos-firmwareupdate. To simplify the process, we want the updater to understand the layout of files in /firmware. This change supports that as "raw archive" so developers can update by: # Verify what's available. futility update -a /build/$BOARD/firmware --manifest # Update the firmware for a specific model. futility update -a /build/$BOARD/firmware --model $MODEL # On DUT, detect the model and update the firmware. mkdir /tmp/firmware tar -xvf firmware.tbz -C /tmp/firmware futility update -a /tmp/firmware BUG=b:230679721 TEST=make; run tests BRANCH=None Change-Id: I8a262f1d2ec916da62e49a53fd45bdec9fa0ad9b Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3611322 Reviewed-by: Sergey Frolov <sfrolov@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Fix -Wstrict-prototypes warningManoj Gupta2022-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | ToT clang is complaining about missing 'void' in function prototype. futility/updater.c:1235:42: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] struct updater_config *updater_new_config() ^ void BUG=b:230345382 TEST=CQ, llvm tot test BRANCH=none Signed-off-by: Manoj Gupta <manojgupta@google.com> Change-Id: Ic68b71a7413e9396904dd319e0febce2eecb0df3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3610725 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Auto-Submit: Manoj Gupta <manojgupta@chromium.org>
* signer: Check the list of android image filesDaichi Hirono2022-04-271-0/+16
| | | | | | | | | | | | | | BUG=b:230434967 BRANCH=None TEST=Run ./sign_official_build.sh locally Signed-off-by: Daichi Hirono <hirono@chromium.org> Change-Id: I5e8b4d848f30f53fae58c721c9b7ddcfbfea9852 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3607891 Tested-by: Daichi Hirono <hirono@chromium.org> Commit-Queue: Daichi Hirono <hirono@chromium.org> Reviewed-by: Shao-Chuan Lee <shaochuan@chromium.org>
* futility/file_type_bios: Remove old FlashMap area namesJakub Czapiga2022-04-2710-8094/+2
| | | | | | | | | | | | | | | | | | | | Old names are not in use for very long time, so remove them. BUG=b:197114807 TEST=cros-workon-volteer start vboot_reference && \ FW_NAME=voxel emerge-volteer vboot_reference coreboot chromeos-bootimage TEST=sudo FEATURES=test emerge vboot_reference BRANCH=none Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I07916b82a721481c982b291e228df0772e0fc2a2 Disallow-Recycled-Builds: test-failures Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3575323 Auto-Submit: Jakub Czapiga <czapiga@google.com> Commit-Queue: Jakub Czapiga <czapiga@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Jakub Czapiga <czapiga@google.com>
* Revert "keygeneration: add ability to generate GSC RW signing key pairs"Vadim Bendebury2022-04-232-34/+1
| | | | | | | | | | | | | | This reverts commit 2981c0bacbaa0446562aaa04f23e3e9f07c86069, as that patch is not the proper way to generate accessory keys. BUG=b:221423468 BRANCH=none TEST=none Change-Id: I5500424b01ef45cc353468173f60f9b202b92b54 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3600150 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* keygeneration: add ability to generate GSC RW signing key pairsVadim Bendebury2022-04-202-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | GSC RW signing requires an 3070 bit RSA key. The codesigner tool when invoked expects the public key in .pem format, the same format is used by the RO codebase when incorporating the public key in the RO image. This patch introduces a new key option, RSA3070_NOSIG_ALGOID. The keys of this kind are not going to be processed by futility, hence no need to specify the signing algorithm. BUG=b:221423468 BRANCH=none TEST=ran ./create_new_keys.sh and observed two gsc keys generated: $ ls *gsc* gsc_rw_3070.pem gsc_rw_3070.pem.pub in the FPGA setup confirmed that Ti50 RW can be signed and verified using the generated key pair. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: Ie676ba8043c34900388372270329a4903656d499 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3591642 Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* Add a pre-built keyblock for arv_platformAlyssa Haroldsen2022-04-141-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | This adds a keyblock holding the arv_platform public key that is signed with the arv_root private key. The SHA-256 of the root key is 3d74429f35be8d34bcb425d4397e2218e6961afed456a78ce30047f5b54ed158. Command to build: ./build/futility/futility vbutil_keyblock \ --pack tests/devkeys/arv_platform.keyblock \ --datapubkey tests/devkeys/arv_platform.vbpubk \ --signprivate tests/devkeys/arv_root.vbprivk BUG=b:161483233 TEST=above command BRANCH=None Signed-off-by: Alyssa Haroldsen <kupiakos@google.com> Change-Id: I7989c081e4a3ad79f957e3e6d8a3b2314e06152f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3584691 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Alyssa Haroldsen <kupiakos@google.com> Tested-by: Alyssa Haroldsen <kupiakos@google.com>
* host/lib/flashrom_drv.c: Ensure buffer is large enough in write opEdward O'Callaghan2022-04-131-0/+3
| | | | | | | | | | | | | | | BUG=b:207808292 BRANCH=none TEST=emerge-octopus and cros deploy'ed Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: I8a8f941f224416d872592d6cc2de4caf058cb5bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3512274 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Nikolai Artemiev <nartemiev@google.com>
* [futility] Open gscvd in R/O mode when verifyingAlyssa Haroldsen2022-04-132-12/+18
| | | | | | | | | | | | | | | | | Otherwise, it will mutate the file under your feet! This also adds some clarifying messages, including a message if verification failed due to incorrect signing instead of silent output. BUG=None TEST=`futility gscvd <file>` does not change sha256sum of file BRANCH=None Signed-off-by: Alyssa Haroldsen <kupiakos@google.com> Change-Id: Ic793ad47c0160e3cedb7e2b7cc842a3f4380749d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3584690 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Alyssa Haroldsen <kupiakos@google.com> Tested-by: Alyssa Haroldsen <kupiakos@google.com>
* futility: updater: Support new servo control 'ccd_cpu_fw_spi'stabilize-quickfix-14695.187.Bstabilize-quickfix-14695.124.Bstabilize-14695.85.Bstabilize-14695.107.Brelease-R102-14695.BHung-Te Lin2022-04-133-40/+25
| | | | | | | | | | | | | | | | | | | Some newer devices need extra preparation steps even when using CCD via servo, so a new 'ccd_cpu_fw_spi' is added to hdctools. The firmware updater should use it in servo+ccd modes. Also, the custom_rst is now moved to detect_servo so the --servo_noreset option is removed. BUG=b:216832684 TEST=make; run test BRANCH=None Change-Id: I6af0f03d5b0b1bb473ecb29680b253a5b71c7465 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3577658 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com>
* vboot: Support servo micro and C2D2 for {get,set}_gbb_flags.sh --servo.stabilize-14682.BSam McNally2022-04-023-10/+20
| | | | | | | | | | | | | | | Detect servo micro and C2D2 servo types and toggle cpu_fw_spi before and after flash access is required. BUG=b:220992685 TEST={get,set}_gbb_flags.sh --servo with C2D2 and servo micro BRANCH=None Cq-Depend: chromium:3470605 Change-Id: I9f8a9bcabe731001ed18150ca1db9820db20e0d3 Signed-off-by: Sam McNally <sammc@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3469747 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* sign_gsc_firmware: drop version number check for node locked imagesVadim Bendebury2022-03-301-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | With introduction of Ti50 images the version of the eraseflashinfo capable images must change, which will prevent signing scripts from accepting Ti50 images from node locked signing. Enforcing the version number is proving to be a larger pain that in is worth: we do need to modify the version once in a while, and it takes a lot of effort and time to propagate the version adjustment through signing stages. We already have a quorum requirement for eraseflashinfo capable node locked images, this provides enough guarantee from accidental signing or malicious signing of such an image, version number enforcement does not add security. BRANCH=none BUG=b:219774807 TEST=none Change-Id: Ifd5ac17540595d71210445e6ad573c81fc25a47a Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3553419 Reviewed-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* futility: updater: add new quirk 'external_flashrom'stabilize-voshyr-14637.Bstabilize-14633.Bstabilize-14616.Bfactory-guybrush-14600.BHung-Te Lin2022-03-183-4/+8
| | | | | | | | | | | | | | | The new quirk will allow the updater to easily switch the underlying flash driver between the libflashrom and the external flashrom. BUG=None TEST=build and run test BRANCH=None Change-Id: I5b9da373b1e22a948e04d844973a5683adffe63c Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3534489 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: support external flashromHung-Te Lin2022-03-181-22/+156
| | | | | | | | | | | | | | | | | | | The libflashrom is still different from the real flashrom program. To easily debug and compare the execution results (especially for devices under development), we want to allow the updater to switch between the libflashrom and the external flashrom. The real switch (either a quirk or a command line argument) will be added in a follow up change. BUG=None TEST=build and run test BRANCH=None Change-Id: I3f3226fd555dc9e7c40838cd1474e0d018b27ccc Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3500339 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: refactor {write,load}_system_firmwareHung-Te Lin2022-03-183-187/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | The 'write_system_firmware' and 'load_system_firmware' have too many parameters that are already contained in the updater_config. To simplify the interfaces, we should just pass the updater_config to {write,load}_system_firmware, and merge the write_firmware_sections (only handling emulation and deciding the diff image) to the write_system_firmware. Also moved the utility functions only used by *_system_firmware (for example is_the_same_programmer and emulate_write_firmware) to the updater_utils.c. The emulate_write_firmware is also revised to handle a list of sections directly (so we don't need to handle that in write_system_firmware). BUG=None TEST=make; build and run test. BRANCH=None Change-Id: I4d123d12e8057da82d6c301899472e3773f3266e Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3508121 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: rename 'customlabel_tag' to 'custom_label_tag'Hung-Te Lin2022-03-185-23/+23
| | | | | | | | | | | | | | | | Per discussion, the 'custom_label_tag' is easier to read than 'customlabel_tag'. We should rename it before any real devices have started using the different names. BUG=b:169766857 TEST=make; build and run test BRANCH=None Change-Id: I3672e7b20bc85f79796470ba1a58c2896d26ff88 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3534491 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* 2api: Correct the comment of vb2api_disable_developer_mode()Hsuan Ting Chen2022-03-181-1/+1
| | | | | | | | | | | | | It should be VB2_NV_DISABLE_DEV_REQUEST, not VB2_NV_DIAG_REQUEST. BUG=b:172339016 TEST=none BRANCH=none Change-Id: Id35ea2680dd55d830991cf118f4e9c97f52eb0cb Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3532539 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility: correct typo of "flashrom"stabilize-14589.Bstabilize-14588.98.Bstabilize-14588.14.Bstabilize-14588.123.Brelease-R101-14588.BPeter Marheine2022-03-161-1/+1
| | | | | | | | | | | BUG=none TEST=still builds BRANCH=none Change-Id: I3b244461b86c8aeec4f33ad7205157c709e0d695 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3524288 Reviewed-by: Reka Norman <rekanorman@chromium.org>
* crossystem: Add support for MTL gpiochipSubrata Banik2022-03-151-0/+2
| | | | | | | | | | | | | | | | On Meteor Lake platform, the pinctrl (gpiochip) driver label is "INTC1083:00", hence declare it properly. BUG=b:224325352 TEST=Test pending Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: I9c1583972e71ae472c8b3f360eda34611c8c8f0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3520099 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Subrata Banik <subratabanik@chromium.org> Commit-Queue: Subrata Banik <subratabanik@chromium.org> Auto-Submit: Subrata Banik <subratabanik@chromium.org>
* futility: updater: revise building RW-recovery sectionsHung-Te Lin2022-03-111-8/+23
| | | | | | | | | | | | | | | When checking the sections to update in the RW-recovery flow, we should always check the availability before adding them to the list for updating. BUG=None TEST=build and run test BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Id714b1db736cbf4eef879566431e5a496f319cd4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3494671 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: always do partial verify (-N/--noverify-all)Hung-Te Lin2022-03-081-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The updater should always only update the whole image when write protection is disabled, or partial (RW) when write protection is enabled. As a result, it should be better to always turn on -N (--noverify-all) for two reasons: (1) faster partial write, and (2) prevent failure due to other processors accessing the flash in parallel. - Faster partial write: On recent x86 Chromebooks the flash size is getting bigger and bigger (for example 32M on Brya) and the RW section size is much smaller (8M on Brya). So we wasted a lot of time reading and verifying sections that we don't care (64M versus 16M) if we don't turn on -N. - Concurrent access: On recent x86 devices the system flash is shared by two processors - the CPU and the CSME. Before the ME is locked, CPU can see and access all regions - including those managed by ME/CSME. As a result, when the updater is changing the RW_SECTION, the CSME may be updating CSE_RO or CSE_RW on its own. So if we don't turn on -N, the verification will fail in CSE regions. Also revised to only set FLASHROM_FLAG_VERIFY_AFTER_WRITE one time. BUG=None TEST=make; build and run tests. BRANCH=None Change-Id: I1ebff2d7f00b85037464eff4fa5d4573f867ce44 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3505290 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: Change 'whitelabel_tag' to 'customlabel_tag'Hung-Te Lin2022-03-076-105/+117
| | | | | | | | | | | | | | | | | | | | Support new VPD name 'customlabel_tag' for the custom label program. For shipped devices (firmware is already locked and write protected) we still support the legacy name. The quirk 'allow_empty_wl_tag' also renamed to 'allow_empty_customlabel_tag'. This is usually not recommended, but given no devices have used this quirk in the CBFS quirks, it should be fine to change the quirk name. BUG=b:169766857 TEST=make; build and run test BRANCH=None Change-Id: Ia29051a4e829d853cc60488f286d575c20f52f20 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3503199 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot_ref/cgpt: Move mkdir out of flashrom worker funcEdward O'Callaghan2022-03-034-18/+16
| | | | | | | | | | | | | | | | | | Small refactor to make it easier to more towards libflashrom. This makes the call site responsible for setting up the path for ReadNorFlash(). BUG=b:207808292,b:220079643 BRANCH=none TEST=`make cgpt` Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: I15fc57e5afca6206b60df92616fd4cdce63b03e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3469738 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* vboot_ref/cgpt: Consolidate flashrom write cmd pathsEdward O'Callaghan2022-03-031-14/+15
| | | | | | | | | | | | | | | | Small refactor to make it easier to more towards libflashrom. BUG=b:207808292,b:220079643 BRANCH=none TEST=`make cgpt` Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Ie0c7f4faee3052300b10ba2d1adce7876d7b821c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3469737 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility: Support C2D2 with futility update --servo.Sam McNally2022-03-031-0/+7
| | | | | | | | | | | | | | | C2D2 is used similarly to servo micro. Mirror the servo micro logic accordingly. BUG=b:220992685 TEST=futility update --servo over C2D2 with and with servo v4 BRANCH=None Cq-Depend: chromium:3470605 Change-Id: I298fe5847abba0957fa5c2da4e1981a7da9e0428 Signed-off-by: Sam McNally <sammc@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3469746 Reviewed-by: Reka Norman <rekanorman@chromium.org>
* futility: updater: increase verbosity on retriesHung-Te Lin2022-03-021-2/+2
| | | | | | | | | | | | | | To get more message for debugging, we want to increase the verbosity on each retry. BUG=None TEST=build and run tests BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I85e0fc518113a18bb1aaa39db3f58329d94b5ecb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3500326 Reviewed-by: Subrata Banik <subratabanik@chromium.org>
* vboot_ref/cgpt: Use defines for region constsEdward O'Callaghan2022-03-011-3/+7
| | | | | | | | | | | | | | BUG=b:207808292,b:220079643 BRANCH=none TEST=`make cgpt` Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: I367e44eed18c79a807bd428e50a3faf926833719 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3461097 Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility: updater: write multiple sections in recovery RW updateHung-Te Lin2022-03-011-6/+19
| | | | | | | | | | | | | | | | | | The write_firmware_sections now supports writing multiple sections in one invocation so we can pass all RW sections to it for the recovery update. On Brya, the total execution time may be reduced from 4 mins to 1.5 mins. BUG=b:221137867 TEST=build and run test BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Ifbc67327a02096e027c1e2025485ebb17645a71d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3490387 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* futility: updater: allow writing multiple sections in one flash commandHung-Te Lin2022-03-011-16/+37
| | | | | | | | | | | | | | Add new function 'write_firmware_sections' so we can write update sections in one write_system_firmware (e.g., flashrom) command. BUG=b:221137867 TEST=build; and run test BRANCH=None Change-Id: Ia33ec5ac82e1c661457180ec45df6c02beae4ec3 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3490389 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* futility: flashrom_drv: support partial write for multiple regionsHung-Te Lin2022-03-015-24/+52
| | | | | | | | | | | | | | | | | | | | | | | When we have multiple regions to update, invoking flashrom_write_image multiple times will take much longer because for each write it has to read the whole flash, write and then verify whole flash (also timer calibration and programmer init/shutdown every time). As a result, we want to support writing multiple regions - just like that flashrom can take arbitrary numbers of "-i REGION". This change only extended flashrom_write_image, and the firmware updater is calling flashrom_drv multiple times. That will be addressed in the follow up changes. BUG=b:221137867 TEST=build; and run test BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Id335cc9f816f1384f1886422efa97fe2c7b81aec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3490388 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* vboot_reference/Makefile: Fix building with USE_FLASHROM:=0Edward O'Callaghan2022-02-281-7/+10
| | | | | | | | | | | | | | | | | | Unfortunately the USE_FLASHROM build flag broke during a refactor in commit f0af257a9b333b. This flag is needed for coreboot builds. Resolve by putting relevant files under guards. BUG=b:221234560,b:220833585 BRANCH=none TEST=`USE_FLASHROM={0,1} make` Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Ic10a3909bf070897cef7f1556deef57eba6c57f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3493527 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Martin Roth <martinroth@google.com> Commit-Queue: Martin Roth <martinroth@google.com>
* EC-EFS: Ignore NO_BOOT if EC sync isn't enabledDaisuke Nojiri2022-02-272-0/+3
| | | | | | | | | | | | | | | | | | Currently, Depthcharge prevents the kernel from being loaded if NO_BOOT flag is set. This makes sense only when EC sync is enabled. This patch makes VbSelectAndLoadKernel ignore NO_BOOT flag if VB2_CONTEXT_EC_SYNC_SUPPORTED isn't set. BUG=b:216317864 BRANCH=None TEST=None Change-Id: Ic501f430754947dfa8a2243dcb12d31232b18b75 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3433028 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: updater: decide if we can use diff-image by programmerstabilize-14536.BHung-Te Lin2022-02-261-3/+21
| | | | | | | | | | | | | | | | | | | Previously we decide if the flash command can use the image_current as the diff image by comparing if the target image pointer is identical to the host image to write (cfg->image). This may not work properly if we try to write a temporary firmware image object loaded separately. A more correct way to is check if the image has the same programmer from the diff image (e.g., image_current). BUG=b:221137867 TEST=build and run futility tests. BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Iee61cd9b47c0db4b87001bbb348f95a89495b975 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3490386 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: updater: improve updater console outputHung-Te Lin2022-02-253-3/+22
| | | | | | | | | | | | | | | | | | | To help debugging: - Print equivalent flashrom commands when reading and writing. - Print <sys-flash> instead of <none> in 'Current system:' message. - Always print the detected model from libcrosid. - After writing to flash, print a new line. BUG=None TEST=make; build and run test BRANCH=None Change-Id: I34a73ec1c968a98a9fca649c65863aa43ca39ca8 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3461090 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: check flashrom return code and bail with errorYH Lin2022-02-241-10/+28
| | | | | | | | | | | | | | | | | | | During the flashrom initialization sequence the return code is not being checked therefore there's a potential that the code moves forward with read/write operation even with outstanding error. This CL checks the return code and bail with error. BUG=b:217629892 TEST=Test futility update with multiple instances of flashrom running. BRANCH=None Signed-off-by: YH Lin <yueherngl@chromium.org> Change-Id: I0768232f6af35290ad7b3d9f479ee299bf9400e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3485520 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* futility: updater: explain that match-name quirks are now deprecatedstabilize-14532.BHung-Te Lin2022-02-221-0/+8
| | | | | | | | | | | | | | | The 'match by firmware name' should be deprecated. All new platforms should use quirk instruction files (updater_quirks) from CBFS. BUG=None TEST=None (comments only) BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Ib66cc903b15bf3fdb44db832a010d80c40bfbaa4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3458024 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@google.com>
* futility: updater: disable quirk 'ec_partial_recovery' by defaultHung-Te Lin2022-02-221-15/+6
| | | | | | | | | | | | | | | | | | | The 'ec_partial_recovery' quirk is not very helpful today because the two underlying functions - "EC RO software sync" and "update EC RO without sysjump by flashrom" are either disabled or not well tested. As a result we should change the quirk from "decide by runtime" to "default disabled". BUG=b:218612817 TEST=make; build and run test BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I9022b88516e52cb89f2226523a754dc2a00b15da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3458023 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot_ref/flashrom_drv: Allow sentinel verbosity valueEdward O'Callaghan2022-02-211-2/+2
| | | | | | | | | | | | | | | | | Allow for picking the default verbosity with a sentinel value of -1. BUG=b:207808292 BRANCH=none TEST=none Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Ia3a21e8647fe480c60ea80ecb060466e9d86110a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3461094 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Nikolai Artemiev <nartemiev@google.com>
* vboot_ref: Reshuffle parallel flashrom implEdward O'Callaghan2022-02-195-48/+62
| | | | | | | | | | | | | | | | | | | | Bring sub-process and libflashrom wrapper implementations under the common host/lib path to later be reconciled. The WP implementation is left separated out due to the lack of a libflashrom WP implementation which creates circular dependencies for the moment. BUG=b:207808292 BRANCH=none TEST=none Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Ic759c4e9828778a0ef1443b163224aef2c7cba54 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3461093 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* vboot_ref: merge struct firmware_image;Edward O'Callaghan2022-02-192-14/+3
| | | | | | | | | | | | | | | BUG=b:207808292 BRANCH=none TEST=none Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: I49bd29dcfe12ad9845213d07bc6bee71980a8cd1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3461092 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Sam McNally <sammc@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* vboot_ref: Add TODO in host/lib/include/flashrom.hEdward O'Callaghan2022-02-191-0/+8
| | | | | | | | | | | | | | | BUG=b:207808292 BRANCH=none TEST=none Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Iaf94b5cc8c7b4f4b7859f10b8078e922bc1636d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3450057 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Sam McNally <sammc@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* vboot: Add --programmer and --servo flags to {get,set}_gbb_flags.sh.stabilize-quickfix-14526.91.Bstabilize-14528.Bstabilize-14526.89.Bstabilize-14526.84.Bstabilize-14526.73.Bstabilize-14526.67.Bstabilize-14526.57.Brelease-R100-14526.BSam McNally2022-02-173-8/+63
| | | | | | | | | | | | | | | | | | | | | Allow custom programmers to be used instead of host for getting and setting GBB flags via a --programmer/-p flag similar to the same flag for futility. Also support --servo with the same semantics as the futility flag - detecting the programmer to use from the current servod instance mirroring the logic in futility. Only CCD is supported at this stage. When reading, include the FMAP section as well as the GBB section. For writes over CCD, avoiding rescanning for the FMAP can save up to 1.8s. BUG=None TEST={get,set}_gbb_flags.sh --servo with and without servod running BRANCH=None Change-Id: Iecedf4c3d0cad6923aed4405ef4a72910f3f9f05 Signed-off-by: Sam McNally <sammc@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3455562 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* vboot_reference: lib/flashrom convert args into structEdward O'Callaghan2022-02-145-79/+92
| | | | | | | | | | | | | | | | | | | | This attempts to converge the signatures of host/lib/flashrom with that of 'futility/updater_utils.h:struct firmware_image'. with the eventual goal of converging the multiple flashrom wrapper implementations. BUG=b:207808292 BRANCH=none TEST=`$ cros_run_unit_tests --board nocturne --packages vboot_reference` Cq-Depend: chromium:3399963 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: I016dacbdca6f1108def0dbc608d83e0066a30023 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3301571 Reviewed-by: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility: updater: add new quirk 'extra_retries'Hung-Te Lin2022-02-145-11/+41
| | | | | | | | | | | | | | | | | In early bring up, some devices may have problem when flashrom is reading or writing to the system flash. To unblock dogfood process, we want to have a special quirk to retry flashing. BUG=b:213706510 TEST=make; build and run test BRANCH=None Change-Id: I58788f620fb32f7c886d1e5638f4a3605ea77953 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3452846 Reviewed-by: YH Lin <yueherngl@chromium.org> Commit-Queue: YH Lin <yueherngl@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility/updater: Ignore preserve_me quirks for non-host programmers.Sam McNally2022-02-132-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | The preserve_me quirk allows avoiding modifying the ME region while it may be running. Its apply function attempts to skip itself when not flashing the OS-bundled firmware by checking for whether an archive is set, but this doesn't work since in the absence of an actual archive file, a filesystem archive implementation is used instead. While flashing over a non-host programmer the ME is not running and therefore it is safe to update the ME region. Add unit test cases for the preserve_me quirk applying successfully when using the default host programmer and being skipped when using another programmer. BUG=b:213706510 TEST=futility update -p dummy... with preserve_me quirk skips the quirk; chromeos-firmwareupdate with a preserve_me quirk applies the quirk BRANCH=none Change-Id: Ie5578c9b3cf7eba55626bb931589bf360fe28269 Signed-off-by: Sam McNally <sammc@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3450060 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* make_dev_ssd.sh: Update grub defaultA and defaultBJeffery Miller2022-02-111-2/+3
| | | | | | | | | | | | | | | | | | | | | Update the defaultA=2 and defaultB=3 grub settings to remove verification. In change I930d0f3f1a3f8f54edd1dce7f8259e3c261af9a1 the default options for grub were changed to be defaultA and defaultB instead of 'set default=2'. Update the removal to support these new configuration settings. BRANCH=none BUG=b:186240229 TEST=on a reven build run `/usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --force`; reboot and confirm verity is disabled Change-Id: I70ceed432c29865715c525a6ae13f0e7da8ee0ba Signed-off-by: Jeffery Miller <jefferymiller@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3445175 Reviewed-by: Nicholas Bishop <nicholasbishop@google.com> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Nicholas Bishop <nicholasbishop@google.com>
* futility: updater: prevent unexpected update for the RW_LEGACY sectionHung-Te Lin2022-02-081-5/+7
| | | | | | | | | | | | | | | | | | | When updating the legacy section, we have to check the existence of 'cros_allow_auto_update' in both 'from' and 'to' images, and only update if they both have the correct tag file. BUG=b:215175246,chromium:1169544 TEST=make; build and run test BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I81f62f42cf9a6f6f1931e05cd07131b569ad0cb0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3404063 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* sign_official_build: Sign hps_firmwareEvan Benn2022-02-081-0/+3
| | | | | | | | | | | | | | | | BUG=b:204378599 TEST=None BRANCH=None Signed-off-by: Evan Benn <evanbenn@chromium.org> Cq-Depend: chrome-internal:4473134 Change-Id: I2316ec9e75e854352350e90055e717a258c43f6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3388968 Tested-by: Evan Benn <evanbenn@chromium.org> Auto-Submit: Evan Benn <evanbenn@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Evan Benn <evanbenn@chromium.org>