summaryrefslogtreecommitdiff
path: root/host
Commit message (Collapse)AuthorAgeFilesLines
* Revert "vboot: update get system properties"Edward O'Callaghan2023-05-081-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8ef4f7a9a9a68bad49e8417d5ed346dc927e1d2c. Reason for revert: Installer supposedly misuses API with `VbGetSystemPropertyString("fw_try_next", NULL, 0);` by passing a `NULL` ptr as dest and so not sized. The call sites need checking. BUG=b:280417931 TEST=none Original change's description: > vboot: update get system properties > > `VbGetSystemPropertyString` header promises that the property string > will be read into the passed in dest buffer, however for some system > properties the values are not placed in buffer but returned directly. > this patch fixes that error > > Before, running `VbGetSystemPropertyString("minios_priority", buf, > size):` > ``` > buf: return value: B > ``` > After, same command: > ``` > buf: B return value: B > ``` > > BRANCH=none > BUG=none > TEST=Tested with an executable on brya > > Signed-off-by: Saketh Pothireddy <spothire@chromium.org> > > Change-Id: I87a0aa8638e719bc5bbea579ecaca4754a38c02e > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4468208 > Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> > Reviewed-by: Julius Werner <jwerner@chromium.org> > Commit-Queue: Saketh Pothireddy <spothire@google.com> > Tested-by: Saketh Pothireddy <spothire@google.com> Bug: none Change-Id: Ie07363424db92832b485c9efae21edbf0d24fba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4508974 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* vboot: update get system propertiesstabilize-15446.BSaketh Pothireddy2023-04-271-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `VbGetSystemPropertyString` header promises that the property string will be read into the passed in dest buffer, however for some system properties the values are not placed in buffer but returned directly. this patch fixes that error Before, running `VbGetSystemPropertyString("minios_priority", buf, size):` ``` buf: return value: B ``` After, same command: ``` buf: B return value: B ``` BRANCH=none BUG=none TEST=Tested with an executable on brya Signed-off-by: Saketh Pothireddy <spothire@chromium.org> Change-Id: I87a0aa8638e719bc5bbea579ecaca4754a38c02e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4468208 Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Saketh Pothireddy <spothire@google.com> Tested-by: Saketh Pothireddy <spothire@google.com>
* futility/: host/lib: Add flash chip info subcommand supportEdward O'Callaghan2023-04-132-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The AP RO verification tooling requires a understanding of the underlying flashchip information. Provision support in the flash subcommand to report back this data from the flashrom driver. BUG=b:276981092 BRANCH=none TEST=on Nissa ``` localhost ~ # futility flash --flash-i{nfo} Warning: Setting BIOS Control at 0xdc from 0x8b to 0x89 failed. New value is 0x8b. Flash vendor: Winbond Flash name: W25Q256JV_M Flash vid-pid: 0xef00007019 Flash size: 0x02000000 ```. Cq-Depend: chromium:4401775, chromium:4401776 Change-Id: I58e818f06def4904693f61c6967d70b16c62fa37 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4402370 Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Jakub Czapiga <czapiga@google.com> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
* cgpt: Add support for error counter (verity)Jae Hoon Kim2023-03-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .. so platform side daemons/process can initiate getting/setting the error counter (verity) attribute from GPT partitions of CrOS kernels. ``` $> cgpt show <IMAGE> 405504 65536 2 Label: "KERN-A" Type: ChromeOS kernel UUID: 0394A807-59A0-A84C-A443-BC3C555C8842 Attr: priority=15 tries=15 successful=1 error_counter=0 ... $> cgpt add -E1 -i2 <IMAGE> $> cgpt show <IMAGE> 405504 65536 2 Label: "KERN-A" Type: ChromeOS kernel UUID: 0394A807-59A0-A84C-A443-BC3C555C8842 Attr: priority=15 tries=15 successful=1 error_counter=1 ... $> cgpt add -E0 -i2 <IMAGE> $> cgpt show <IMAGE> 405504 65536 2 Label: "KERN-A" Type: ChromeOS kernel UUID: 0394A807-59A0-A84C-A443-BC3C555C8842 Attr: priority=15 tries=15 successful=1 error_counter=0 ... ``` BUG=b:274539529 BRANCH=None TEST=emerge vboot_reference TEST=comment above Change-Id: Ib0904378fba8219a3631278c66b7317fd86ea9d8 Signed-off-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4370744 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Add `flash` subcommandstabilize-15393.48.Brelease-R113-15393.Bfirmware-skyrim-15390.BNikolai Artemiev2023-03-162-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | Add a new subcommand for getting/setting flash properties such as the flash size and writeprotect configuration. The operations provided by `futility flash` require less information from the user and are less error prone than the equivalents provided by `flashrom`. For example, --wp-enable automatically choses the protection range based on the firmware image and --wp-status gives a warning if the protection range does not match the RO firmware region. BUG=b:268574030 BRANCH=none TEST=`futility flash --{flash-size,wp-enable,wp-disable,wp-status}` Co-authored-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Change-Id: I36d7468616a5bcdf3c4542d48652bd24c3377a61 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4279661 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* vboot_reference: Change flashrom_get_wp signatureNikolai Artemiev2023-03-092-16/+27
| | | | | | | | | | | | | | | | | | | Expose more information about WP state from the flashrom_drv WP status function. The more detailed WP information is required to properly validate the system WP configuration. BUG=b:268574030 TEST=futility update Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Change-Id: If79b7d8cc68a0583cbf1f7049ac7a2dec088fdd0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4301750 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* lib/flashrom_drv.c: Use correct programmer name for programmer initNikolai Artemiev2023-03-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the call to `flashrom_programmer_init()` in `flashrom_get_wp()`. The programmer name and parameters should be passed separately, e.g: > flashrom_programmer_init("dummy", "emulate=VARIABLE_SIZE,...") However a string containing both the name and parameters was incorrectly used instead, e.g: > flashrom_programmer_init("dummy:emulate=VARIABLE_SIZE,...", "emulate=VARIABLE_SIZE,...") This was not noticed before because it did not cause issues if there were no parameters, e.g. if the programmer was just "host" or "internal" BUG=b:238694831,b:260531154 TEST=cros_run_unit_tests --board octopus --packages vboot_reference Change-Id: I4774a82258acbb8be2b430351ccef203e26e6b27 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4290837 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* futility: flashrom_drv: Support partial read for multiple regionsYu-Ping Wu2023-02-162-21/+39
| | | | | | | | | | | | | Similar to CL:3490388, support flashrom read for multiple regions. BUG=b:260531154 TEST=emerge-corsola vboot_reference BRANCH=none Change-Id: I1f75832f882004e879bc299be6862db089c2b71d Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4251503 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* host/lib/flashrom_drv.c: Move flag to avoid locked ME issueEdward O'Callaghan2023-02-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Older Intel DUT's have a ME in "locked" mode in the descriptor and while the write_flash() attempts to write back to flash to a specific region it needs to read the FMAP to obtain the region name. This read overlaps with the "locked" region and thus the following is observed in logs: ``` FREG2: Management Engine region (0x00001000-0x001fffff) is locked. [..] read_flash: cannot read inside Management Engine region (0x001000..0x1fffff). ``` BUG=b:269199980 TEST=builds. Change-Id: If7bebf28cd4d34cc4074700184233c83edbd2409 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4248344 Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* host: Add region parameter to flashrom_read_imageEvan Benn2023-01-272-4/+11
| | | | | | | | | | | | | | | Allow flashrom_read_image to take a parameter to read only a region. BUG=b:265861606 BRANCH=None TEST=unit Change-Id: I835ca341c00b21286721f65c3e009a76753b6628 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4170146 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* host: flashrom_drv: Read fmap layout from flash onlyEvan Benn2023-01-271-12/+5
| | | | | | | | | | | | | | | | | | | | | | | flashrom_read_region was attempting to read the fmap from the provided destination buffer before falling back to the rom with a warning. Then it would leak the buffer anyway using calloc. This was undocumented behaviour. There is only one callsite of this function (futility manifest_detect_model_from_frid) and it does not use this feature: it initialises a zeroed firmware_image. BUG=b:265861606 BRANCH=None TEST=futility update -a /usr/sbin/chromeos-firmwareupdate --detect-model-only # grunt Change-Id: I90b4be9b1b22b19c84252425e770e30e4def3a7c Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4170145 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org>
* futility/flashrom_drv: Add new skip perm flags to read pathstabilize-15329.59.Bstabilize-15329.44.Brelease-R111-15329.BEdward O'Callaghan2023-01-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | flashrom now respects region permissions rather than ignoring exit codes. While downstreaming this support we require these flags to be set to ensure no change in behavior for futility. It turns out chromeos-firmware-updater will fail on the read path with, ``` [..] read_flash: cannot read inside Management Engine region (0x001000..0x1fffff). Read operation failed! ERROR: do_update: Cannot load system active firmware. ``` without skipping regions that cannot actually be read. BUG=b:260440773 BRANCH=none TEST=builds Change-Id: I45a5b81837988fab18b1c392415dffe55ad49822 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4181583 Reviewed-by: Evan Benn <evanbenn@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility/flashrom_drv: Add new skip perm flagsEdward O'Callaghan2023-01-061-0/+2
| | | | | | | | | | | | | | | | | | flashrom now respects region permissions rather than ignoring exit codes. While downstreaming this support we require these flags to be set to ensure no change in behavior for futility. BUG=b:260440773 BRANCH=none TEST=builds Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Id54164385d24b3a9f2bf1da8490baf05c4728cf3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4127324 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* crossystem: Print an error log if we fall back to WPSW_BOOTDouglas Anderson2022-12-151-0/+3
| | | | | | | | | | | | | | | | | | On new systems, WPSW_BOOT is potentially bogus. The BIOS doesn't set it so it always reports that the device is _not_ write protected. Let's print an error log so we have an idea if we ever fall back. BRANCH=None BUG=b:249498455, b:254337014 TEST=Force a failure and see the log Change-Id: Ie741ca9f9f938382ea7e56cfd81bd273dd9bb548 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/+/4104708 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org>
* Reland "crossystem: Add board_id property"Jack Rosenthal2022-11-232-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 87663c3bef0f6b198945cf3eb83632f461a5d6f8. The parent CL to this commit should be sufficient to resolve the failure that prevented "crossystem board_id" on ARM from working. Original change's description: > crossystem: Add board_id property > > futility is one of a few places in ChromeOS that uses "mosys platform > version". The goal is to remove this command from mosys. > > This commit adds a new property to crossystem, "board_id", which > reads the board revision from SMBIOS/FDT, and replaces the call in > futility with the appropriate VbGetSystemPropertyInt. > > BUG=b:187790074 > BRANCH=none > TEST="crossystem board_id" on hana and brya > > Change-Id: Id69c8e309c0e509a165aa6da2778573ac7de3455 > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4029537 > Reviewed-by: Julius Werner <jwerner@chromium.org> BUG=b:187790074 BRANCH=none TEST="crossystem board_id" on hana and brya Change-Id: I37b4c622e3c1d294b5be8e0d98ef14175902acc3 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4045047 Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: arm: Make FDT_BASE_PATH /proc/device-treeJack Rosenthal2022-11-231-15/+16
| | | | | | | | | | | | | | | | Hard-coding to /proc/device-tree/firmware/chromeos won't let us read device-tree properties outside of /firmware/chromeos. The follow-on CL reads from /firmware/coreboot. BUG=b:187790074 BRANCH=none TEST=CQ passes Change-Id: I752aa5a1e20db1dad7f2508852c7a1c982a4bcb4 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4045046 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Revert "crossystem: Add board_id property"stabilize-15251.BBrian Norris2022-11-192-28/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit db1b34f559fdbf5584b57007da43e4dddda43c6a. Reason for revert: seems to break scarlet - b/259702907 Original change's description: > crossystem: Add board_id property > > futility is one of a few places in ChromeOS that uses "mosys platform > version". The goal is to remove this command from mosys. > > This commit adds a new property to crossystem, "board_id", which > reads the board revision from SMBIOS/FDT, and replaces the call in > futility with the appropriate VbGetSystemPropertyInt. > > BUG=b:187790074 > BRANCH=none > TEST="crossystem board_id" on hana and brya > > Change-Id: Id69c8e309c0e509a165aa6da2778573ac7de3455 > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4029537 > Reviewed-by: Julius Werner <jwerner@chromium.org> Bug: b:187790074, b:259702907 Change-Id: Ibdc2525d6f395e2ef63354d36ca02b71543e8079 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4038443 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Brian Norris <briannorris@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jack Rosenthal <jrosenth@chromium.org>
* host/lib/cbfstool: Fix cbfs verification validity checkJakub Czapiga2022-11-171-1/+1
| | | | | | | | | | | | | | | | | cbfstool uses tab instead of space, and because of that current code does not work correctly with metadata hash images. Changing space to tab in pattern fixes the issue. BRANCH=none BUG=b:259153966,b:197114807 TEST=build bootimage for volteer/voxel Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Iab6ab56927a6bea9275eda4a5bad1ad73b779a69 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4030402 Commit-Queue: Jakub Czapiga <czapiga@google.com> Tested-by: Jakub Czapiga <czapiga@google.com> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* crossystem: Add board_id propertyJack Rosenthal2022-11-172-0/+28
| | | | | | | | | | | | | | | | | | futility is one of a few places in ChromeOS that uses "mosys platform version". The goal is to remove this command from mosys. This commit adds a new property to crossystem, "board_id", which reads the board revision from SMBIOS/FDT, and replaces the call in futility with the appropriate VbGetSystemPropertyInt. BUG=b:187790074 BRANCH=none TEST="crossystem board_id" on hana and brya Change-Id: Id69c8e309c0e509a165aa6da2778573ac7de3455 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4029537 Reviewed-by: Julius Werner <jwerner@chromium.org>
* host/lib: Add flashrom_read_region() to read just the requested regionSam McNally2022-11-172-3/+29
| | | | | | | | | | | | | | | | | | | | The region parameter to flashrom_read_image() is essentially unusable in isolation since it reads just the requested region into a buffer sized to the entire flash, at the offset of the region within the flash. Remove its unused region parameter and split the functionality of requesting a region into flashrom_read_region() which stores just the requested region into a buffer sized to the region. BUG=b:253966060 TEST=futility update --detect-model -a <archive> works as expected BRANCH=None Signed-off-by: Sam McNally <sammc@chromium.org> Change-Id: Ibf6c152dd42fbc99c1742fb077bc6aa35feeed08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3965583 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* crossystem: arm: Retry if we fail to read a GPIODouglas Anderson2022-10-201-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that if two processes try to read the same GPIO at the same time that one of them will fail because the GPIO is "busy". This is really by design of the kernel's GPIO API. In order to read a value, each userspace process "requests" control of the GPIO and then queries it. There doesn't appear to be any way to "wait" for a GPIO that's been requested by someone else--we just need to wait a bit and try again later. ...so that's what we'll do. Without this patch, if you run the following script on a write-protected sc7180-trogdor class device in two shells at the same time: old_val="" while true; do val=$(crossystem wpsw_cur) if [[ "${val}" != "${old_val}" ]]; then echo "$(date): ${old_val} => ${val}" old_val="${val}" fi done Then you'll see stuff like this: GPIO_GET_LINEHANDLE_IOCTL: Device or resource busy Tue Oct 18 11:34:01 PDT 2022: 1 => 0 Tue Oct 18 11:34:01 PDT 2022: 0 => 1 GPIO_GET_LINEHANDLE_IOCTL: Device or resource busy Tue Oct 18 11:34:01 PDT 2022: 1 => 0 Tue Oct 18 11:34:01 PDT 2022: 0 => 1 The 0 actually comes from the fact that crossystem falls back to `GetVdatInt(VDAT_INT_HW_WPSW_BOOT)` if it fails to read the GPIO and that value isn't initted to anything on trogdor (VDAT_INT_HW_WPSW_BOOT is deprecated and not populated on trogdor). It is postulated that the above problem is causing some parts of the system to get confused about the write protect state of devices. BRANCH=none BUG=b:249498455 TEST=Run script in CL commit message and see no errors Change-Id: I307cdb4e290c27694690a19af60f4697ee0233e4 Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3963985 Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* firmware: host: futility: Add CBFS metadata hash supportstabilize-15183.14.BJakub Czapiga2022-10-126-1/+301
| | | | | | | | | | | | | | | | | | | | | | This patch adds support for signing and verification of coreboot images supporting VBOOT_CBFS_INTEGRATION. Images with config option CONFIG_VBOOT_CBFS_INTEGRATION=y will be signed with CBFS metadata hash in signature. vb2api_get_metadata_hash() should be used to extract hash value from VBLOCK and then should be used to verify CBFS metadata. To support full verification, CBFS file data verification should also be enabled and correctly handled. BUG=b:197114807 TEST=build with CB:66909 and boot on volteer/voxel with CONFIG_VBOOT_CBFS_INTEGRATION=y BRANCH=none Signed-off-by: Jakub Czapiga <czapiga@google.com> Change-Id: I4075c84820949be24c423ed14e291c89a0032863 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3811754 Commit-Queue: Julius Werner <jwerner@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* treewide: Fix license headers to conform with linterJakub Czapiga2022-10-0451-52/+51
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=cros lint Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I7710c43c8c70cf257a898f22c42ecbf350e125a2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3925702 Commit-Queue: Jakub Czapiga <czapiga@google.com> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Jakub Czapiga <czapiga@google.com>
* tests: Remove --allow-multiple-definition linker optionYu-Ping Wu2022-09-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The --allow-multiple-definition linker option was added in CL:6770 to allow mocking functions. Now that we're exclusively using the weak attribute (or equivalently test_mockable in vboot_reference) in other firmware repositories (coreboot, depthcharge) for unit testing, the --allow-multiple-definition option should no longer be needed. In addition, one problem with --allow-multiple-definition is that, when a function being mocked is automatically inlined by compiler optimization, the mock function may not be called at all, leading to unexpected behavior. Marking that function as test_mockable can prevent this situation. Therefore, add test_mockable to all the functions being mocked, and remove the linker option from Makefile. BUG=none TEST=make -j32 test_setup && make runtests BRANCH=none Change-Id: Ifcd8138641d17bff689dd5093cdd69e4da9f0b0c Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3744746 Reviewed-by: Jakub Czapiga <czapiga@google.com> Commit-Queue: Jakub Czapiga <czapiga@google.com>
* subprocess: Log subprocess arguments when runningstabilize-15117.86.Bstabilize-15117.48.Bstabilize-15117.111.Brelease-R107-15117.BJakub Czapiga2022-09-102-2/+25
| | | | | | | | | | | | | | | | | | | | | | Utility programs in vboot sometimes use subprocess_run to execute another program like flashrom or cbfstool. This change makes it easier to debug these utilities by logging executed subprocess and its arguments. This change also fixes futility vb2ex_printf() implementation. Previously use of VB2_DEBUG_RAW() calling vb2ex_printf(NULL, ...) was unnecessarily trying to print NULL as function name, which was not intended behavior. TEST=sign image and look for "Run: cbfstool ..." BUG=none BRANCH=none Signed-off-by: Jakub Czapiga <czapiga@google.com> Change-Id: I613d4af4af4370425cbbedc2d7de29a488533c6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3878593 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* firmware: 2sha: Integrate HW crypto directly into vb2_digest APIJulius Werner2022-09-017-38/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the connection to the vb2ex_hwcrypto API further down the stack, into the low-level vb2_digest and vb2_hash APIs. These functions will now take an extra allow_hwcrypto argument that the caller can use to deny or allow hwcrypto by policy. If allowed, the function will try HW crypto first and fall back to the software implementation if the selected algorithm is not supported. vb2_hwcrypto_allowed() is made available to external callers as a vb2api function to make that decision in most cases (for others, like userspace tools and testing, HW crypto is generally not used anyway and they can just pass `false`). Since vb2ex_hwcrypto_digest_init() takes a data_size argument for the total amount of bytes expected, vb2_digest_init() will now also need to take this extra argument. But since the total data size cannot always be known in advance, callers are allowed to pass 0 to indicate that the size is unknown. The software implementations work either way, and HW crypto implementations will now need to check if data_size is 0 and return HWCRYPTO_UNSUPPORTED if they cannot handle this case. While we're touching everything anyway, let's take this opportunity to retire the vb2_digest_buffer() API in favor of the newer and usually more convenient vb2_hash_calculate(), so we can limit the amount of separate APIs we have to support going forward. BRANCH=none BUG=b:240624460 TEST=runtests Signed-off-by: Julius Werner <jwerner@chromium.org> Cq-Depend: chromium:3854282 Change-Id: I34c3f54e31742619d422d1cd871bdb77ad0439b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3825558 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot_reference: make flashrom_get_wp() use libflashromNikolai Artemiev2022-08-182-0/+67
| | | | | | | | | | | | | | | | | | | | This makes flashrom_get_wp() use the new libflashrom WP interface that was recently added to flashrom and moves it to host/lib/flashrom_drv.c with the other libflashrom wrapper functions. BUG=b:223291615 BRANCH=none TEST=flashrom --wp-disable; futility update -i image.bin \ futility prints: `Write protection: 0 (disabled; HW=0, SW=0).` TEST=flashrom --wp-enable; futility update -i image.bin \ futility prints: `Write protection: 0 (disabled; HW=0, SW=1).` Change-Id: Ib13eeb2f1f718443271b074969ff69e66149f401 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3540785 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* host/lib/cbfstool: Fail on subprocess errorJakub Czapiga2022-08-051-2/+5
| | | | | | | | | | | | | | | | | | | Make cbfstool_truncate() fail critically on subprocess execution error. cbfstool is mandatory, so it should always be available. If subprocess_run(), then either cbfstool is not available, or code is incorrect, so it should not return. BUG=none TEST=make runfutiltests BRANCH=none Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I17089d0cc2512a25f25cafe616caa79845a7e078 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3804563 Commit-Queue: Jakub Czapiga <czapiga@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Jakub Czapiga <czapiga@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
* 2load_kernel.c: Expose load kernel as vb2_apiHsin-Te Yuan2022-07-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Move VbTryLoadKernel() and VbTryLoadMiniOsKernel() to depthcharge. In addition, expose LoadKernel() and LoadMiniOsKernel() as vb2api_load_kernel() and vb2api_load_minos_kernel(), respectively. Since we remove VbTryLoadKernel() in vb2api_normal_boot(), rename vb2api_normal_boot() to check_kernel_version() and call it in vb2api_kernel_finalize(). Also, rename VbSelectAndLoadKernelParams, VbDiskInfo, and VbExDiskHandle_t as vb2_kernel_params, vb2_disk_info, and vb2ex_disk_handle_t, respectively. BUG=b:172339016 BRANCH=none TEST=make runtests TEST=FW_NAME=tomato emerge-cherry depthcharge Cq-Depend: chromium:3758201 Signed-off-by: Hsin-Te Yuan <yuanhsinte@google.com> Change-Id: Iaf182ca81797fee24c6104dac9d4770ff75c7fb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3755923 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility/file_type_bios: Rework image signingJakub Czapiga2022-06-302-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks whole BIOS image signing to support images with CBFS, and with ponly RW/A slot. CBFS images will now be truncated to eliminate unnecessary empty space, and will sign only the part of firmware area which contains the data, and not empty space. This patch also adds more checks for potential errors, and does not allow for signing incorrect nor uses data from structures, which might not be valid. futility sign command tests are also greatly extended to cover a wide variety of possible errors, which have to be handled correctly. BUG=b:197114807 TEST=sudo emerge vboot_reference TEST=build whole chromeos-bootimage after making it and coreboot use `futility sign --type bios ...` TEST=make runtests BRANCH=none Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Cq-Depend: chromium:3707104 Change-Id: I7c84aa38776e8890a87f0e9b7ec7f32d86f82c13 Disallow-Recycled-Builds: test-failures Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3575325 Tested-by: Jakub Czapiga <czapiga@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Auto-Submit: Jakub Czapiga <czapiga@google.com> Commit-Queue: Jakub Czapiga <czapiga@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>
* 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: 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: flashrom_drv: support partial write for multiple regionsHung-Te Lin2022-03-012-11/+16
| | | | | | | | | | | | | | | | | | | | | | | 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>
* futility: updater: improve updater console outputHung-Te Lin2022-02-251-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* 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-192-0/+196
| | | | | | | | | | | | | | | | | | | | 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-191-5/+1
| | | | | | | | | | | | | | | 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_reference: lib/flashrom convert args into structEdward O'Callaghan2022-02-143-48/+45
| | | | | | | | | | | | | | | | | | | | 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>
* crossystem: Add support for ADL-N gpiochipSubrata Banik2022-01-281-0/+1
| | | | | | | | | | | | | | | | | | On Alder Lake-N platform, the pinctrl (gpiochip) driver label is "INTC1057:00", hence declare it properly. BUG=b:213535859 TEST=run 'crossystem wpsw_cur' and see '0' rather than an error on ADLRVP platform. Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: Ie742a43cd37b37a35b16e68fe4be44f9bb08ec5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3404067 Reviewed-by: Subrata Banik <subratabanik@chromium.org> Tested-by: Subrata Banik <subratabanik@chromium.org> Auto-Submit: Subrata Banik <subratabanik@chromium.org> Reviewed-by: Kangheui Won <khwon@chromium.org> Commit-Queue: Kangheui Won <khwon@chromium.org>
* crossystem: Remove the stale TPM simulator supportYi Chou2022-01-101-14/+3
| | | | | | | | | | | | | | | | We don't need the MOUNT_ENCRYPTED_KEY_PATH after we replaced the stale TPM simulator with the driver-level TPM simulator. It's time to remove it. BUG=b:203195852, b:174807059 BRANCH=none TEST=crossystem clear_tpm_owner_request=1 Signed-off-by: Yi Chou <yich@google.com> Change-Id: I7c1c9c16697b1bbda9adea13448fdb9cffd9cc7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3358669 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Leo Lai <cylai@google.com>
* crossystem: Add flock to prevent race conditionsYi Chou2022-01-101-5/+69
| | | | | | | | | | | | | | | | The crossystem command would have potential race conditions when we calling this command in parallel. Add a flock should prevent this issue. BUG=b:172876417 BRANCH=none TEST=Firing multiple crossystem commands, and check result Signed-off-by: Yi Chou <yich@google.com> Change-Id: Ia9f8a73d5fd762c79088f350ea05d0dd540f3fc3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3358668 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Leo Lai <cylai@google.com>
* futility: add subcommand for creating and verifying the RO_GSCVD areaVadim Bendebury2021-10-181-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The help text of the new subcommand is as follows: ------- This utility creates an RO verification space in the Chrome OS AP firmware image or allows to validate a previously prepared image containing the RO verification space. Usage: futilitygscvd PARAMS <AP FIRMWARE FILE> [<root key hash>] Creation of RO Verification space: Required PARAMS: -R|--ranges STRING Comma separated colon delimited hex tuples <offset>:<size>, the areas of the RO covered by the signature -r|--root_pub_key <file> The main public key, in .vbpubk format, used to verify platform key -k|--keyblock <file> Signed platform public key in .keyblock format, used for run time RO verifcation -p|--platform_priv <file> Private platform key in .vbprivk format, used for signing RO verification data Optional PARAMS: [--outfile] OUTFILE Output firmware image containing RO verification information Validation of RO Verification space: The only required parameter is <AP FIRMWARE FILE>, if optional <root key hash> is given, it is compared to the hash of the body of the root key found in <AP_FIRMWARE_FILE>. -h|--help Print this message ------- When creating GVD section, the sha256 hash of the root public key payload is printed on stdout, this is the hash to include in the GSC image to for the root key verification. Code converting ASCII hex string into binary is refactored into a misc function. BRANCH=none BUG=b:141191727 TEST=testing included the following steps: . modified guybrush coreboot to allocate an 8KB RO_GSCVD area in FMAP and built a guybrush BIOS image . filled GVD space as described in the source file comments . verified the created space as described in the source file comments . verified AP RO integrity on the GSC size using crrev.com/c/3172256 Change-Id: I51a80be5007a32d5286b93499f71da84f41b3d81 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3174570 Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: add a hwid override mechanism from chromeos-configJack Rosenthal2021-08-311-1/+14
| | | | | | | | | | | | | | | | | | | | | | Devices which do not use chromeos firmware (e.g., reven) do not have a GBB section nor firmware to expose this data via ACPI/device-tree. However, a hwid is still required for auto-update, UMA, etc. CL:3118810 adds a new property to the schema for /:hwid-override. This CL makes it so when that property is set, ACPI/device-tree is not probed for the HWID, and it is instead set via cros_config. BUG=b:195007267 BRANCH=none TEST=build image for reven with a hwid override # crossystem hwid REVEN-ANAE A6A-A7I Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3c1255b257f914b02dfb8ba53dd275892df1a526 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3119046 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yong Hong <yhong@chromium.org>
* crossystem: arm: support active-high WP and RECOVERY GPIOsstabilize-14179.Bstabilize-14178.BBrian Norris2021-08-231-0/+8
| | | | | | | | | | | | | | | | | | Some systems have an active-high GPIO for reading WP status, so support an inverted name for that. While we're at it, do this for recovery too, just in case someone needs it. BRANCH=none BUG=b:197258688 TEST=play with servo's `fw_wp_state`, check `crossystem wpsw_cur` on kevin-kernelnext + DTS change Signed-off-by: Brian Norris <briannorris@chromium.org> Change-Id: I28ad566568d6dc62843d0bc9b75cca1fc1a35633 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3108068 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: Publicize and create functions for UI migrationedisonhello2021-07-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | Publicize vb2api_enable_developer_mode, vb2api_allow_recovery and VbTryLoadKernel, and modify corresponding parts in tests. Create vb2api_disable_dev_request, vb2api_request_diagnostics for wrapping vb2_nv_set(ctx, VB2_NV_DISABLE_DEV_REQUEST, 1) and vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1). BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Change-Id: I0211a63ed58ce862ee3e17b4835c675544f773a4 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3053541 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: add MINIOS_PRIORITY flag to nvstorageJoel Kitching2021-07-191-1/+9
| | | | | | | | | | | | | | | | Flag decides whether MINIOS-A or MINIOS-B is booted. BUG=b:186682292 TEST=make clean && make runtests TEST=Deploy and run `crossystem minios_priority` commands BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I11460bf1522cde8e98e680b0f00a417e2b4ef9a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2998513 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/vboot_kernel: move kernel/fw struct functionsJoel Kitching2021-06-153-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>