summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* vboot: Handle GBB_FLAG_DISABLE_LID_SHUTDOWNfirmware-samus-6300.BDuncan Laurie2015-01-062-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | Handle GBB_FLAG_DISABLE_LID_SHUTDOWN to disable lid-triggered system shutdown. BUG=chromium:434462 BRANCH=Auron TEST=Manual on Auron, with corresponding depthcharge change. Set GBB flag 0x1000 and disable powerd launch on boot. Close lid and issue 'reboot' command over ssh. Verify system reboots successfully into OS. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/234995 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 5d652cdffa70dc772e80548a760e1f0d67de273f) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Id2731508296a5ba9229f969f8224565d64f3d4a3 Reviewed-on: https://chromium-review.googlesource.com/238740 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org> Trybot-Ready: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@chromium.org>
* futility: workaround for broken toolchain in static buildsDuncan Laurie2015-01-062-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | The cros-compiler doesn't support backtrace(3) when linked statically. Until that's fixed, just don't use it. BUG=chromium:437107 BRANCH=ToT, samus TEST=manual FEATURES=test emerge-link vboot_reference /build/link/usr/bin/futility_s gbb_utility -c 100,100,100,100 test.bin /build/link/usr/bin/futility_s gbb_utility -s --hwid=HEY test.bin Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232234 Reviewed-by: Mike Frysinger <vapier@chromium.org> (cherry picked from commit 91852e7f58d50a031bcb5c02e68473cefb10ebb0) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I66b76fc8c0aa92f95976c5d5015f62730bb12064 Reviewed-on: https://chromium-review.googlesource.com/238529 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org> Trybot-Ready: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@chromium.org>
* Revert "Revert "Add hwid digest field to GBB header""Duncan Laurie2015-01-0612-14/+132
| | | | | | | | | | | | | | This reverts commit 87dbcbcebeb9331ec0d88568de8a7182b6dea524. Undo this revert. BUG=chrome-os-partner:34103 BRANCH=samus TEST=gbb_utility -s --hwid=test image.bin Change-Id: I8b02e38cddc0b0eba954a6183d61ae624dd2e4ef Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238528
* Revert "Revert "Extend HWID digest into PCR1 (GBB v1.2 only)""Duncan Laurie2015-01-0610-129/+414
| | | | | | | | | | | | | | This reverts commit f1a794b4fde720872ff066fa085dd62167378209. Undo this revert. BUG=chrome-os-partner:34103 BRANCH=samus TEST=gbb_utility -s --hwid=test image.bin Change-Id: I13e2a5c4ab8c3971c554a28aa73cbecfc7810927 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238527
* Revert "Add hwid digest field to GBB header"Duncan Laurie2014-11-2612-132/+14
| | | | | | | | | | | | | | This reverts commit 5f1f8b7835d291c5e6304240a4b21187cd4c4d17. Removing HWID digest commits as they seem to make gbb_utility segfault. BUG=chrome-os-partner:34103 BRANCH=samus TEST=gbb_utility -s --hwid=test image.bin Change-Id: I041d923dfdffb4941a7be0391e8d534a049de0de Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231992
* Revert "Extend HWID digest into PCR1 (GBB v1.2 only)"Duncan Laurie2014-11-2610-414/+129
| | | | | | | | | | | | | | This reverts commit 8bdba23af5598f316d5c5fb6f5e3dd88ac388abf. Removing HWID digest commits as they seem to make gbb_utility segfault. BUG=chrome-os-partner:34103 BRANCH=samus TEST=gbb_utility -s --hwid=test image.bin Change-Id: I1e676345fd9b19dadf3a74af611ea285da15064d Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231991
* vboot: Add flag to indicate VbInit is run before option rom loadingDuncan Laurie2014-11-222-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new VbInit() flag which will indicate that it is being called before option roms are loaded and can therefore respond to the VbNv flag without needing an immediate reboot. When the BIOS calls VbInit() in firmware it may not yet know if the system is in developer mode if there is a virtual developer mode switch, instead it relies on the VbNv flag that is prepared by VbInit(). So this new flag only affects VbInit() checks itself, the later checks still do the right thing because OPROM_LOADED can be set based on the VbNv value that is set by VbInit(). BUG=chrome-os-partner:32379 BRANCH=samus TEST=pass FAFT tests on samus Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230885 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 2596c657958477b06d1613902dfe4d47a2ad0ae0) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I7a12f3d318a04ff43ac1ddfc0ba8baa112253bad Reviewed-on: https://chromium-review.googlesource.com/231542 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot: Add GBB flag to disable shutdown when lid is closedDuncan Laurie2014-11-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | This adds a GBB flag which can be used in VbExShutdownRequested to ignore the state of the lid switch and enable factory to run with the lid closed. BUG=chromium:434462 BRANCH=samus TEST=none in this commit, just adding a new unused flag Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230884 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 57660567b43f5aeabab2c7911ffaec4612b0a3ab) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ife93adcc90b2c48e79d4e0c8164d2e64e6326ca7 Reviewed-on: https://chromium-review.googlesource.com/231541 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Extend HWID digest into PCR1 (GBB v1.2 only)Bill Richardson2014-11-2210-129/+414
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GBB header v1.2 adds a digest of the HWID string to the blob (and maintains it when updated with the current futility/gbb_utility). This CL causes VbSelectFirmware() to extend PCR1 with that HWID digest (only for GBB header v1.2 and later, of course). Tests are updated. This also adds a "pcr" command to futility to help determine that the change is working on the hardware (adds 4K bytes or fewer to the size of the executable). BUG=chromium:415714 BRANCH=ToT (and maybe others?) TEST=make runtests, manual install on HW To test on hardware, build and update a system with this change (both the disk image and the RO firmware). NOTE: The BIOS image must be built in a chroot that is using the current version of futility. You may need to update your chroot if your BIOS image still produces v1.1 GBB headers. Check with: futility show <firmware_image.bin> | grep -B1 'digest:' Boot the new system with a new test image, then follow these steps: Read the BIOS: # flashrom -r /tmp/bios.bin Make sure the GBB has a valid digest for the HWID. # futility show /tmp/bios.bin | grep -B1 'digest:' HWID: SAMUS TEST 8028 digest: 4172d24f40bf72cc0ab8... <valid> # Extract only the sha1sum-sized part of the HWID digest: # futility show /tmp/bios.bin | awk '/digest:/ {print $2}' | colrm 41 4172d24f40bf72cc0ab878b4c589b8fe9cf4405e # Simulate extending that value in a PCR using the futility "pcr" command: # futility pcr 4172d24f40bf72cc0ab878b4c589b8fe9cf4405e PCR: 0000000000000000000000000000000000000000 + 4172d24f40bf72cc0ab878b4c589b8fe9cf4405e PCR: b6e5ffd2d898a7b15236ad22ca25f53ac1f40776 # Finally, look at the value of PCR1. It should match the last line of the futility pcr output: # head /sys/class/misc/tpm0/device/pcrs | grep PCR-01 PCR-01: B6 E5 FF D2 D8 98 A7 B1 52 36 AD 22 CA 25 F5 3A C1 F4 07 76 # Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226408 Reviewed-by: Darren Krahn <dkrahn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit f4f395e1ca724ef8795cfe86a9edbf15f14eacd1) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I09cf855f1a24616cc1a9ddb676670edbc76827d2 Reviewed-on: https://chromium-review.googlesource.com/231540 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: add version commandBill Richardson2014-11-224-0/+49
| | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=manual make && ./build/futility/futility version Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226779 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit e1486c3234b7dc6fc5b58681b271a65a09141e20) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I362b13d3befba62a33bc9fd2e87ad68f4bc62a84 Reviewed-on: https://chromium-review.googlesource.com/231539 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Add hwid digest field to GBB headerBill Richardson2014-11-2212-14/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a field in the GBB header to store the sha256 digest of the HWID string, and updates gbb_utility so that it stores the digest when it modifies the HWID. Because this is a new field, the GBB_MINOR_VER is incremented. BUG=chromium:415227 BRANCH=ToT TEST=make runtests, VBOOT2=1 make runtests Since the GBB is in the RO firmware, there should be no side effects for existing devices (but even without that, they should handle a minor version change without complaint). Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221360 (cherry picked from commit 6df3e33912baf2633ed27fce6fe166d87e2f04a8) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Icdb2a0b564677b0b65e58df897d2ec5af3964998 Reviewed-on: https://chromium-review.googlesource.com/231538 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Revert "vboot: Don't abort for OPROM_MISMATCH if not using RO_NORMAL"Duncan Laurie2014-11-221-7/+1
| | | | | | | | | | | | This reverts commit 3ba226c5a8ec80b6445660911b27d3bb4094ea0b. BUG=chrome-os-partner:32379 BRANCH=samus TEST=build on samus Change-Id: If79284a3c3ee5ed567b2e7fef1240ab695f2dc28 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231537
* vboot: Don't abort for OPROM_MISMATCH if not using RO_NORMALDuncan Laurie2014-10-231-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the BIOS calls VbInit() in firmware it may not yet know if the system is in developer mode if there is a virtual developer mode switch, instead it relies on the VbNv that is prepared by VbInit(). This means that BIOS may not always pass in the correct value for OPROM_LOADED because the option rom loading has not actually happened yet. However since it has not happened yet the BIOS can still respond to the VbNv flag being set without needing to reboot, so VbInit() does not need to abort. This was causing FAFT tests to get confused. If using RO_NORMAL then we can assume an old style where VbInit() is called by the bootloader after Option ROM loading has already happened, so it does need to be told to reboot in this case. BUG=chrome-os-partner:32379 BRANCH=samus TEST=pass FAFT tests on samus Change-Id: Id3cdfb338a0c7a9901e0c579acce4fc9c7ba016b Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224631 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* crossystem: Add support for multiple gpiochip entriesDuncan Laurie2014-10-201-4/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current logic for finding a GPIO expects only one gpiochip entry to exist in /sys/class/gpio. With Samus there is a second entry because the codec also exports a set of GPIOs. To solve this we can use the gpiochip#/label file and compare against the GPIO controller name described in ACPI. This adds support for that detection method, as well as a new GPIO controller entry for INT3437:00 which is used in Broadwell systems. BUG=chrome-os-partner:33098 BRANCH=samus TEST=crossytem wpsw_cur works on samus (TOT with enabled codec) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224156 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 8bb3689d42089241b209ccea2860f03aeaddd8f8) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ib06f25c7c7e1451a3ab3bb00fd063e23b4d75878 Reviewed-on: https://chromium-review.googlesource.com/224407 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* crossystem: Change ReadFileInt to take an unsigned int pointerDuncan Laurie2014-10-204-92/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently ReadFileInt assumes that an integer value read from a file is never going to be "-1" and uses that value to indicate failure. In particular for GPIO values that may be returned by the kernel it is possible for them to be not simply 0 or 1 but instead a bit within the GPIO status register that indicates the value. The function semantics are changed to have the caller pass in the variable to store the integer in, and use the return code explicitly as a pass or fail condition. This requires all the callers of ReadFileInt to be changed to use the new scheme, and the x86 ReadGpio function is changed to normalize the GPIO value that is read from the kernel instead of assuming it is always 1 for active high values. BUG=chrome-os-partner:32645 BRANCH=samus,auron TEST=build for samus, check crossystem output and ensure that all values are properly reported and that wpsw_cur is correct now. Also tested to ensure no changes in output on: x86-alex, daisy, peach_pit, lumpy, stumpy, nyan_big, nyan_blaze, rush_ryu, panther, wolf, zako, auron, rambi, squawks, parrot_ivb, veyron_pinky Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223009 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit d241fff54c982f2764e6d126a024ab71fa6dd84a) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I824152eed5f96cf1faaa18ba31a01f4d346ad172 Reviewed-on: https://chromium-review.googlesource.com/224406 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot2: move vb2_safe_memcmp() from rsa to commonRandall Spangler2014-10-204-32/+45
| | | | | | | | | | | | | | | | | | | | | This will be needed by other algorithms, so should not live inside the rsa module. Also added explicit unit tests for it. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224111 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 6d03b527fe0107c3bb71d0bbaf6236fe980b0704) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I92c8c6484964a93d755ac2ee93b57511794540e9 Reviewed-on: https://chromium-review.googlesource.com/224405 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* cgpt: Validate GPT headers before loading themNam T. Nguyen2014-10-202-21/+60
| | | | | | | | | | | | | | | | | | | | | | | | This CL validates the GPT headers before continue loading its fields. BRANCH=none BUG=chromium:422469 TEST=unittest TEST=cpgt show on a random file. There should be some warnings. TEST=boot from SD/USB on a device. cgpt show that boot device. It should not fail. Reviewed-on: https://chromium-review.googlesource.com/223800 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org> (cherry picked from commit d92856ddfa4f58efbaf17427eda8da5dcdbdc8e2) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I1e5e986cc46620643ec8ec6914fa696a3d04d23a Reviewed-on: https://chromium-review.googlesource.com/224404 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot: Support SLOW_EC_UPDATE with OPROM_MATTERSDuncan Laurie2014-10-203-7/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to display the slow EC update screen on x86 devices in normal mode it is necessary to request a reboot where the VGA Option ROM is loaded. This needs a bit of plumbing to pass the OPROM_MATTERS and OPROM_LOADED flags into shared data so they can be consumed in the VbEcSoftwareSync() function. It also needs the VbInit() function to not immediately request a reboot if the VGA Option ROM was loaded in normal mode and the SLOW_EC flag is set as it will still need to be used during software sync. A FIXME in VbEcSoftwareSync() is implemented and the comment is removed, and two extra checks are done. First, if rebooting to RO then also check if the VGA Option ROM is needed to save an extra reboot, and second when exiting the software sync function request a reboot without the VGA Option ROM if it was done in normal mode and the option rom was needed+loaded. The request for a reboot from VbEcSoftwareSync() is saved when doing EC update in case there is an (optional) PD software sync that may also need to display the screen. BUG=chrome-os-partner:12257,chrome-os-partner:32379 BRANCH=samus TEST=all tests pass, manual testing: 1) in normal mode, with EC/PD in RW, ensure that they are rebooted to RO and the VGA Option ROM is loaded and the wait screen is displayed, and then the system is rebooted at the end and the VGA Option ROM is not loaded. 2) same as #1 with EC/PD in RO already, same result 3) same as #1 with system in developer mode, same result except there is no reboot at the end of software sync 4) same as #1 with system in developer mode and EC/PD in RO, ensure that there is no extra reboot at the beginning or end of software sync. Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223718 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 731f8e8a1df73a00f4840120171b07a259a6304a) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Id592181efd640f4cd37a986cd1dcc29f3ca45104 Reviewed-on: https://chromium-review.googlesource.com/224403 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* sign_official_build: Support new image layout (always installable kernel in B).Hung-Te Lin2014-10-201-178/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ChromiumOS images have recently changed the installable vblock from stateful partition to kernel + vblock in slot B. sign_official_build script should follow that layout so other scripts (ex, cros_generate_update_payload) won't find wrong blob. BRANCH=none BUG=chrome-os-partner:32156 TEST=for image_t in ssd usb install recovery; do ./sign_official_build.sh $image_t IMAGE KEYDIR output$image_t.bin ./sign_official_build.sh verify output$image_t.bin done # Also boots images without problem. Reviewed-on: https://chromium-review.googlesource.com/221890 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> (cherry picked from commit e54e656b9f1b8f8f1bbcad86569b4aaf9e8bd594) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I04e2b50f3f3355263ba6de9567b4a82c040c5826 Reviewed-on: https://chromium-review.googlesource.com/224402 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot2: move firmware hash tags to their own header fileRandall Spangler2014-10-202-17/+42
| | | | | | | | | | | | | | | | | | | | | | And add a few hash tag types we'll be supporting soon. No functional changes; just moving an enum from one header to another. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223532 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 435c74f1ec8a522e41c034cd5fd7a424356dbfb7) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I6f0fa54ee85fd857c4037856b81e2159e92f1ea9 Reviewed-on: https://chromium-review.googlesource.com/224401 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot2: Split crypto algorithms into their own header fileRandall Spangler2014-10-204-28/+46
| | | | | | | | | | | | | | | | | | | | | | | This allows the algorithm list to be shared by code which simply needs to look at the vboot structures. No functional changes; just moving enums around and adding comments. BUG=chromium:423882 BRANCH=none TEST=make runtests; VBOOT2=1 make runtests Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223541 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit f2f88042ed3a095819312c57d28e2d93e68d5c37) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ia8cefeffb28d5eceb290540195193ea13e68e2c1 Reviewed-on: https://chromium-review.googlesource.com/224400 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: Be more accepting of how it's invokedBill Richardson2014-10-202-86/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that futility is pretty much working as intended, we don't have to be quite so picky in the way it's being invoked. Up until now, it's only worked when invoked as "futility" or as one of the built-in commands, such as "dump_fmap". This change removes those restrictions. You can invoke futility under any name you wish. If it recognizes the name as a built-in command, great. Otherwise it will require a valid command as the first arg, just like it always has. BUG=none BRANCH=ToT, Samus TEST=make runtests In addtion to the new test included with this CL, I manually ran lddtree --copy-to-tree=blah --generate-wrappers /usr/bin/futility ./blah/usr/bin/futility dump_fmap -h tests/futility/data/bios_peppy_mp.bin Before this CL, the wrapper didn't work because the binary was being invoked as futility.elf, which was rejected. After this CL, the wrapper works fine. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223386 Reviewed-by: Hung-Te Lin <hungte@chromium.org> (cherry picked from commit 3638625d351ec0a0ba32d7cf8172dda179235db9) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Iafdaff6e07ed294a7d29e4cff599ace0a3089229 Reviewed-on: https://chromium-review.googlesource.com/224319 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Use VbExStream APIs to read the kernel partitionRandall Spangler2014-10-202-36/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is necessary to support reading the kernel from raw NAND flash, where the driver may need to skip over bad sectors, and absolute sector addressing is thus not practical. The impact is relatively minor. Vboot only did two reads per kernel anyway, one for the first 64KB of the partition and a second for the rest of the kernel data. Firmware which uses vboot will need to implement the streaming APIs. Or, as a really easy workaround, just copy the implementation from firmware/stub/vboot_api_stub_stream.c, which translates from the new streaming API to the old sector-based disk API. BUG=chromium:403432 BRANCH=none TEST=make runtests; passes. Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222410 Reviewed-by: Daniel Ehrenberg <dehrenberg@chromium.org> (cherry picked from commit 4184e626336fa8d794a21208387226f154d77d0f) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I7437b489650c95c09ac68b67d4d86f9e15c2fa73 Reviewed-on: https://chromium-review.googlesource.com/224318 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot: new streaming APIsDan Ehrenberg2014-10-203-1/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds three functions called from vboot into depthcharge to support NAND. NAND needs to stream rather than be accessed randomly in order to skip bad blocks. The intended flow from vboot1 is: - Read the GPT from a NAND disk handle, and depthcharge will silently fill it in with reads from from SPI - When a partition is selected, open a stream on the volume to access NAND - Sequentially read the NAND partition - Close the NAND stream This can be done multiple times when trying different partitions. The stream is associated with the GPT by reading/opening a stream from the same disk handle. This patch includes stub implementations by rspangler to translate the stream calls to block device calls. To reduce vboot code duplication, this flow will be done for all media types eventually, but a STREAMING flag is included to ease the transition. The draft depthcharge code can be found at https://chromium-review.googlesource.com/#/c/222312/ BUG=chromium:403432 TEST=stub implementations pass unit tests; together with upcoming depthcharge and vboot code, actually boots a kernel. This compiles by itself. BRANCH=none Reviewed-on: https://chromium-review.googlesource.com/221992 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daniel Ehrenberg <dehrenberg@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 5dc75d16b6d5cb0ebc677e6572a2559c6157b8e4) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I660a89594390c72c2ef6ea2564367ce62bd90cf2 Reviewed-on: https://chromium-review.googlesource.com/224317 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* crossystem: rename Vb*NvStorage_mkbp to Vb*NvStorage_mosysDavid Hendricks2014-10-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | This is just a cosmetic tweak to make it a bit clearer that mosys is the underlying interface for these particular vbnv read/write functions. BUG=none BRANCH=none TEST=it still compiles Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222062 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit aaa325727a19366f40c84d45bfdbfd2e4fa92de0) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ide172bfecf608a30489d25026268aedfc421ce4d Reviewed-on: https://chromium-review.googlesource.com/224316 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* crossystem: handle "flash" media in Vb*NvStorage()David Hendricks2014-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This handles VBNV data stored in SPI flash which happens to be the exact same way we handle VBNV data stored in the EC. BUG=chrome-os-partner:31529 BRANCH=none TEST=with CL:221349 applied, crossystem on storm no longer spews tons of errors Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222061 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 1137139a2e0ea24a5fb7df3b621d4c0ec59daf81) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I021d9f430acfac34dff44a927361a5a0e5ae2ff8 Reviewed-on: https://chromium-review.googlesource.com/224315 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* image_signing: ignore missing chrome_dev.confMike Frysinger2014-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | If we try to sign an image w/out Chrome, this file won't exist. Run grep with the -s flag to silence those warnings. BUG=chromium:418817 TEST=`cbuildbot storm-release` no longer warns BRANCH=None Reviewed-on: https://chromium-review.googlesource.com/221184 Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> (cherry picked from commit 2b802de836e90ae65f3ea4ef391b6df2fc28aba3) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ibac0978e3e4d9f89c00206a2dd21c1d71544f710 Reviewed-on: https://chromium-review.googlesource.com/222261 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot2: Add previously tried slot and result to NV storageRandall Spangler2014-10-099-4/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | This gives recovery mode information on two boots back instead of one, which may be handy for debugging. It also allows determining whether a failure of the current boot should try the other slot or go to recovery, using only information stored in NV storage. Added crossystem support for printing the fields, and unit tests. BUG=chrome-os-partner:32585 BRANCH=none TEST=make runtests; VBOOT2=1 make runtests Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221230 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 782300d093a2fbf2ca24e446fb6d65f9f28e56a6) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ia9f4186210d30217b902db7c513ae4ab8851f8f4 Reviewed-on: https://chromium-review.googlesource.com/222260 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Improve cross-reference targetsBill Richardson2014-10-091-20/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Any of these: make xrefs make tags make TAGS should create "build/cscope.files", containing a list of the source files used in preparing to run tests (minus any test sources). If the 'ctags' or 'etags' programs are installed in the chroot, they'll be run too. BUG=none BRANCH=ToT TEST=manual make xrefs cat build/cscope.files Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221425 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 80872dbffcb2e0079bfe095d770ccc6c8bd5fd7a) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: If1173af7edb41742bb348b728238d800ef66ad55 Reviewed-on: https://chromium-review.googlesource.com/222229 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot2: Fix saving the slot we tried back to nv storageRandall Spangler2014-10-092-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Previously, we only kept that slot info in RAM. We read it from NV storage, but never wrote it back. Added a test to confirm proper behavior (and made sure it failed before patching 2misc.c with the fix). BUG=chrome-os-partner:32583 BRANCH=none TEST=VBOOT2=1 make runtests Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221214 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit d300ca81318ed7825632e72b77b076cda73d4efa) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ie12124d9cbe417914fbde14ea5086380d637240f Reviewed-on: https://chromium-review.googlesource.com/222228 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Convert vbutil_what_keys to use /bin/shBill Richardson2014-10-031-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just involves deleting the "set -o pipefail" line. With bash, that meant that any program failure in a pipe would be fatal. Without it, only the last program matters. This usually means that the last command simply gets no input, in which case the program just appears to do nothing instead of complaining about whatever the problem was. Since vbutil_what_keys is generally only used to help debug a failure to boot, that's not a major problem. BUG=chromium:419773 BRANCH=ToT TEST=manual Tried on a Pit, it works: localhost ~ # /tmp/vbutil_what_keys /dev/mmcblk0 -e IMAGE: /dev/mmcblk0 part 2 kernel: d6170aa480136f1f29cf339a5ab1b960585fa444 (!DEV DEV !REC) developer keys part 4 kernel: d6170aa480136f1f29cf339a5ab1b960585fa444 (!DEV DEV !REC) developer keys localhost ~ # flashrom -r /tmp/bios.bin flashrom v0.9.4 : 904e8a5 : Sep 22 2014 20:47:40 UTC on Linux 3.8.11 (armv7l), built with libpci 3.1.10, GCC 4.8.x-google 20140307 (prerelease), little endian Reading flash... SUCCESS localhost ~ # /tmp/vbutil_what_keys /tmp/bios.bin -e BIOS: /tmp/bios.bin hwid: PIT D3A-D4Q-A3L root key: a026a7a4a0bf0fa32d6b7aa90a80d5ef01a3b799 Daisy MP-v3, Peach-Pi MP, Peach-Pit MP-v2, Snow MP recovery key: 6d9a2ca8b3080a97e1e5a4efbc5386ead77c3c7f Peach-Pit MP-v2 localhost ~ # Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221176 Reviewed-by: Mike Frysinger <vapier@chromium.org> (cherry picked from commit 1b1cf1caa0f6fd85003f95e3340394bd9d9814c7) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I171da3bf688032f469d7a5cdb42278d8028b7e0d Reviewed-on: https://chromium-review.googlesource.com/221503 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* Don't install vbutil_what_keys on the targetBill Richardson2014-10-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | BUG=chromium:419773 BRANCH=ToT TEST=manual make MINIMAL=1 DESTDIR=FOO install make MINIMAL= DESTDIR=BAR install find FOO BAR -name vbutil_what_keys It should only install the script into BAR/. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221177 Reviewed-by: Mike Frysinger <vapier@chromium.org> (cherry picked from commit 4d49d34c4ba5aa64ca7aeb26c77e170b2cf2462f) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I48d3a780533c5b72cc18720d39b18ac286b07fd9 Reviewed-on: https://chromium-review.googlesource.com/221502 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: rolled back vbutil_kernel changeBill Richardson2014-10-025-71/+1012
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When disabling verity with make_dev_ssh.sh, a bug in vbutil_kernel caused the re-signed kernel size to be the entire kernel partition instead of just the necessary bits. Until we can improve the test coverage, I'm rolling back the changes that introduced this bug. BUG=chromium:418647 BRANCH=All TEST=manual Created a new test image with these changes. You can install it and disable dm-verity and it works (although there seems to be an unrelated browser startup issue on ToT). Original-Change-Id: I48e8427b05e191c9894c42056429a79d57bfc78d Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220935 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit f1dba02034fba650c84cec52630755cd3c063e88) Change-Id: Iad030da6413138c28dc6ee2ccecc7255b3e30443 Reviewed-on: https://chromium-review.googlesource.com/221300 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Bill Richardson <wfrichar@chromium.org>
* vboot_kernel: Validate GPT header before usingDuncan Laurie2014-10-022-20/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In AllocAndReadGptData() the code was changed to use the GPT header to determine the LBA of the GPT entries. This change did not account for devices that have an invalid header and it can attempt to read from invalid block addresses on a device. This commit happened here: a2d72f7 vboot: cgpt: Refer to partition entries by entries_lba. https://chromium-review.googlesource.com/213861 The subsequent steps in vboot, LoadKernel->GptInit->GptRepair will fix a missing header and entries, so it is only necessary for one of the headers to be valid. This is commonly the case with a new USB stick that has an image written to it as only the primary header will be valid in this case. However it is also true if the primary header has been corrupted and the secondary header is still valid. The code has been changed to call CheckHeader() on the primary and secondary headers before attempting to use the 'entries_lba' field to read the entries from the device. AllocAndReadGptData() now only fails if both headers are invalid. A number of new unit tests are created to check for these failure conditions. In order to support this I had to extend the vboot_kernel test infrastructure to have a buffer for the mocked disk data instead of just ignoring reads and writes. This is because many of the existing tests assumed they could have an invalid GPT header and still pass. Now that the header is checked it is necessary for a valid header to be created before the tests can pass. BUG=chrome-os-partner:32386 BRANCH=samus,auron TEST=All unit tests pass when running 'make runtests' In addition real-world testing was done by corrupting the primary and/or secondary headers of USB stick to ensure that it will successfully boot if one of the headers is valid. Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220757 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Nam Nguyen <namnguyen@chromium.org> (cherry picked from commit 162f7885964b39419419f07a576fc390068678a9) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I7f840a44742fa3ba9a124df29ab5749e4c5a40c1 Reviewed-on: https://chromium-review.googlesource.com/221196 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: show vs verifyBill Richardson2014-10-026-23/+163
| | | | | | | | | | | | | | | | | | | | | | | This adds a --strict mode to the show command, which requires that all signatures be valid in order to exit cleanly. It also creates a "verify" command, which is really just an alias for "show --strict". BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219732 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 52a15f96ac009222ebf7d1299c7d17825e5a4ab5) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I1fed7db7fe7128191bcab0c615706ef4fe2709f5 Reviewed-on: https://chromium-review.googlesource.com/221195 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: Allow signing raw firmware blob and keyblocksBill Richardson2014-10-024-4/+328
| | | | | | | | | | | | | | | | | | BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219731 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit c540f59be047d69251b7f9ce0637a8a0c6fe150f) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ib1cf55301fd4c54e3280ef01b7d67a780e7e56fe Reviewed-on: https://chromium-review.googlesource.com/221194 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: Add support for [re]signing kernel partitionsBill Richardson2014-10-029-1141/+741
| | | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=ToT TEST=make runtests This also modifies the tests to compare the futility sign command results against the vbutil_kernel results. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219730 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 5f2696d2ff09d7c9c5c6125e9f0a62e56e54e0b8) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ibc659f134cc83982e3f0c0bcc108cc0eddbe228e Reviewed-on: https://chromium-review.googlesource.com/221193 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: do traversal of a buffer, not a fileBill Richardson2014-10-024-34/+93
| | | | | | | | | | | | | | | | | | | | | | | We have been traversing things by passing a file descriptor. Now the caller should mmap the file first. This will allow the caller to determine the file type before traversing into it, so we can check args. BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219649 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit b0f1cc5e22e87a3ef1655643116991673dd1b531) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: If69799bde0133689dc9fb5111e6ecb5ac61639c7 Reviewed-on: https://chromium-review.googlesource.com/221192 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: Prepare to handle kernel partitions & firmware blobsBill Richardson2014-10-024-52/+124
| | | | | | | | | | | | | | | | | | | | | | | This adds new file types to prepare for signing kernel partitions and raw firmware blobs (FW_MAIN_A/B). BUG=none BRANCH=ToT TEST=make runtests No new functionality yet. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219648 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 6f72ffa8037acb69de4fc4346783ea10298a7e57) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ic6b6b94bb99f00ab54609dfe1b753b53868abaca Reviewed-on: https://chromium-review.googlesource.com/221191 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: implement vbutil_kernel using buffers, not filesBill Richardson2014-10-029-596/+1958
| | | | | | | | | | | | | | | | | | | | | | | | | The original vbutil_kernel command used file read and write to make changes. Futility prefers to use memory-mapped files. This rewrites cmd_vbutil_kernel.c to use that scheme. BUG=none BRANCH=ToT TEST=make runtests The original cmd_vbutil_kernel.c is renamed, and a test written to ensure that the refactored version produces identical results. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219647 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit f318ee205cc8d92def925c6158272da8a63bf1ed) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: Ic6c3e12429a5dcb271f8136a9edac70807d66120 Reviewed-on: https://chromium-review.googlesource.com/221190 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: allow dump_fmap to specify where to extract areaBill Richardson2014-10-023-7/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, you could extract FMAP areas like so: futility dump_fmap -x bios.bin FW_MAIN_A VBLOCK_A ... This lets you decide what to name each area as it's extracted: futility dump_fmap -x bios.bin FW_MAIN_A:/tmp/rw_a ../vblock BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219646 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit d5aa5bdb292b64f259f55319fd83bd4a4d548a12) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: If02b57e03294b0b0b1dbc216ef57afdd3bdf2960 Reviewed-on: https://chromium-review.googlesource.com/221179 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* futility: clean up a few shared functionsBill Richardson2014-10-029-65/+61
| | | | | | | | | | | | | | | | | | | | | | Move the Debug() function into a common place instead of several copies in different files, rename shared functions to start with "futil_" BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219645 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit e192e7f6cea5f2c4556b729bf57ef1f552e0242a) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I6b844553dff95c24894dae611102716a8da5312d Reviewed-on: https://chromium-review.googlesource.com/221178 Tested-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* vboot2: Fix potential null pointer dereferenceRandall Spangler2014-09-241-1/+2
| | | | | | | | | | | | | | | If key is null in vb2_verify_digest(), we could attempt to dereference it. In practice it never is, but for safety's sake we should avoid the reference. BUG=chrome-os-partner:32235 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I5a817e432922ea4c3b439b696cd2f8d988d0fecc Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219574 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* futility: Improve help messagesstabilize-6297.BBill Richardson2014-09-2420-424/+480
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This provides help messages for the futility commands similar to the way git does. These show the available commands: futility futility help futility --help While these show help for a specific command: futility help COMMAND futility --help COMMAND futility COMMAND --help BUG=none BRANCH=ToT TEST=manual make runtests And manually look at help messages for each command. Change-Id: I1126471e242784c6ca7a2f11694fa7c505d833e8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219528 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Re-add dumpRSAPublicKey utilityDuncan Laurie2014-09-201-1/+1
| | | | | | | | | | | | | | This utility is used by firmware tests and having it missing is causing subtle FAFT test failures that are frustratingly difficult to track down. BUG=chrome-os-partner:38032 BRANCH=none TEST=successful run of firmware_UpdateKernelDataKeyVersion Change-Id: I4dcf277ce2678001f6e68d89781b6166042ea96e Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219079 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cleanup: DESTDIR refers to the install root, not the bin/Bill Richardson2014-09-173-8/+8
| | | | | | | | | | | | | | | | | | | | | | | This doesn't have any visible effect. It just brings the meaning of the where-do-I-put-this variable more in line with common convention. BRANCH=ToT BUG=none CQ-DEPEND=CL:217940 TEST=lots... make runtests make DESTDIR=BAR install make MINIMAL=1 DESTDIR=FOO install emerge-$BOARD vboot_reference sudo emerge vboot_reference trybots: link-tot-paladin, daisy_spring-paladin Change-Id: I8d72664da07535f663d8b2f13c872eece37978b9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217930 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* cleanup: remove a couple of unused functions and filesfactory-storm-6269.BBill Richardson2014-09-126-1002/+80
| | | | | | | | | | | | | | | | | | | | | | | | | scripts/sign_data.sh is just a wrapper to do this: ./signature_digest_utility $1 $3 \ | openssl rsautl -sign -pkcs -inkey $2 AFAICT, that script is only invoked by the SignatureFile() function in host/lib/file_keys.c, which is not referenced by anything. I think I can remove both of those things. Also remove utility/gbb_utility.cc, which should have been done long ago in commit 6f39615. BUG=none BRANCH=ToT TEST=make runalltests Also ran it on daisy_spring-paladin and link-tot-paladin. Change-Id: I16de5022765806f11bf6144d7ffd8cc849578a68 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/216719 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: stop using the symlink names in utility scriptsBill Richardson2014-09-1213-65/+76
| | | | | | | | | | | | | | | | | | | | | | We still create the symlinks (FOO -> futility), but this change invokes those built-in functions with "futility FOO ..." instead of using the FOO symlink. Note that the scripts/ directory is unchanged. That's a separate CL, since we don't have tests for that. BUG=chromium:231547 BRANCH=ToT TEST=make runtests In addition to running "make runtests", I temporarily modified the Makefile to avoid creating the symlinks at all. The tests still passed. Change-Id: I96863259b9df02a3611f759a7509bf4090ae03e8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/216717 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: make resign_firmwarefd.sh simply invoke futilityBill Richardson2014-09-124-213/+34
| | | | | | | | | | | | | | | | | | | | | Since all of the functionality of the resign_firmwarefd.sh script is built in to futility, let's just make that script invoke futility to do the work. We'll come back and remove the script entirely, once all outside references to it have been changed to do the right thing. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Also tested by editing tests/futility/test_resign_firmware.sh to invoke the resign_firmwarefd.sh script instead of futility. Everything passed. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Id068e551067a956cd7ddc3f9b9e23488261d8d94 Reviewed-on: https://chromium-review.googlesource.com/216716 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: slight tweak to the logging implementationBill Richardson2014-09-122-25/+61
| | | | | | | | | | | | | | | Just reporting that the parent process is "/bin/bash" doesn't help much. Let's also report the cmdline args given to the parent and the cwd. This will help us identify which shell script is calling futility with the wrong args. BUG=chromium:231547 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I800995ff269ab8d8c56cad8827d8de48a53cd150 Reviewed-on: https://chromium-review.googlesource.com/216715