summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* test: Add tests for futility show and vbutil_*stabilize-8481.Bstabilize-8447.Bstabilize-8429.BRandall Spangler2016-06-0720-0/+362
| | | | | | | | | | | | | | Currently, the unit tests verify a 0 exit code, but don't check the output. Add tests to check the output. BUG=chromium:617247 BRANCH=none TEST=make runtests Change-Id: I842046bb6f788eee05a1f2f511c6fb08df4a5379 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/349670 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
* vboot_api_kernel: Remove assumptions about EC-RW hash type and sizeJulius Werner2016-05-312-188/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | With newer PD chips and different update mechanisms, we can no longer guarantee that the "hash" (really just a sort of version identifier) of an EC-RW image will always be a SHA256. This patch removes any hardcoded assumptions about that from vboot, and instead accepts any hash size returned by VbExEcHashImage() and VbExEcGetExpectedImageHash(). It also removes the assumption that the hash can be regenerated by running SHA256 over the full image returned by VbExEcGetExpectedImage(). We can thus no longer support VBERROR_EC_GET_EXPECTED_HASH_FROM_IMAGE, which is fine since that functionality hasn't been needed for years and there would be no reason why we might need it in the future. This also allows simplifying the code flow of EcUpdateImage() a bit (since you can really just return very early if you already figured out that you don't need to update). BRANCH=None BUG=chrome-os-partner:53780 TEST=Tested software sync on Oak both after cold and warm boot. Change-Id: I498f3d39085a38740734fff9f2d1a186a0801489 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/348001 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vb2_sha: Add sha256 extendDaisuke Nojiri2016-05-203-4/+40
| | | | | | | | | | | | | | | This patch adds vb2_sha256_extend, which extends a hash using a given block. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I512674f18dffc55692907c85b19ff19df88a5eeb Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/346234 Commit-Ready: Daisuke Nojiri <dnojiri@google.com> Tested-by: Daisuke Nojiri <dnojiri@google.com> Reviewed-by: Randall Spangler <rspangler@google.com>
* bdb: Add NVM libraryDaisuke Nojiri2016-05-208-16/+762
| | | | | | | | | | | | | | This patch adds NVM library, which verifies, updates, and syncs NVM-RW of vboot SoC. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I5adc399f9e582bd9ea7d9ee73482ed9a924837e0 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/343121 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
* test: Print out actual result when test_succ failsstabilize-8350.68.Bstabilize-8350.21.Brelease-R52-8350.BDaisuke Nojiri2016-05-181-1/+1
| | | | | | | | | | | BUG=none BRANCH=tot TEST=make runtests Change-Id: I419b01d2dd0798bd0a3fe155e41d6aa3d328716a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/345586 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* test: Make TEST_* report test locationstabilize-8337.BDaisuke Nojiri2016-05-104-66/+158
| | | | | | | | | | | | | | | | | | | This patch converts TEST_* functions to macros, which print file name and line # of the check. This will allow us to locate a failed test quickly. New TEST_* macros also automatically generate a test name if testname == NULL. This will save us time to think of a name for every single check we write in a test. BUG=none BRANCH=tot TEST=make runtests Change-Id: Ibdeb99681985c3f348836d256fa3484f2f0c315f Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/343233 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* hmac: Add HMAC to 2lib libraryDaisuke Nojiri2016-05-108-2/+290
| | | | | | | | | | | | | | | This patch adds HMAC. HMAC will be used to sign/verify NVM structures. Hash algorithms can be selected from those supported by enum vb2_hash_algorithm (i.e. SHA1, SHA256, or SHA512). BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I6d349bc807874fe2a5512aabcd7fbf67a4eaa40a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342880 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: Fix FWMP link error if TPM is mockedRandall Spangler2016-05-112-2/+13
| | | | | | | | | | | | | | | | The MOCK_TPM build flag caused link to fail because RollbackFwmpRead() was missing its mock. BUG=chromium:601492 BRANCH=baytrail and newer platforms TEST=make -j runtests Hack makefile to add MOCK_TPM := 1 and make -j; no link errors. Change-Id: I3885d6b6c627bf475f4da33ef67f31aec2159799 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/343920 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* vboot: Add firmware management parametersRandall Spangler2016-05-0812-5/+442
| | | | | | | | | | | | | | | | This adds RW firmware support for the optional firmware management parameters TPM space. System-level tests require CL:339262 to add cryptohome support. BUG=chromium:601492 BRANCH=baytrail and newer platforms TEST=make -j runtests Or better, COV=1 make, and then make sure all new code is covered. Change-Id: Ifaf644c80809552d5961615be6017c2a332a034b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/339234
* test: Add TEST_STR_NEQDaisuke Nojiri2016-05-082-0/+25
| | | | | | | | | | | | | | TEST_STR_NES can be used to check the returned string is not what it shouldn't be. BUG=none BRANCH=tot TEST=make runtests Change-Id: I09d5a63334e9b8365a44bb96ed31db8155d95e21 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/343120 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add vba_bdb_initDaisuke Nojiri2016-05-076-2/+500
| | | | | | | | | | | | | | | | | | | vba_bdb_init initializes the vboot context and decides what to do next based on the vboot register content. Possible actions are: 1. proceed to verify the current slot 2. reset to try the other slot 3. reset to recovery mode bdb_sprw_test demonstrates these actions. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: If72cdd575d09b9162a871f088064ca853b7fd74d Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342604 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add vboot_register.hDaisuke Nojiri2016-05-071-0/+22
| | | | | | | | | | | | | | vboot_register.h lists definitions for vboot registers. Vboot registers are used to transfer information between modules (coreboot & depthcharge) or boots. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: Ie0876fefb43d3e79a8f96e8f25f99f798892a056 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342603
* bdb: Rename subkey to datakeystabilize-8282.Bfirmware-gale-8281.BDaisuke Nojiri2016-05-049-44/+44
| | | | | | | | | | | | | | This patch replaces subkey with datakey to make name use consistent with the design document. BUG=chrome-os-partner:51908 BRANCH=tot TEST=make runtests Change-Id: I3690abd51e6c18c5a1094a8449f375d803c7e0b2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342199 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Replace sha functions with vb2 libraryDaisuke Nojiri2016-05-045-221/+20
| | | | | | | | | | | | | | BDB has its own implementation of SHA256. This patch replaces it with the one implemented in vb2 library. BUG=chrome-os-partner:51908 BRANCH=tot TEST=build runtests Change-Id: Ida19dd49153a038fc2b2ce481cedf828818aaeaa Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342121 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Integrate bdb_testDaisuke Nojiri2016-05-042-108/+150
| | | | | | | | | | | | | This patch integrate bdb_test with the root Makefile. BUG=chrome-os-partner:51908 BRANCH=tot TEST=make runtests Change-Id: I6266199d8f3068d2e9349110e8351f20d027ab35 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342091 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Copy files from bdb to firmware/bdbDaisuke Nojiri2016-05-0418-0/+2829
| | | | | | | | | | | | | Test files are copied to tests/ and the rest are copied to firmware/bdb/. BUG=chrome-os-partner:51908 BRANCH=tot TEST=make runtests Change-Id: I19f66c398e69037f00812a789854340a9690fef5 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342090 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Revert "image_signing: use sparse partition extraction [reland]"Amey Deshpande2016-04-271-1/+1
| | | | | | | | | | | | | | | | | This reverts commit f482470b72086d5ba672513434f3da5d62599538. The original change is the suspected root cause of chromium:606738. TEST=signing_unittests.py in cros-signing passes (with updated vboot_stable_hash). BUG=chromium:606738 BRANCH=None Change-Id: I21ea027bbda123ee26c6deb4437b07d2fc6e8575 Reviewed-on: https://chromium-review.googlesource.com/340895 Commit-Ready: Amey Deshpande <ameyd@google.com> Tested-by: Amey Deshpande <ameyd@google.com> Reviewed-by: Amey Deshpande <ameyd@google.com>
* cgpt: Add cgpt legacy parameter to set primary GPT signature to IGNOREMEstabilize-8249.BJulius Werner2016-04-254-156/+218
| | | | | | | | | | | | | | | | | Now that we have support for the IGNOREME signature in cgpt, we need a way to set it on an existing disk. The easiest option is to shoehorn this into the cgpt legacy command, because that's already made to modify GPT header signatures (really, it would be nice to rename it to cgpt signature or something, but let's not break existing uses for now). BRANCH=None BUG=chrome-os-partner:52595 TEST=unit tests Change-Id: If2835fec28a9c39373abd050e2e057f73e5ec700 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/340073 Reviewed-by: Nam Nguyen <namnguyen@google.com>
* cgptlib: Add support for IGNOREME GPT signatureJulius Werner2016-04-257-124/+249
| | | | | | | | | | | | | | | | | | This patch makes cgpt aware of a special "IGNOREME" GPT header signature string that may appear in either the primary or the secondary GPT and cause cgpt (and other cgptlib clients) to completely ignore that GPT. It will continue to function correctly for all other purposes (using the data from the non-ignored GPT), but never write any data back to the ignored GPT. BRANCH=None BUG=chrome-os-partner:52595 TEST=unit tests Change-Id: I7e53542385ae9d8d24dc25b75e91f4ff4917f66f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/340072 Reviewed-by: Nam Nguyen <namnguyen@google.com>
* cgpt: Fully write out primary GPT before starting to write secondaryJulius Werner2016-04-251-16/+26
| | | | | | | | | | | | | | | | | | | | | | The point of having two GPTs is to always have a known good one if one of them gets corrupted. One of the most obvious ways that could happen is if the write stopped half-way through (e.g. due to a crash or random power loss). Unfortunately, the way we currently save modified GPTs can leave both copies invalid if we stop writing at just the wrong time. Since a GPT header contains a checksum over the GPT entries, we need to write both the header and entries for one GPT (and make sure they're synced to disk) before we start writing the other. BRANCH=None BUG=chrome-os-partner:52595 TEST=None Change-Id: I2d4b56bcfba9a94395af5896f274ebade9e39081 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/340071 Reviewed-by: Nam Nguyen <namnguyen@google.com>
* vboot: Save last screen IDDaisuke Nojiri2016-04-251-14/+13
| | | | | | | | | | | | | | | | | | | This patch makes VbDisplayScreen remember the last successfully displayed screen and skip rendering if the same screen is requested. When locale is changed, VbCheckDisplayKey calls VbDisplayScreen with force=1, which makes VbDisplayScreen render the requested screen regardless of the saved screen ID. BUG=chromium:602793 BRANCH=tot TEST=emerge-veyron_jerry vboot_reference chromeos-bootimage Change-Id: I31c4dde4ff060081f14224a93d57e9b76fcac1db Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/340264 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* sign_official_build: retain /boot for EFI devicesAmey Deshpande2016-04-221-4/+6
| | | | | | | | | | | | | | TEST=Ran sign_official_build locally on image w/ cros_efi and checked the signed image had /boot in rootfs. BUG=chromium:604967 BRANCH=None Change-Id: Id6e1a6409e07fa37a5c116c66ac937dd9aec1481 Reviewed-on: https://chromium-review.googlesource.com/335469 Commit-Ready: Amey Deshpande <ameyd@google.com> Tested-by: Amey Deshpande <ameyd@google.com> Reviewed-by: Don Garrett <dgarrett@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* include sys/sysmacros.h for major()Mike Frysinger2016-04-202-0/+2
| | | | | | | | | | | | | | | | The major() func is defined in the sys/sysmacros.h header, so include it explicitly for the prototype. Upstream C libs are moving away from having sys/types.h include it all the time implicitly. BUG=None TEST=precq passes BRANCH=None Change-Id: I56b84138f08ded2376193403f9c9db22c5f24f71 Reviewed-on: https://chromium-review.googlesource.com/339680 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Bill Richardson <wfrichar@google.com>
* Support doing battery cut-off in firmware stage.Hung-Te Lin2016-04-1210-2/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new crossystem value "battery_cutoff_request" to indicate that next reboot should cut-off battery and shutdown during firmware stage. This request is primarily for factories to ship devices in an safe state. Previously we have done same thing by running "ectool battery-cutoff" but that creates a problem which "ectool" (and the one to request for cut-off) must live in developer mode while the device must be shipped in normal mode. The mode transition was solved by setting "disable_dev_request=1", but that flag is may get lost on x86 systems (having NV storage in CMOS) when the battery is cut-off . From the experience from Ryu, such settings (dev mode transition and battery cut-off) should be done together inside firmware execution so we can create a new flag, battery_cutoff_request, to finalize device properly. BRANCH=none BUG=chromium:601705 TEST=emerge-chell depthcharge vboot_reference chromeos-bootimage crossystem battery_cutoff_request=1 # Unplug AC adapter reboot # See device rebooted and then shutdown immediately. # Press power button and system won't boot. # Attach AC adapter and now system boots. CQ-DEPEND=CL:337596,CL:338193 Change-Id: I73ccae15b337cd65786106646546c67c155b8fa6 Reviewed-on: https://chromium-review.googlesource.com/337602 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* crossystem: x86: Write VbNv with mosys if using vboot2Duncan Laurie2016-04-111-0/+6
| | | | | | | | | | | | | | | | If this is an x86 system using vboot2 then write VbNv data to CMOS and also use mosys to write it directly to flash. BUG=chrome-os-partner:51846 BRANCH=none TEST=emerge-chell vboot_reference; emerge-oak vboot_reference verify on chell that "crossystem dev_disable_request=1" is written to both CMOS and flash. Change-Id: Ifd5dcee4d401f8de36801c5c0a7db3255e618e28 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/336311 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* crossystem: Move mosys based VbNv functions to shared codeDuncan Laurie2016-04-113-111/+158
| | | | | | | | | | | | | | | | | The code to read/write vbnv with mosys was implemented in the ARM specific code so move it to the generic crosystem code so it can be used on x86. No functional changes in this commit. BUG=chrome-os-partner:51846 BRANCH=none TEST=emerge-chell vboot_reference; emerge-oak vboot_reference Change-Id: I3fe18fadb924094e710427208976328caf12a009 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/336310 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* cgpt: Update behavior of GptUpdateKernelWithEntrystabilize-8172.47.Bfirmware-lucid-8173.BFurquan Shaikh2016-04-052-11/+11
| | | | | | | | | | | | | | | | | | | | In order to support slots, we need to update behavior of GptUpdateKernelWithEntry so that: 1. Invalid - Marks kernel entry as invalid 2. Active - Marks kernel entry as active CQ-DEPEND=CL:336906 BUG=chrome-os-partner:51807 BRANCH=None TEST=Compiles successfully "sudo emerge vboot_reference" "emerge-smaug vboot_reference". "make -j runtests" successful. Change-Id: If248b3c6bdd23d03cb1dd24f4e21cacef5cc3f26 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/335942 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* image_signing: use sparse partition extraction [reland]Mike Frysinger2016-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | Often the partitions we extract have extra space in them, but the dd utility will still write out the excess zeros. That can mean we write out hundreds of megs of data which could otherwise be skipped. We thus waste a good amount of I/O and storage. For now, only use this flag when extracting a partition to a new file as this should be safe (there's no pre-existing data to clobber/merge). Now that the signers have been upgraded to Trusty, we can land this. BUG=chromium:530730 TEST=`./signing_unittests.py` passes BRANCH=None Change-Id: I275973ebfc028c15a8d1ef33dd9b3dcf6ca726a2 Reviewed-on: https://chromium-review.googlesource.com/306420 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Amey Deshpande <ameyd@google.com>
* signer: improve error handling in update_legacy_bootloader()stabilize-8104.Bfactory-oak-8141.BAmey Deshpande2016-03-081-1/+5
| | | | | | | | | | | | | | | | BRANCH=None BUG=chromium:590933 TEST=Ran sign_official_build.sh locally and booted the image on kvm (using BIOS). $ ./sign_official_build.sh base chromiumos_base_image.bin \ ../../tests/devkeys chromiumos_base_image_signed.bin Change-Id: I2e1aad6e2073dea8e92d6ee25ac6972a5d555d71 Reviewed-on: https://chromium-review.googlesource.com/331661 Commit-Ready: Amey Deshpande <ameyd@google.com> Tested-by: Amey Deshpande <ameyd@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vb2: Modify phase2 behavior for S3 resume casestabilize-7978.Bstabilize-7978.74.Bstabilize-7978.66.Bstabilize-7978.51.Bstabilize-7978.18.Bstabilize-7956.Brelease-R50-7978.BDuncan Laurie2016-02-232-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a platform does verification of memory init then it must be careful to use the same slot for resume that it booted from. This is accomplished by adding a context flag to indicate this is an S3 resume and that vboot should treat it differently than a normal boot. When this flag is set then the same slot that was booted is read from VBNV and re-used for the resume path, without adjusting any try flags. If this slot is B then the related context flag is set. This will allow the firmware updater to update the other (non-booted) slot and set flags indicating that on the next boot the updated slot should be tried, while still allowing suspend/resume to work with the existing firmware slot. This assumes that the last tried slot was successfully booted, which should be a safe assumption since the system was able to boot and then suspend. It isn't reliable to check last_fw_result for "success" status because that status is only set some time after boot when chromeos-setgoodkernel calls chromeos-firmwareupdate --mode=bootok and so it may still report a status of "trying" on resume depending on how soon after boot the suspend happened. It also avoids setting the vboot flag indicating that a slot choice was made in order to avoid altering the try counter on failure since this is explicitly not attempting to boot the new slot. BUG=chromium:577269 BRANCH=glados TEST=manually tested on chell: 1) ensure that booting from slot A resumes from slot A. 2) ensure that booting from slot B resumes from slot B. 3) do RW update while booted from slot A (so the flags are set to try slot B) and ensure that suspend/resume still functions properly using current slot A. 4) do RW update while booted from slot B (so the flags are set to try slot A) and ensure that suspend/resume still functions properly using current slot B. Change-Id: I500faef2b5d19a02f32839976354abf6d551c9f6 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/328812 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* sign_nv_cbootimage: Update signing scripts for nv bootloader and lp0stabilize-smaug-7897.Bstabilize-7912.Bstabilize-7907.BFurquan Shaikh2016-02-031-29/+210
| | | | | | | | | | | | | | | | | | | | | | | | Currently, nvidia tools do not provide the support to perform signing of bootloader or lp0 image. Thus, the signing script is updated to support this. Once, we have the required tools, this script can be simplified again. CQ-DEPEND=CL:*244234 BUG=chrome-os-partner:43018 BRANCH=none TEST=Verified that signed bootloader and lp0 work fine on dev-PKC fused devices. Reference: https://code.google.com/p/chrome-os-partner/issues/attachmentText?id=43018&aid=430180067000&name=sign-lp0.sh&token=ABZ6GAcjz4b2mEk55WqREzwTnWWpEyE_7A%3A1452631308268 https://code.google.com/p/chrome-os-partner/issues/attachmentText?id=43018&aid=430180060000&name=sign.sh&token=ABZ6GAcRky67XrzMOgKZfkJxr70qm-tTAg%3A1452631308240 Change-Id: Icb024a1d9a61714df6e52d94c96cf43481cac869 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/321459 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot_display: Keep track of displayed screenDuncan Laurie2016-01-291-2/+8
| | | | | | | | | | | | | | | | Vboot needs to track the currently displayed screen so when it needs to change the locale or display the debug overlay it knows which screen to redraw. Currently only the legacy path is doing this so change the new path to update the current screen if it is successfully drawn. BUG=chrome-os-partner:49766 BRANCH=glados TEST=boot on glados in dev mode, hit tab and ensure screen does not go black Change-Id: I4a2bf028275db57b2d0469fc1cb574e871820713 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/324549 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* vb20: add vb2api_check_hash_get_digest() for retrieving hash resultAaron Durbin2016-01-264-1/+61
| | | | | | | | | | | | | | | | | | | | | | For x86 systems, which resume through the boot reset vector, to implement vboot verification of the memory init code one needs check that the slot chosen on the resume path is the same as the original boot path. That check is done by storing the resulting hash of the slot. However, vb2api doesn't export the resulting hash from vb2api_check_hash(). Thus, provide a variant which saves the resulting digest in the supplied buffer. BUG=chrome-os-partner:46049 BRANCH=glados TEST=Suspended and resumed on chell. Also, tested with an EC build which returns a bad hash to ensure that is properly caught. Change-Id: Ic20be2024afedabc2d8bc767f1b794376348523c Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/323460 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Pipe the custom_music use flag to the defineAlexandru M Stan2016-01-261-0/+4
| | | | | | | | | | | | | | | | | This will allow the definition of CUSTOM_MUSIC from the individual board ebuilds. TEST=Define use flag and extra functions on a board, enjoy the custom tunes BUG=chrome-os-partner:48657 BRANCH=master Change-Id: I974f9cc51f9b25fb3dff063926e6ea01cf1e031b Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/323833 Commit-Ready: Alexandru Stan <amstan@chromium.org> Tested-by: Alexandru Stan <amstan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Increase MAX_CUSTOM_DELAY to 5 minutesAlexandru M Stan2016-01-261-6/+6
| | | | | | | | | | | | | | | | Rialto will soon need a longer dev mode delay, this variable would prevent it. BUG=chrome-os-partner:48657 TEST=See follow up CLs BRANCH=master Change-Id: Ie5ada9c5441b5b042bd0801d66559ab715fbbf47 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/323832 Commit-Ready: Alexandru Stan <amstan@chromium.org> Tested-by: Alexandru Stan <amstan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: Disable VBNV_OPROM_NEEDED after successful updateDuncan Laurie2016-01-201-0/+1
| | | | | | | | | | | | | | | | | | | | The VBOOT_OPROM_NEEDED flag is used for EC software sync when the VBSD_EC_SLOW_UPDATE flag is set. After a successful EC software sync vboot requests a reboot to disable graphics but it is not clearing the VBNV flag first. With vboot1 this was getting cleared as a side effect of calling VbInit in normal mode. BUG=chrome-os-partner:49560 BRANCH=glados TEST=Enable EC_SLOW_UPDATE on chell and test EC software sync in normal mode and ensure that it reboots and does not do graphics init if the update is successful. Change-Id: I2aa0c4c3b1ad357a5b8ddc14539e264a1f5b76b2 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/322731 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Modify EC software sync to update RO if necessarystabilize-7834.66.Bstabilize-7821.Brelease-R49-7834.BMary Ruthven2016-01-103-188/+361
| | | | | | | | | | | | | | | | | | | | | | Allow the AP to sync and verify the EC read only image after updating the rewritable image. BUG=chrome-os-partner:48703 BRANCH=none TEST=manual 1. Update EC to a new version 2. rebuild EC code 3. Update AP firmware 4. Reboot and check that the RO image is updated after the RW image is updated. CQ-DEPEND=CL:319213 Change-Id: I774ef25320103f20d8c7d1c180a220dd0819c04d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/320614 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Update a utility to support the new tpm sysfs class directoryBryan Freed2016-01-071-1/+5
| | | | | | | | | | | | | | | Kernel TPM patches from 4.x moved /sys/class/misc/tpm0 to /sys/class/tpm/tpm0. Support both paths in this utility. BUG=chromium:573368 BRANCH=none TEST=untested, not sure if this utility is still used. Change-Id: Ib81476eee4c9de921502a3a47f6990b9e6b1968b Reviewed-on: https://chromium-review.googlesource.com/320892 Commit-Ready: Bryan Freed <bfreed@chromium.org> Tested-by: Bryan Freed <bfreed@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Port to musl: musl doesn't have execinfo.h.Doug Evans2016-01-072-0/+20
| | | | | | | | Change-Id: Idc2f18880581d3a2e67185becee8b77cfa5cdf04 Reviewed-on: https://chromium-review.googlesource.com/313388 Commit-Ready: Doug Evans <dje@google.com> Tested-by: Doug Evans <dje@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: Change VbExEc implementations to support RO updateMary Ruthven2016-01-064-44/+50
| | | | | | | | | | | | | | | | | This change will be used to support EC-RO software sync by allowing for access to the readonly region of firmware. Currently only the writable section is accessed by vboot using VB_SELECT_FIRMWARE_A and B. BUG=chrome-os-partner:48703 BRANCH=none TEST=built on jerry and check that the RO hash can be read and the image can be updated. CQ-DEPEND=CL:319185,CL:320425,CL:320598 Change-Id: Ic3942d86b65da3123798cfd11a78056f5dab6699 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/319213 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Include <fcntl.h> instead of <sys/fcntl.h>.Doug Evans2016-01-061-1/+1
| | | | | | | | | | | | Musl complains about using sys/fcntl.h, and with -Werror that gives a compilation failure. Every other file includes <fcntl.h> so just use that. Change-Id: Ibc743bbe335e9e9b91da7e4eacc01cc80cd8b35a Reviewed-on: https://chromium-review.googlesource.com/313419 Commit-Ready: Doug Evans <dje@google.com> Tested-by: Doug Evans <dje@google.com> Reviewed-by: Nam Nguyen <namnguyen@chromium.org>
* Use ${WERROR} consistently.Doug Evans2016-01-061-1/+1
| | | | | | | | Change-Id: I37b414b030cc69fab2b4feec70b55297dcd5fdb7 Reviewed-on: https://chromium-review.googlesource.com/313198 Commit-Ready: Doug Evans <dje@google.com> Tested-by: Doug Evans <dje@google.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot2: Add try RO software sync flagMary Ruthven2016-01-069-1/+32
| | | | | | | | | | | | | | This flag will be used by the firmware updater to indicate that RO software sync should be attempted. BUG=chrome-os-partner:48703 BRANCH=None TEST=make runtests Change-Id: I42090ac47da45c724e66334648ab447ad3c21178 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/320621 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Move default target up so it's really the default.stabilize-smaug-7800.Bstabilize-7797.BDoug Evans2015-12-161-7/+10
| | | | | | | | | | | | The line ${FUTIL_BIN}: ${UTILLIB21} was changing the default. Change-Id: I7988af498c9a9a1981cf2485e4f9d3496412f133 Reviewed-on: https://chromium-review.googlesource.com/313245 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Test sha-256 with multiple odd-length updatesRandall Spangler2015-12-161-0/+17
| | | | | | | | | | | | | | | | | This verifies that the VB2 sha-256 library can handle odd-length updates. The expected digest was generated from: echo -n 'test1test2test3' | sha256sum BUG=None BRANCH=None TEST=make runtests Change-Id: Ia7d57322a1a4b10e718c47f1dae38ed244cf8ebc Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/318363 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Add BDB libraryRandall Spangler2015-12-1624-0/+3195
| | | | | | | | | | | | | | | | This is a standalone library for verifying the BDB structures in the common boot flow document, and a bdb_create utility to create test BDB structures. Eventually, creating these structures will be rolled into futility. BUG=chrome-os-partner:48448 BRANCH=none TEST=cd bdb && make runtests Change-Id: Ic57c26ca84137205da3b6c7d532f5324c93b4285 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/317275 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* add error code for screen drawing failurestabilize-smaug-7731.Bstabilize-7729.BDaisuke Nojiri2015-12-031-0/+2
| | | | | | | | | | | | | This patch adds error code for screen drawing failure. BUG=none BRANCH=tot TEST=Tested on Glados Change-Id: I04b349fd2c0bc539338b7ee27b8fa9544c85c873 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/315257 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Fix error message for VbGbbReadBmpHeaderDaisuke Nojiri2015-12-031-1/+1
| | | | | | | | | | | BUG=none BRANCH=tot TEST=Tested on Jerry Change-Id: I1ecfd28b4c694e4aa531ed0e77219b2160509bd0 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/313744 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* sign_official_build: add a fallback key for standalone accessoriesfactory-glados-7657.BVincent Palatin2015-11-171-0/+6
| | | | | | | | | | | | | | | | | | | The standalone accessories are using a key name like this: key_<product>.pem or key_<product>.vbprik2 when it doesn't exist, fallback using key.pem or key.vbprik2. BRANCH=none BUG=chrome-os-partner:47557 TEST=manual: ./scripts/image_signing/sign_official_build.sh accessory_usbpd ../ec/build/zinger/ec.bin tests/devkeys-acc /tmp/ec-zinger.TEST.SIGNED.bin ./scripts/image_signing/sign_official_build.sh accessory_rwsig ../ec/private/build/hadoken/keyboard_app.bin tests/devkeys-acc /tmp/ec-hadoken.TEST.SIGNED.bin ./scripts/image_signing/sign_official_build.sh accessory_rwsig ../ec/private/build/hadoken/keyboard_app.bin /tmp /tmp/ec-hadoken.TEST.SIGNED.bin Change-Id: I68863664bdb9da1695e91b1986f3a0148af7da26 Reviewed-on: https://chromium-review.googlesource.com/312836 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Give more screen control to vboot_draw_screenDaisuke Nojiri2015-11-171-6/+23
| | | | | | | | | | | | | | | | New devices have Depthcharge render vboot screens by calling vboot_draw_screen. Thus, display initialization and backlight control should not be duplicated. This patch prevents VbDisplayScreen from initializing display and controlling backlight when vboot is rendering screens using GBB. BUG=chrome-os-partner:43706,chromium:502066 BRANCH=tot TEST=Tested on Glados Change-Id: I50cd2decb7065af96779601b12f0fbf2554ff6ed Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312749 Reviewed-by: Aaron Durbin <adurbin@chromium.org>