summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Disable dev mode on recovery, when configured.stabilize-6912.Bstabilize-6909.BVadim Bendebury2015-03-232-0/+11
| | | | | | | | | | | | | | | If so desired by the firmware, disable developer mode each time the recovery mode is entered. BRANCH=storm BUG=chrome-os-partner:36059 TEST=with the rest of the patches applied observed desired behavior on an SP5 (developer mode state wiped out on entering recovery) Change-Id: If08dc517363bcc36fcc8b0b875a8700bbcefde4c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/261630 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot_reference: crossystem: add the "tpm_attack" commandLuigi Semenzato2015-03-212-4/+26
| | | | | | | | | | | | | | | | | | | This commands reads/sets a bit in the kernel-reserved area of the vboot context nvram. The bit can also be set by the driver during execution of a TPM command, to check if the command is interrupted by a panic or power loss. Under some circumstances, this correlates with the TPM assuming it is under attack. BUG=chromium:431360 TEST=try "crossystem tpm_attack" and variations BRANCH=none Change-Id: I87215d5a0becfb5c01e0b69867a339bfe6fd0b68 Reviewed-on: https://chromium-review.googlesource.com/261339 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Luigi Semenzato <semenzato@chromium.org> Tested-by: Luigi Semenzato <semenzato@chromium.org>
* futility: Split help for "sign" command into partsBill Richardson2015-03-206-74/+173
| | | | | | | | | | | | | | | | | | | | | The help message for the sign command is much too long. This breaks it into several subcategories. BUG=none BRANCH=none TEST=make runtests futility help sign futility help sign pubkey futility help sign fwblob futility help sign bios futility help sign vmlinuz futility help sign kernel Change-Id: I3e12b2cfdfb17a77c171f925a53748efb1d6c440 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/260496 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add sanity check for dev_boot_signed_onlyChirantan Ekbote2015-03-191-1/+28
| | | | | | | | | | | | | | | | | | | | Removing rootfs verification or resigning kernels can lead to an unusable system if the dev_boot_signed_only flag is set. Add a sanity check to print out an error when this happens. BRANCH=none BUG=none TEST=manual Run /usr/share/vboot/bin/make_dev_ssd.sh with the dev_boot_signed_only flag set to 1 and observe that an error message is printed. Change-Id: If116538152ee3122e3b742918bf1676982754fdd Reviewed-on: https://chromium-review.googlesource.com/260970 Trybot-Ready: Chirantan Ekbote <chirantan@chromium.org> Tested-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
* presubmit: enable branch checkMike Frysinger2015-03-181-0/+1
| | | | | | | | | | | | | We're moving the hardcoded check lists out of the pre-upload script. BUG=chromium:466264 TEST=uploading a CL w/out a branch line is rejected BRANCH=None Change-Id: Ie51600cdc6a635ea925d3e329cdf310e487346ea Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/260711 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Let each command provide its own helpBill Richardson2015-03-1815-94/+172
| | | | | | | | | | | | | | | | | | | Instead of a separate help function for each command, let's just require each command to handle a --help option. This will make it easier to layer the commands (for example, "sign" could have several subcommand variants, each with its own help). BUG=none BRANCH=none TEST=make runtests I also compared the result of running "futility help CMD" before and after this change. The help still shows up correctly. Change-Id: I5c58176f32b41b0a2c2b8f0afb17dddd80fddc70 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/260495 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: change longhelp functions to take multiple argsBill Richardson2015-03-1814-76/+73
| | | | | | | | | | | | | | | | | | Some of the help messages are getting pretty long. We should allow each command to provide additional help details only when asked. BUG=none BRANCH=none TEST=make runtests I also compared the help messages for all commands, both before and after this change to ensure that nothing was different. Change-Id: Ibe92ec80f99d286886fe020c9d826a5a05556471 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/260494 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: allow firmware to signal a wipeout requestVadim Bendebury2015-03-139-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has become necessary to be able to "factory reset" certain devices on firmware request. The best mechanism for this is NVRAM, as the request needs to be detected very early in the boot process, before other means of communications with the upper layers are available. A previously unused NVRAM bit (bit 0x08 at offset zero) is taken for this purpose. A new flag is introduced to allow the firmware to signal the need to assert this bit. A new variable name/parameter ('wipeout_request') added to crossystem to provide user space access to the setting of the dedicated NVRAM bit. BRANCH=storm BUG=chrome-os-partner:37219 TEST=with all the patches applied, on storm, holding the recovery button at startup for 10 seconds, causes 'crossystem wipeout_request' to report '1'. Change-Id: If1f6f061ce5b3f357b92aaa74cb129671dc30446 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/259857 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* avoid git statusMike Frysinger2015-03-131-2/+0
| | | | | | | | | | | | | | | | | | | | When trying to build out-of-tree, running `git status` will attempt to write to the .git/ dir which causes a sandbox violation. Since this code doesn't seem to actually do anything, drop it. BUG=chromium:466499 TEST=precq still passes TEST=build now passes when building out of tree TEST=`./scripts/getversion.sh` produces good output with clean & dirty trees BRANCH=None Change-Id: Ia722fedef692876ffc87109b3a1d2e4a76235532 Reviewed-on: https://chromium-review.googlesource.com/259541 Trybot-Ready: Mike Frysinger <vapier@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* TestBmpBlock: use real tempdirs instead of $PWDMike Frysinger2015-03-131-76/+64
| | | | | | | | | | | | | | | | This lets us do proper out-of-tree builds by not writing to the cwd. BUG=chromium:466499 TEST=precq still passes TEST=out-of-tree ebuild passes BRANCH=None Change-Id: I49eb013cf9c2f5ff73cfab155612aaa4d1d724cd Reviewed-on: https://chromium-review.googlesource.com/259520 Trybot-Ready: Mike Frysinger <vapier@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* vb21 tests: use the build dir for temp filesMike Frysinger2015-03-134-19/+45
| | | | | | | | | | | | | | | | | | Rather than write to temp files in the cwd, use the existing build dir as our scratch space. This lets us build out of tree properly even if the source repo is read only. BUG=chromium:466499 TEST=precq still passes TEST=out-of-tree ebuild passes BRANCH=None Change-Id: I5dd69dcb8289cc557143e115e409b9c0924263b3 Reviewed-on: https://chromium-review.googlesource.com/259530 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* split -Werror out into a dedicated varMike Frysinger2015-03-131-1/+2
| | | | | | | | | | | | | | | | This lets us control it explicitly. In CrOS, we won't turn it off, but most distros will want to as it's too hard to keep a handle on compilers and various settings users leverage. BUG=chromium:466499 TEST=precq still passes BRANCH=None Change-Id: I11bf03acefa3fd624dd4c5688dd18e3a3c87647d Reviewed-on: https://chromium-review.googlesource.com/259521 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* futility: add tests for futil_file_type(), correctly this timeBill Richardson2015-03-129-3/+112
| | | | | | | | | | | | | | | | | | | | | | | | | This adds a test to be sure we can identify the types of input files that futility can handle. This fixes commit d7e1e4f0befdda52ad48e5a8eb5fc49dbee40247, which was reverted in commit 1ab2c10e8cc51a66272458117e35619d87f53db0 because the Makefile dependencies were wrong. BUG=chromium:466433 BRANCH=none TEST=make runtests Also try this: \rm -rf build make $(pwd)/build/tests/futility/test_file_types -j16 Before, that failed every time. Now it works. Change-Id: I7702e1b99f4f593ef0121686a8616a2cb132e64a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/259651 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Provert "futility: Make --debug a global option"Bill Richardson2015-03-128-26/+25
| | | | | | | | | | | | | | | | This reverts commit d90b07bd4daa0c1cff7d78b733ef2bb759cc6e5a, which reverted d7e1e4f0befdda52ad48e5a8eb5fc49dbee40247, which didn't actually have anything wrong with it. BUG=chromium:466433 BRANCH=one TEST=None Change-Id: I68a60c38eba1fce1c9332601a57ea8fee72139a3 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/259650 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
* Revert "futility: Make --debug a global option"Prathmesh Prabhu2015-03-128-25/+26
| | | | | | | | | | | | This reverts commit d7e1e4f0befdda52ad48e5a8eb5fc49dbee40247. BUG=chromium:466433 TEST=None. Change-Id: Ia1b300e2dbccddbbae9e831709bc49eb53a5feb8 Reviewed-on: https://chromium-review.googlesource.com/259365 Reviewed-by: David James <davidjames@chromium.org> Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
* Revert "futility: add tests for futil_file_type()"Prathmesh Prabhu2015-03-129-103/+0
| | | | | | | | | | | | This reverts commit 271c071344beaacc45201c17406bcf3b4daece88. BUG=chromium:466433 TEST=None. Change-Id: Ic84d069d672a76b46201a0e3700801a1e6d47438 Reviewed-on: https://chromium-review.googlesource.com/259364 Reviewed-by: David James <davidjames@chromium.org> Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
* futility: add tests for futil_file_type()Bill Richardson2015-03-119-0/+103
| | | | | | | | | | | | | This adds a test to be sure we can identify the types of input files that futility can handle. BUG=none BRANCH=none TEST=make runtests Change-Id: Iff1dcc05530af2969a82d7c32599850bba59597a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/258501
* futility: Make --debug a global optionBill Richardson2015-03-118-26/+25
| | | | | | | | | | | | | | | Some commands look for a --debug option, others don't. The feature is implemented globally, so let's parse it as a global option. BUG=none BRANCH=none TEST=make runtests Change-Id: I3b169e4a1b93443786913276651113d1c915a834 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/258500 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vb21: Rename struct vb2_guid to struct vb2_idBill Richardson2015-03-1022-169/+156
| | | | | | | | | | | | | | Since the ID structure isn't a true GUID anymore, let's call it something else. BUG=none BRANCH=none TEST=make runtests Change-Id: I96f511bd5587a94d2cc20764e26d7ef0096de04c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/256182 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vb21: Replace the key GUID with a sha1sum insteadBill Richardson2015-03-107-134/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want a quick and human-friendly way to match keys with signatures, so we decided to give each key a unique GUID and carry that ID around when signing things. But then we realized that we could autogenerate a unique identifier from the .pem file itself, which is even better because then we can match our binary keypair structs with the openssl file used to generate them. This change replaces the GUID id with a sha1sum calculated from the public key's "keyb" blob. BUG=none BRANCH=none TEST=make runtests Also: futility show tests/testkeys/key_rsa4096.pem futility create tests/testkeys/key_rsa4096.pem foo futility show foo.vbp* Note that the GUID is the same for all files. Change-Id: Ie44e46c83433718b1ff0163c1e7c51ec331b99f9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/256181 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: Fix some typos in commentsBill Richardson2015-03-1010-16/+16
| | | | | | | | | | | | | | No code changes, just fix a few spelling errors and change C++ style comments to C-style. BUG=none BRANCH=none TEST=make runtests Change-Id: I153f821a3f42a92867c7dc4761a2bcde7f2518c4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/256123 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: show some information about .pem filesBill Richardson2015-03-106-2/+86
| | | | | | | | | | | | | | | | | | We use the .pem files to generate our public and private key files. Since we display the sha1sums of those files to help keep track of them, we might as well also display the same information about the RSA .pem files, too. BUG=chromium:231574 BRANCH=none TEST=make runtests futility show tests/testkeys/*.pem Change-Id: Ibfd1e016d65981d477ed7d117d23dedf48b95873 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246769 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: show sha1sums for private keys tooBill Richardson2015-03-105-4/+72
| | | | | | | | | | | | | | | | | | | | | | Because all of our private key structs carry around the openssl struct rsa_st data blobs, we can use those blobs to extract the corresponding public key and generate a digest of it. This lets us match our public and private keys without having to rely on the filenames. There's no crypto verification without actually *using* them, of course, but it's handy for quick reference. BUG=chromium:231574 BRANCH=none TEST=make runtests This also adds a test to ensure that all the public and private keys generated from the same .pem file have the same sha1sums. Change-Id: If83492437e3ef37f7c4ebca4675336b75f631901 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246768 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Display public and private keys for both formatsBill Richardson2015-03-109-10/+157
| | | | | | | | | | | | | | | | | | | | | | | | This enhances the futility show command to recognize and identify our public and private key files, for both the old vboot 1.0 format and the new vboot 2.1 format. BUG=chromium:231547 BRANCH=ToT TEST=make runtests vboot 1.0: futility show tests/devkeys/*.vbp* vboot 2.1: futility create tests/testkeys/key_rsa2048.pem foo futility show foo.vbp* Change-Id: I9d7641db03e480b416790a7da6b473215444128a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246767 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Add create command to make keypairs from RSA filesBill Richardson2015-03-1017-50/+879
| | | | | | | | | | | | | | | | | | | | This command reads a single .pem file and emits the public and private keys generated from it. It can produce both the old-style vboot 1.0 keys (.vbpubk and .vbprivk), or the new vboot 2.1 format keys (.vbpubk2 and .vbprik2). The default is the new format, but you can give futility the --vb1 arg to force the old format. A test is included. BUG=chromium:231547 BRANCH=ToT TEST=make runtests Change-Id: I4713dc5bf34151052870f88ba52ddccf9d4dab50 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246766 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* make_dev_ssd: Allow smaller kernel partition.Hung-Te Lin2015-03-031-1/+1
| | | | | | | | | | | | | | | Some Brillo devices may have smaller kernel partition and we need to reduce the size limit. BUG=none BRANCH=none TEST=make_dev_ssd.sh applied on a Brillo config with 8MB kernel partition. Change-Id: I9ca37445a6cdb20138f13dbe975c207383a1474c Reviewed-on: https://chromium-review.googlesource.com/255341 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Mao Huang <littlecvr@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* futility: Add global args to specify vboot API and formatstabilize-6842.Bstabilize-6835.BBill Richardson2015-02-2815-47/+157
| | | | | | | | | | | | | | | | | | | | | | The host-side futility tool will need to support all extant vboot implementations. Some legacy futility commands only support the original vb1 format, but others ("show" or "sign", for example) may need to be instructed which formats to expect or emit. This change adds some global args to specify the preferred formats. It also cleans up a few [unused AFAICT] one-letter args to avoid conflicts. BUG=chromium:231574 BRANCH=none TEST=make runtests Nothing makes use of this yet, except the "help" command. Change-Id: Ib79fa12af72b8860b9494e5d9e90b9572c006107 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246765 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Do not litter the source directory with build artifactsBill Richardson2015-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, building locally left a file named "vboot_host.pc" in the top directory. With this change, it's put into the $BUILD directory where it belongs. It still gets installed into the same place, of course. BUG=chromium:459338 BRANCH=none TEST=make runtests, and Run: make test_setup MINIMAL= make test_setup MINIMAL=1 find . -name vboot_host.pc Before this CL: ./build/install_for_test/usr/lib/pkgconfig/vboot_host.pc ./build/install_for_test/lib/pkgconfig/vboot_host.pc ./vboot_host.pc After this CL: ./build/install_for_test/usr/lib/pkgconfig/vboot_host.pc ./build/install_for_test/lib/pkgconfig/vboot_host.pc ./build/vboot_host.pc Change-Id: I3a888f72a5753228eec5187178d0da22de782171 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/254712 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Nam Nguyen <namnguyen@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix some Makefile dependencies for parallel testsBill Richardson2015-02-271-2/+2
| | | | | | | | | | | | | | make runtests -j4 occasionally failed due to missing dependencies. This helps. Of course, there may be others... BUG=none BRANCH=ToT TEST=make runtests -j4 Change-Id: Iff6e96f94b125a16be76d8cf34ce473bf6c65fe5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246764 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove duplicated linker flagAnatol Pomazau2015-02-251-1/+0
| | | | | | | | | | | | | | | We already set '-static' to LDFLAGS above no need to do it again here. TEST=build with 'make' and 'make STATIC=1'. Check that 'STATIC=1' adds '-static' linker flag. BUG=None Change-Id: I83e23984753094af203432eb4570930085788398 Reviewed-on: https://chromium-review.googlesource.com/251151 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Anatol Pomazau <anatol@google.com> Commit-Queue: Anatol Pomazau <anatol@google.com> Tested-by: Anatol Pomazau <anatol@google.com>
* cgpt_wrapper: Print error if execv() fails.Alex Deymo2015-02-231-1/+5
| | | | | | | | | | | | | | | | | | This shows an error message when cgpt.bin failed to run, with its reason. Without this patch, "cgpt" would just fail and return -1 in that case making it difficult to know the reason of the failure. BUG=chrome-os-partner:36061 TEST=replaced this binary in storm recovery initramfs 6699.0.0 and it shows the error message if cgpt.bin is not installed. BRANCH=None Change-Id: I3ffaba5a63c491ac7d5b16086d5ae21005f40317 Reviewed-on: https://chromium-review.googlesource.com/251868 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
* vboot2: add library function for extracting vmlinuz from kernel partZach Reizner2015-02-233-1/+86
| | | | | | | | | | | | | | | | | | | postinst needs access to a kernel that is bootable from legacy BIOS. futility provides extraction of a bootable vmlinuz from the kernel partition via the command line. This patch provides a function which does the same thing and is suitable for static linking into postinst with minimal additonal code linked in. This way we can avoid issues with running dynamic executables during postinst. BRANCH=none TEST=None BUG=chromium:455343 Change-Id: Iaec2f48e4d8f78a4bbfcc1636b6ce478e95e9a8e Reviewed-on: https://chromium-review.googlesource.com/251760 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org>
* vboot_reference: Support MTD devices in dump_kernel_configstabilize-js-6812.26.Bstabilize-js-6812.25.Bstabilize-js-6812.21.Bstabilize-6812.83.Bstabilize-6812.75.Bstabilize-6812.41.Bstabilize-6812.34.Bstabilize-6812.29.Bstabilize-6812.15.Bstabilize-6812.14.Bstabilize-6812.13.Brelease-R42-6812.Bfactory-ryu-6486.14.BNam T. Nguyen2015-02-192-0/+42
| | | | | | | | | | | | | | | | | This CL implements a read function that works with MTD devices in dump_kernel_config. BUG=chromium:457862 BRANCH=none TEST=make runtests TEST=try on storm_nand Change-Id: Id784d422de64e7918b163005c0b426d727d2115e Reviewed-on: https://chromium-review.googlesource.com/249271 Reviewed-by: Nam Nguyen <namnguyen@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Trybot-Ready: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
* Use /usr/bin/python2 in shebangsAnatol Pomazau2015-02-191-1/+1
| | | | | | | | | | | | | | Per the pep-0394 recommendation, version specific python scripts should specify the interpreter version. TEST=Run tests on a system with python3 default BUG=None Change-Id: I83e98f3bb0235230293819104570930085788398 Reviewed-on: https://chromium-review.googlesource.com/251132 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Anatol Pomazau <anatol@google.com> Commit-Queue: Anatol Pomazau <anatol@google.com>
* vboot_reference: Install vboot_host.pc fileNam T. Nguyen2015-02-192-1/+32
| | | | | | | | | | | | | | | | | Since we are going to pull in libmtdutils, it would be nice to let downstream packages automatically query for appropriate linking flags. BUG=chromium:459338 BRANCH=None CQ-DEPEND=CL:250836 TEST=See the depending CL. Change-Id: I9ff8046b95e1d7e909a483fe87a69d460777e192 Reviewed-on: https://chromium-review.googlesource.com/250530 Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Trybot-Ready: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org> Reviewed-by: Nam Nguyen <namnguyen@chromium.org>
* vboot_reference: Remove mmap() in dump_kernel_configNam T. Nguyen2015-02-171-62/+79
| | | | | | | | | | | | | | | | | | | dump_kernel_config utility used mmap() to map a file or block device to memory and searched from there. This CL removes mmap(), and reads from the input sequentially. We need this so that working with MTD devices is possible. We just need to implement another read function. BUG=chromium:457862 BRANCH=none TEST=make runtests TEST=FEATURES=test emerge vboot_reference Change-Id: I83e98f3bb079879f411d7f2f584b1792131b9b38 Reviewed-on: https://chromium-review.googlesource.com/249270 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Trybot-Ready: Nam Nguyen <namnguyen@chromium.org>
* kernel flags: Pass back kernel premable flags in kparamsFurquan Shaikh2015-02-124-0/+9
| | | | | | | | | | | | | | | | | | Kernel preamble flags are set by the signer for passing hints about the image. Read these flags from the preamble and pass it back to the caller in kparams structure. BUG=chrome-os-partner:35861 BRANCH=None TEST=Compiles and boots to kernel prompt for both CrOS image and bootimg. Change-Id: I07a8b974dcf3ab5cd93d26a752c989d268c8da99 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/245951 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org>
* kernel flags: Add flags field to kernel preamble.Furquan Shaikh2015-02-1213-13/+89
| | | | | | | | | | | | | | | | | | | | | | 1. Increase kernel preamble revision from 2.1 to 2.2. 2. Add flags field to kernel preamble. 3. Update futility to accept flags parameter for vbutil_kernel and cmd_sign for kernel. 4. Pass in an extra flags field to SignKernelBlob and CreateKernelPreamble. BUG=chrome-os-partner:35861 BRANCH=None TEST=1) "make runalltests" completes successfully. 2) vboot_reference compiles successfully for ryu. 3) Verified flags field in header using futility show. Change-Id: If9f06f98778a7339194c77090cbef4807d5e34e2 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/245950 Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org>
* initial Android.mkDavid Riley2015-02-121-0/+179
| | | | | | | | | | | | | Minimal Android.mk sufficient to build host tools to compile futility vbutil_keyblock and vbutil_kernel to sign kernel images. BUG=none TEST='mm' from within Android tree compiles BRANCH=none Change-Id: Ie46be27cd14a5ca73a23eb52238eb9fd326ccaf4 Signed-off-by: David Riley <davidriley@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/247820
* vboot2: Add more precise recovery reasons to firmware verificationstabilize-6783.BJulius Werner2015-02-124-28/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vboot1 kept track of an internal "LoadFirmware() check" value for both firmware slots and encoded the value for the slot that managed to go further in the verification flow into a special range of recovery reasons. vboot2 instead uses the generic "invalid RW" reason for all firmware verification failures and communicates further information through the subcode. While the subcode may be good enough for developers, it's difficult to communicate failure reasons to "normal" users (like non-firmware developers) on the TAB screen. Currently we just display a couple of numbers that people won't know how to interpret and "RW firmware failed signature check" for any verification error (including rollback, which might be the most commonly encountered in practice). Since our recovery reason space is big enough (and we don't reuse old numbers anyway), we might as well reuse the more precise numbers (and strings) from vboot1 to communicate the failure reason, even if we don't implement its "which slot came further" algorithm. This patch translates the most common/useful VBSD_LF_CHECK numbers into plain VB2_RECOVERY reasons and uses them where appropriate. CQ-DEPEND=CL:248400 BRANCH=veyron BUG=None TEST=make runtests VBOOT2=1 test_that my_jerry firmware_CorruptBothFwSigAB firmware_CorruptBothFwBodyAB firmware_RollbackFirmware (Confirmed that matched recovery reasons are the more precise ones in the 0x10-0x1F range.) Change-Id: I51ecf1b820d1faa40405cb84377380d6f3f6ca1d Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/248392 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Changes to compile signing tools on darwinDavid Riley2015-02-119-4/+39
| | | | | | | | | | | | | | | | | | | The following works from a Mac with these changes: make Q= ARCH=arm HAVE_MACOS=1 `pwd`/build/futility/futility Only vbutil_keyblock and vbutil_kernel have been exercised. BUG=none TEST='make Q= ARCH=arm HAVE_MACOS=1 `pwd`/build/futility/futility' BRANCH=none Signed-off-by: David Riley <davidriley@chromium.org> Change-Id: Ie69cfee0c650d4ff96be6322083a2fea1543ee39 Reviewed-on: https://chromium-review.googlesource.com/246773 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: David Riley <davidriley@chromium.org> Commit-Queue: David Riley <davidriley@chromium.org>
* Add LINUX_FS_GUID to list of GUIDs.Furquan Shaikh2015-02-111-0/+2
| | | | | | | | | | | | | | | | | This is for experimental purpose. BUG=chrome-os-partner:35861 BRANCH=None TEST=Compiles successfully. Change-Id: I53ce56f3728b72473a42581665969c90598ffd62 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/242924 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org>
* vboot1: Add vboot2 recovery reason strings and subcode to TAB displayJulius Werner2015-02-112-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | vboot2 added a few new recovery reasons (and abolished many old ones). In the current vboot2/vboot1 hybrid architecture used on Veyron, the vboot1 kernel verification part controls the status display when pressing the TAB key, which may try to show recovery reasons set by the vboot2 firmware verification part. These currently result in the not very helpful "We have no idea what this means", so lets hack a few more strings into vboot1 which will be otherwise harmless. Also add the recovery_subcode field to the display, which is used much more extensively by vboot2 and often very useful in firguring out what really went wrong. BRANCH=veyron BUG=None TEST=Manually set a few recovery reasons and subcodes through crossystem and made sure they get displayed correctly on my Jerry. Change-Id: I3f3e6c6ae6e7981337841c0c5e3cd767628472c3 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/248391 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* crossystem: read recovery switch status from chromeos_arm deviceKen Chang2015-02-101-0/+5
| | | | | | | | | | | | | | | | | | | | | The kernel chromeos_arm platform device provides the recovery status with the consideration of active polarity. Thus make crossystem to read from chromeos_arm device first. If this is not available, read directly from gpio pin status. BUG=chrome-os-partner:36425 BRANCH=none TEST=ran on kitty, 'crossystem recoverysw_cur' return 0 with recovery switch off 'crossystem recoverysw_cur' return 1 with recovery switch on Change-Id: Ie20630d7d07aeadf24044cd3ffc495df7cdd8a4a Signed-off-by: Ken Chang <kenc@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/246883 Tested-by: Titan Lee <titanlee@nvidia.com> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Titan Lee <titanlee@nvidia.com>
* Check the correct length of the GPT header signaturestabilize-6771.Bfactory-auron-6772.BBill Richardson2015-02-091-9/+12
| | | | | | | | | | | | | | | | | | | The length of the signature is 8 bytes. We've been checking 9 bytes instead, pretty much forever. All the tests have passed because although the signature we're looking for is an 8-byte string followed by a '\0', the next field in the header contains the revision number 0x00010000, so the 9th byte is always zero. We should follow the spec, though. BUG=none BRANCH=none TEST=make runtests Change-Id: I7cc6370250fa36a193f4a9fa5bc0099aea465618 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/247331 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot2: Fail vb2_secdata_(get|set) when secdata was not initializedJulius Werner2015-02-043-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a check to vboot2 secdata accessor functions that returns an error if vb2_secdata_init() has not yet been called or failed for some reason. This avoids a problem where vboot may misinterpret random garbage (e.g. from transient read failures) as valid secdata in recovery mode and write it back to the TPM (bricking the device in a way that requires manual repair). Also removes VB2_ERROR_SECDATA_VERSION check. This check was not terribly useful since there should be no way a vboot2 device could ever have secdata version 1 (and if it did, it should still fail CRC checks). This error can trigger for cases when secdata contains random garbage (e.g. all zeroes) and prevent the much more appropriate VB2_ERROR_SECDATA_CRC error from even being checked for, which just creates confusion and makes it harder to determine the real problem. BRANCH=veyron BUG=chrome-os-partner:34871 TEST=Emulated TPM read errors by just manually memset()ing secdata to 0 in coreboot, verified that vboot does not write back to the TPM and the device will start working fine again once the disruption is removed. Change-Id: I76bcbdbcd8106a0d34717cc91a8f2d7cda303c3f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/244846
* keygeneration: fix typos in previous commitMike Frysinger2015-02-031-9/+9
| | | | | | | | | | | | | | Forgot to update the bitsizes in the variable constants. BUG=chromium:454651 TEST=`./create_new_keys.sh` still generates 8k keys TEST=`./create_new_keys.sh --4k` now generates 4k keys BRANCH=None Change-Id: Ie285649f4d58ad2e2cba71f4cab737cc2235e3ab Reviewed-on: https://chromium-review.googlesource.com/245890 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* create_new_keys: add options for generating 4k keysMike Frysinger2015-02-032-28/+59
| | | | | | | | | | | | | BUG=chromium:454651 TEST=`./create_new_keys.sh` still generates 8k keys TEST=`./create_new_keys.sh --4k` now generates 4k keys BRANCH=None Change-Id: I2203536880b9320959fd741c4bbcf814aded603c Reviewed-on: https://chromium-review.googlesource.com/245318 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* vboot_reference: fix pointer issue in vmlinuz recontructionShelley Chen2015-02-031-11/+21
| | | | | | | | | | | | | | | | | vmlinuz_header_address was using an offset as opposed to a pointer. BUG=None BRANCH=None TEST=Take a kernel block and reconstruction the vmlinuz image: "vbutil_kernel --get-vmlinuz kern0 --vmlinuz-out vm.out" Then, try to kexec vm.out. Change-Id: Ifb41a00fd73f3222673467eef370c7abdbd0fd9c Reviewed-on: https://chromium-review.googlesource.com/245441 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
* create_new_keys: add a proper main funcstabilize-6752.BMike Frysinger2015-02-031-61/+95
| | | | | | | | | | | | | | | | | | | | | While we do this, clean up: - use braces everywhere - convert local vars from $VAR to $var - parse all command line args properly - run in `set -e` mode BUG=chromium:454651 TEST=`./create_new_keys.sh` still generates sane keys TEST=`./create_new_keys.sh --help` shows help output TEST=`./create_new_keys.sh --asdfasdf` shows an error TEST=`./create_new_keys.sh` outside chroot (w/out vboot binaries) aborts after first failure BRANCH=None Change-Id: I1ba0db0b24c0f2f10cf397b47115f0e98384d991 Reviewed-on: https://chromium-review.googlesource.com/245317 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>