summaryrefslogtreecommitdiff
path: root/futility/misc.c
Commit message (Collapse)AuthorAgeFilesLines
* futility: Merge Debug() into VB2_DEBUG()Julius Werner2019-03-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Futility has two debug facilities: the Debug() function that can be enabled by passing --debug on the command line, and the VB2_DEBUG() macro (mostly in common code from the firmware/ directory that it includes) which can only be enabled by passing DEBUG=1 at build time. This is confusing and inconvenient, since you don't always want to rebuild futility whenever you need that extra debug output and it's not very obvious that you can get even more debugging beyond just passing --debug. This patch resolves the inconsistency by merging both facilities together into a single VB2_DEBUG() that is output when passing --debug. In order to make this work, we'll have to move the VBOOT_DEBUG #define so that it only affects the stub implementation of vb2ex_printf(), and any caller overriding the stub is in charge of their own destiny. This should be okay since callers can still individually implement debugging policy in their versions of vb2ex_printf() if they want to. (This may have been useful to cut down the binary space for debugging strings, but our firmware has always been unconditionally enabling VBOOT_DEBUG in the past years, so that doesn't seem to be very important in practice.) BRANCH=None BUG=None TEST=Ran futility --debug show, noticed I got all the extra keyblock verification debug output I always wanted. Change-Id: I9a5c205fc3673941b50f03f2a967b1be110a1555 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1504140 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: updater: Correct HWID digest when preserving HWIDstabilize-11647.70.Bstabilize-11647.104.Brelease-R73-11647.BHung-Te Lin2019-01-161-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | Starting from GBB 1.2, a digest is stored in GBB and must be updated whenever the HWID string is changed. In shell script version of updater, the digest is automatically updated when we do "futility gbb -s --hwid=XXX", but in native updater implementation we only updated the HWID string and left digest unchanged, this leaves devices generating wrong PCR1 values. `cmd_gbb_utility` updates the digest by calling `update_hwid_digest` using vboot1 structure, so we should introduce a new vboot2 friendly function, `vb2_change_hwid`, which changes both HWID string and digest at same time. Note this has no impact for end user's devices with write protection enabled. Only changes dogfood units AU results. BUG=b:122248649 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=none Change-Id: I6ad2754e6df3c9dd66d71c560a2afc26d14eae33 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1411932 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Convert vboot1 SHA calls to use vboot2Randall Spangler2016-07-221-11/+14
| | | | | | | | | | | | | | | | | | This change replaces all calls to the old vboot1 SHA library with their vboot2 equivalents. This is the first in a long series of changes to move the core vboot kernel verification into vb2, and the control/display loop out to depthcharge. BUG=chromium:611535 BRANCH=none TEST=make runtests; build samus firmware and boot it Change-Id: I31986eb766176c0e39a192c5ce15730471c3cf94 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/344342 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: put the recognizer functions in file_type.incBill Richardson2015-03-311-2/+2
| | | | | | | | | | | | | | | | | | This is preparation for a refactoring of how files are traversed. file_type.inc will specify functions to recognize, show, or sign each type of file. This change puts the recognizer functions in file_type.inc, but just stubs out the show and sign commands. BUG=chromium:231574 BRANCH=none TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I1596a21319a8fb1182537abdf9be0196bef4b84b Reviewed-on: https://chromium-review.googlesource.com/262893 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: send debug messages to stdout, not stderrstabilize-6919.BBill Richardson2015-03-271-2/+2
| | | | | | | | | | | | | | | | | | It's more useful to see the debug messages interleaved with the regular output instead of going to a separate stream. BUG=none BRANCH=none TEST=make runtests Try: futility --debug show tests/futility/data/bios_zgb_mp.bin | less Change-Id: I43526821fc93b2af4d6d01b3bc2465e5b9672e26 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/262717 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Provert "futility: Make --debug a global option"Bill Richardson2015-03-121-0/+3
| | | | | | | | | | | | | | | | 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-121-3/+0
| | | | | | | | | | | | 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>
* futility: Make --debug a global optionBill Richardson2015-03-111-0/+3
| | | | | | | | | | | | | | | 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>
* Changes to compile signing tools on darwinDavid Riley2015-02-111-0/+4
| | | | | | | | | | | | | | | | | | | 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>
* futility: handle truncated BIOS images without segfaultBill Richardson2015-02-031-0/+3
| | | | | | | | | | | | | | A truncated BIOS with an otherwise valid FMAP that now points way off the end of the file shouldn't cause coredumps. BUG=none BRANCH=ToT TEST=make runtests Change-Id: Idf96e1e6a381bf0fe0b1cb2d16e3dad39ce7a0dc Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/245500 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: refactor file type detection into new filesBill Richardson2015-01-311-15/+50
| | | | | | | | | | | | | | | | This moves the what-kind-of-file-is-this logic into a separate file, and makes it work by calling distinct recognizers until one hits. A new "-t" option to the show command prints what it's doing. BUG=chromium:228932 BRANCH=ToT TEST=make runtests Change-Id: Id8f60bdf3fe6a9adf41b4555b3448a261fa52fea Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/245122 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Don't copy the entire kernel partition just to sign a blobBill Richardson2014-12-041-2/+4
| | | | | | | | | | | | | | | | | | When re-signing a kernel partition and writing the result into a new file, make sure we only emit the vblock and kernel blob instead of creating a new file that's the size of the entire partition. Also add a test for that. BUG=chromium:418647 BRANCH=none TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I2c42aec6816e7e7abbeed360089c9b51fdcfe786 Reviewed-on: https://chromium-review.googlesource.com/233039 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add hwid digest field to GBB headerBill Richardson2014-10-211-0/+51
| | | | | | | | | | | | | | | | | | | 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
* futility: clean up a few shared functionsBill Richardson2014-09-251-11/+27
| | | | | | | | | | | | | | | Move the Debug() function into a common place instead of several copies in different files, rename shared functions to start with "futil_" BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I6b844553dff95c24894dae611102716a8da5312d Reviewed-on: https://chromium-review.googlesource.com/219645 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Improve help messagesstabilize-6297.BBill Richardson2014-09-241-2/+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>
* futility: add "sign" command to resign firmware imagesBill Richardson2014-09-051-0/+125
| | | | | | | | | | | | | | | 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: the show command can traverse all file typesBill Richardson2014-09-031-0/+90
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>