summaryrefslogtreecommitdiff
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
...
* vboot2: Add host lib support for bare hash keysRandall Spangler2014-11-271-0/+1
| | | | | | | | | | | | | | And use them in the other vboot2 unit tests. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I0c3590649a0acf792e41e295ca4279ccba17a41f Reviewed-on: https://chromium-review.googlesource.com/231345 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* vboot2: Add host library functions to read/write new-format key objectsRandall Spangler2014-11-271-0/+4
| | | | | | | | | | | | And unit tests for them. BUG=chromium:423882 BRANCH=none TEST=make runtests && VBOOT2=1 make runtests Change-Id: I720bfb2537bae60f05b5ce28ab196a331a82eedf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230931
* vboot2: Add host library functions to read/write files and objectsRandall Spangler2014-11-271-0/+8
| | | | | | | | | | | | | | | | And unit tests for them. Move roundup32() into hostlib. Fix WriteFile() returning success even if it failed to write to the file. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I8a115335c088dc5c66c88423d1ccbda7eaca1996 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230844
* vboot: Remove FTS codeNam T. Nguyen2014-11-261-17/+1
| | | | | | | | | | | | | | | flash_ts driver (from Android) was pulled to support Sonic. But now we go a different route, this CL is to drop the FTS code. BUG=chromium:436597 BRANCH=none TEST=unittest Change-Id: I86d6273f9f5f642b504ccb6a76e005cda12d0e78 Reviewed-on: https://chromium-review.googlesource.com/231896 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
* vboot2: Add api-level functions to use new data structuresRandall Spangler2014-11-141-1/+4
| | | | | | | | | | | | | | | | | | And associated unit tests. And fix a memory overwrite in the old vb_api_tests.c, which apparently didn't touch a critical piece of the shared work buffer, but was still wrong. (This was a problem in the test, not in the code being tested.) BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I322fb7e6bb5214b0adcf5d6d48a0cd238abba88e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229738 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot: cgpt: Treat drive_path as the GPT storageNam T. Nguyen2014-11-141-6/+2
| | | | | | | | | | | | | | | | | | | | | | Previously, "cgpt" called out to "flashrom" directly to read and write NOR area. This CL removes that dependency and always treats "drive_path" as the storage of GPT structs. This makes it consistent that whatever device that cgpt reads from or writes to is always the device that stores GPT structs. We only need to pass in the size of the drive that contains the partitions, but we do not need to access to that drive. More information is in the bug. BUG=chromium:432611 BRANCH=none TEST=unittest CQ-DEPEND=CL:228942 Change-Id: Id0139adf70463cec4f2924de8b9a4725dbec822b Reviewed-on: https://chromium-review.googlesource.com/229736 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
* vboot2: load keyblock and preamble from new-style structsRandall Spangler2014-11-141-0/+3
| | | | | | | | | | | | | And associated unit tests. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I6565d8f5da947b4874a656a61051df1a4ce415c7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229163 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: cgpt: Support writing GPT structs to NOR flashNam T. Nguyen2014-11-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL allows the GPT headers and partition entry arrays to be stored in a NOR flash device. Instead of treating both the NOR and NAND devices as one (in a sandwich way), this CL writes and reads the GPT structs independently of the actual device that houses the partitions. Therefore, the first usable LBA of the partitions will be at 0, and the last usable LBA is at the end of the NAND. +------------------------+ | NOR houses GPT structs | +------------------------+ | 0 | Index into v v +------------------------+ | NAND houses partitions | +------------------------+ Note that the "my_lba", "alternate_lba", "entries_lba" in the GPT headers are no longer meaningful. Consumers of cgptlib will have to set "stored_on_device" to either GPT_STORED_ON_DEVICE or GPT_STORED_OFF_DEVICE, and "gpt_drive_sectors" to the number of 512-byte sectors available to store GPT structs. The NOR read and write operations are done by "flashrom". BUG=chromium:425677 BRANCH=none TEST=unittest TEST=build with DEBUG, cgpt create/add/show on a stumpy-moblab Change-Id: I083b3c94da3b0bb3da1a7b10c6969774080a2afd Reviewed-on: https://chromium-review.googlesource.com/226800 Reviewed-by: Nam Nguyen <namnguyen@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
* vboot2: use common header size fieldsRandall Spangler2014-11-051-0/+1
| | | | | | | | | | | | | | | | Add functions for verifying object integrity using common header size fields. Convert vb2_packed_key2 to use the the new functions. This isn't much prettier for packed keys; the benefit is more obvious for keyblocks (coming next). BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I0c09533368abb7ced3b5ac622a15e62832413b7f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226874 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Extend HWID digest into PCR1 (GBB v1.2 only)Bill Richardson2014-10-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 # Change-Id: I09cf855f1a24616cc1a9ddb676670edbc76827d2 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>
* futility: add version commandBill Richardson2014-10-311-0/+1
| | | | | | | | | | | | | BUG=none BRANCH=none TEST=manual make && ./build/futility/futility version Change-Id: I362b13d3befba62a33bc9fd2e87ad68f4bc62a84 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226779 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot2: Add vb2_unpack_key2() and unit testsfactory-rambi-6420.BRandall Spangler2014-10-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | This unpacks new-style packed keys. For now, it can also handle old-style packed keys by passing them to the old unpacking function. Once we've switched over to new-style keys in the signing scripts, we'll remove the old format to save code size. Also added is a test library which converts from old to new struct formats. That should eventually get absorbed into futility, and the test keys directory should have both old and new format packed keys in it. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I0fe31f124781d1ea1efedab65dcd6130bfca18dd Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225490 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cgpt: Separate out certain GPT manipluation functionsstabilize-6415.Bfoo-testDan Ehrenberg2014-10-291-0/+1
| | | | | | | | | | | | | | | | | For kernel NAND support, some vboot/cgptlib functionality is needed from depthcharge. This patch moves certain function declarations to a new header in firmware/include and puts their definitions in a common place. TEST=make runalltests passes and packages build BRANCH=none BUG=chromium:403432 Change-Id: Idd42b1f9f531651d78bb4afb80ca90c24aae93d9 Reviewed-on: https://chromium-review.googlesource.com/224996 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Daniel Ehrenberg <dehrenberg@chromium.org> Tested-by: Daniel Ehrenberg <dehrenberg@chromium.org>
* vboot2: Move and rename functionsRandall Spangler2014-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Move packed key functions to their own file, in preparation for introducing support for vb2_packed_key2. Rename the awfully-named vb2_verify_fw_preamble2() function to vb2_load_fw_premable(), since the new structs actually have a vb2_fw_preamble2 struct and that would be very confusing. Rename vb2_verify_fw_keyblock() to vb2_load_fw_keyblock(), so it matches. No functional changes, just renaming. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: Ia914e48e6c5814ab3205b999ceda1aa2452206ff Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225458 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add hwid digest field to GBB headerBill Richardson2014-10-211-1/+1
| | | | | | | | | | | | | | | | | | | 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). Change-Id: Icdb2a0b564677b0b65e58df897d2ec5af3964998 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221360
* vboot: new streaming APIsDan Ehrenberg2014-10-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: I660a89594390c72c2ef6ea2564367ce62bd90cf2 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>
* Improve cross-reference targetsBill Richardson2014-10-041-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 Change-Id: If1173af7edb41742bb348b728238d800ef66ad55 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221425 Reviewed-by: Randall Spangler <rspangler@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/. Change-Id: I48d3a780533c5b72cc18720d39b18ac286b07fd9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221177 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: rolled back vbutil_kernel changeBill Richardson2014-10-021-0/+1
| | | | | | | | | | | | | | | | | | | | | 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=ToT 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). 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>
* futility: Add support for [re]signing kernel partitionsBill Richardson2014-09-271-1/+0
| | | | | | | | | | | | | | 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> Change-Id: Ibc659f134cc83982e3f0c0bcc108cc0eddbe228e Reviewed-on: https://chromium-review.googlesource.com/219730 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: implement vbutil_kernel using buffers, not filesBill Richardson2014-09-251-3/+5
| | | | | | | | | | | | | | | | | | 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> Change-Id: Ic6c3e12429a5dcb271f8136a9edac70807d66120 Reviewed-on: https://chromium-review.googlesource.com/219647 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Improve help messagesstabilize-6297.BBill Richardson2014-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | 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>
* futility: stop using the symlink names in utility scriptsBill Richardson2014-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* Remove unused include path.Alex Deymo2014-09-051-2/+0
| | | | | | | | | | | | | | | | This path doesn't exists in the repo so this patch removes it from the Makefile: firmware/arch/${FIRMWARE_ARCH}/include BUG=None BRANCH=None TEST=./emerge_test Change-Id: I8b5461ee0ddfa0aa8d31bc6d2b981912a9ccde58 Reviewed-on: https://chromium-review.googlesource.com/214392 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
* futility: add load_fmap command, useful for testsBill Richardson2014-09-051-0/+1
| | | | | | | | | | | | | | | | This adds a "load_fmap" command, which is pretty much the opposite of the "dump_fmap -x" command. It allows you to replace the content of any FMAP areas with new stuff, without mucking around with dd. There's a test for it, too. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I5a9ab249c9e63a9bb1a9b26feeb3ed757cd294f1 Reviewed-on: https://chromium-review.googlesource.com/216228 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: add "sign" command to resign firmware imagesBill Richardson2014-09-051-0/+1
| | | | | | | | | | | | | | | The "sign" command can perform the same operation as the old resign_firmwarefd.sh script, only about 20 times faster. The test for that will use the new command instead. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ie7f7a0ab6fc00d7e06cb263733bf6e7246fdb023 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/216227 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Add a test for the resign_firmwarefd.sh scriptBill Richardson2014-09-051-0/+1
| | | | | | | | | | | | | | | | | This resigns official MP-signed BIOS images, because that's the best way to ensure we remain compatible forever. The resign_firmwarefd.sh script is invoked make_dev_firmware.sh, which is used for development and bringup. BUG=chromium:224734 BRANCH=ToT TEST=make runtests No new functionality, only a new test. Change-Id: I4bf9cdd8321d126e1c1a45fc198ef46b0eeb5c36 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/216226 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: the show command can traverse all file typesBill Richardson2014-09-031-2/+5
| | | | | | | | | | | | | | | | | | It doesn't yet handle block devices, but it can display normal files containing a entire BIOS image, a GBB, a VBLOCK, a .vbpubk, a .vblock, and a firmware preamble (VbFirmwarePreambleHeader). The command-line options are not well-documented. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I181f6331ae23599302bbaee3f270e8af9586cf06 Reviewed-on: https://chromium-review.googlesource.com/216032 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove futility linker script.Alex Deymo2014-09-021-10/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The futility.lds linker script was used to generate a table with all the symbols in a specific section called .futil_cmds listed in order under the symbol "futil_cmds". This allows the source files to define a command and let the linker figure out the list of compiled commands. Nevertheless, passing this linker script makes the linker leave a gap of about 2MiB in the output ELF file. Instead of mess up with linker scripts just to generate a table of commands, this patch generates such table in the Makefile looking at the included sources and compiling that table. The result is a futility binary of about 88 KiB instead of the 2.1 MiB required originally. This patch also adds sys-boot/chromeos-u-boot to the list of ebuilds tested by emerge_test.sh. BUG=chromium:408926 BRANCH=None TEST=BOARD=link ./emerge_test.sh TEST=BOARD=daisy_spring ./emerge_test.sh TEST=`readelf -S futility` shows no gap. TEST=/usr/bin/futility shows no difference in the help output. Change-Id: I9c0febc76140b404d48aa13e7f948e8ea77a41b5 Reviewed-on: https://chromium-review.googlesource.com/215496 Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
* vboot: Add system-level test for LoadKernel()Randall Spangler2014-08-291-1/+3
| | | | | | | | | | | | | | | | | | This creates a disk image and verifies a kernel can be loaded from it. It is roughly analogous to vb2_firmware_tests.sh, but at the kernel step instead of the firmware step. This will get more interesting in the near future, with the upcoming addition of a streaming API to read the kernel. BUG=chromium:408265 BRANCH=none TEST=make runtests Change-Id: Icc9e6d0e318c4bd38fc9ab1ad704da99232822e1 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/214508 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Add 'tags' target to MakefileBill Richardson2014-08-291-1/+8
| | | | | | | | | | | | | | | Handy for quick code searches. BUG=none BRANCH=ToT TEST=manual make tags Change-Id: Icc21769a168d1760f4f21802e1183a519cfeb019 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/214620 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: remove ancient tests that haven't been run in yearsBill Richardson2014-08-291-29/+3
| | | | | | | | | | | | | | | There are a number of tests that haven't even been compiled in a LOOOONG time. Let's get them out of the way. We can always put them back later. I'm adding a comment to this CL in the Makefile. BUG=none BRANCH=ToT TEST=make runalltests Change-Id: Id2d9f0b71fc40e4a260f54cf919c6af5e0ff85c5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/214610 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot2: Move vb2_verify_fw inside of futilityRandall Spangler2014-08-251-5/+5
| | | | | | | | | | | | | | | | | | | | | Update the unit tests which use it to use futility. No functional changes to it, just relocation. Remove the futility test which checks the exact list of supported commands. This doesn't have a good way of handling conditionally-compiled commands, and will be even harder to maintain as we add more commands in the future. Presence of sub-commands is still ensured by the other tests which use them (such as vb2_firmware_tests.sh) BUG=chromium:231547 BRANCH=none TEST=make runtests && VBOOT2=1 make runtests Change-Id: Idddb639276e4c6449d023d40ac7977123113bd28 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213191 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Call software sync a second time for PD, if necessaryRandall Spangler2014-08-011-0/+4
| | | | | | | | | | | | | | | | | If a device has both an EC and a separate PD chip, call software sync for each chip. BUG=chrome-os-partner:30079 BRANCH=none TEST=Flash image.bin with new AP+EC+PD firmware, reboot. See EC and PD both update and jump to RW. On next cold boot, they jump to RW without again updating. CQ-DEPEND=CL:210520 Change-Id: Ie445336ade46f0009c040afc14b3f40452caf27b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210536 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* futility: Add remaining vboot binary utilitiesBill Richardson2014-07-311-78/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds these formerly external utilities into the futility binary: dev_sign_file dump_kernel_config gbb_utility vbutil_firmware vbutil_kernel These target binaries will remain independent of futility, since they are not directly related to verified boot: cgpt crossystem tpm_init_temp_fix tpmc Also, dumpRSAPublicKey is removed from the target, since it is only used on the build host to create new keypairs. This change also add several additional tests. BUG=chromium:224734 BRANCH=ToT CQ-DEPEND=CL:210391,CL:210568,CL:210587 TEST=manual make runtests make clean Also build and test: - normal image - test image - recovery image - firmware shellball Note that this CL depends on simultaneous changes to the chromeos-initramfs ebuild. Change-Id: If791b5e9b5aac218ceafa9f45fc1785f16b91a64 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210403
* futility: deprecate eficompress and efidecompressBill Richardson2014-07-181-8/+32
| | | | | | | | | | | | | | | | I don't think these utilities are needed any longer, so mark them as deprecated. They will still be built and can be run via futility, but invoking them directly will fail with a warning message. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ie704f2cecc3c37c91e4a0ffbcbcf94e2bf3ba05b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/208775 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: add vbutil_keyblock into the built-in featuresBill Richardson2014-07-171-3/+2
| | | | | | | | | | | BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ie9efdcf0b69ab4697f050643b8f2f588e22d20d7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/208368 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: add vbutil_key into the built-in featuresBill Richardson2014-07-171-3/+3
| | | | | | | | | | | BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I6757a9c7f70bbe8d1db9bb3f0521778fbbb9632e Reviewed-on: https://chromium-review.googlesource.com/207927 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Install and use futility when running testsBill Richardson2014-07-171-4/+7
| | | | | | | | | | | | | | As we build features into futility, the standalone executables disappear. Tests that invoke those executables will need to invoke futility instead. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I75230f6901aab8d978fa5d12505c243e1c90c938 Reviewed-on: https://chromium-review.googlesource.com/207926 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Slight tweak to MakefileBill Richardson2014-07-171-28/+7
| | | | | | | | | | | | | Replacing a few duplicated items with a single definition, removing a couple of unnecessary/redundant dependencies. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I31e78ae1e3810865e26c9c4937eb44222cbfa9d6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207741
* Avoid coredumps if the FMAP is wrong.Bill Richardson2014-07-171-1/+1
| | | | | | | | | | | | | If the FMAP points beyond the boundaries of the image, don't believe it. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Ic35ce71ceac9beb7eb56b50baec938a8e085606c Reviewed-on: https://chromium-review.googlesource.com/207740 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Increase test coverage for dump_fmapBill Richardson2014-07-171-1/+1
| | | | | | | | | | | | This checks some additional cases where the FMAP is a bit messed up. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ic2b16bd8afdd1247d1f24c9f976d967764cadb73 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207719
* Cleanup futility test coverage framework a bitBill Richardson2014-07-161-6/+6
| | | | | | | | | | | | | This cleans up the Makfile and test scripts a bit, and adds a new test for the builtin commands. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ibf5aa867d4dcabc0e46daac6633036b035c99ac8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207718
* Clean up exported Mtd* functionsBill Richardson2014-07-091-5/+9
| | | | | | | | | | | | | | | | | | | | A lot of functions were added some time ago, nominally to support keeping the firmware in an MTD device that wasn't formatted with the GPT headers. That work was never completed, so these functions aren't used anywhere. We may want to resurrect this work at some future point. Until then, this CL just moves some of the functions into an "unused" file. BUG=chromium:231567 BRANCH=ToT TEST=manual All tests pass, all firmware and external repos build. Change-Id: I420dd52d1cea0418cedf2f8e834c61145915f20c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207037 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Split libvboot_host.a into external and local libraries.Bill Richardson2014-07-091-36/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've been creating and linking against a library called "libvboot_host.a" for two different reasons. The main purpose is to build the vboot_reference tools found in the utility/ directory. But there are some external userspace programs that would also like to use some functions in this library. This change establishes libvboot_host.a as the library for use by external userspace programs only, and creates a new libvboot_util.a library that's only used inside this source tree to build the vboot utilities. BUG=chromium:231567 BRANCH=ToT TEST=manual Build and run the local tests: make runalltests make clean Build Link firmware and all the utilities: emerge-link chromeos-base/vboot_reference \ sys-boot/depthcharge \ sys-boot/coreboot \ chromeos-base/chromeos-ec \ chromeos-base/chromeos-firmware-link \ chromeos-base/chromeos-cryptohome \ chromeos-base/update_engine \ chromeos-base/chromeos-installer \ chromeos-base/chromeos-login \ chromeos-base/verity Build Lumpy utilities, which include the 32-bit cros_installer: emerge-lumpy chromeos-base/vboot_reference \ chromeos-base/chromeos-login \ chromeos-base/verity \ chromeos-base/update_engine \ chromeos-base/chromeos-installer \ chromeos-base/chromeos-cryptohome Change-Id: Ie81ff1f74a6356cb8fab7d98471139d7758c4f19 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207016 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add fPIE flagBertrand SIMONNET2014-07-071-0/+5
| | | | | | | | | | | | | | | | | | | libvboot_host.a is needed by metrics, compiled in platform's gyp/ninja system. All platform executables need to be position independent so we need libvboot_host.a to be position independent too. BRANCH=None BUG=chromium:389742 TEST=Unittests. TEST=Build vboot_reference and metrics, metrics compiles. TEST=Build coreboot on a rambi, the compilation succeeds. TEST=trybot run on daisy, link, duck, rambi and x86-mario. Change-Id: I4b761d9435c35e3d3fcae2efc72fcaed7fc746a6 Reviewed-on: https://chromium-review.googlesource.com/206055 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
* vboot2: Add end-to-end test of firmware verificationstabilize.59781.98.Bstabilize.5978.98.Bstabilize.5978.51.Brelease-R37-5978.BRandall Spangler2014-06-201-0/+1
| | | | | | | | | | | | | | | | This constructs a test firmware using the old vboot signing utilities, and then verifies it using vboot2 libraries. This ensures vboot2 can read files signed by the current signing process. BUG=chromium:370082 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: Icc113c982e5ed99382a4592f9ab688784e853c8e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204561 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot2: api-level routinesRandall Spangler2014-06-191-0/+9
| | | | | | | | | | | | | | I'm breaking the last chunk of vboot2 into smaller pieces as I add tests. This has the api-level routines actually called by depthcharge. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: Ic7c082fc5faa0b874b2fa5a15ebda7135dcafe0b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200151 Reviewed-by: Bill Richardson <wfrichar@chromium.org>