summaryrefslogtreecommitdiff
path: root/futility/cmd_dump_fmap.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix fall through warning reported by ToT clang.Manoj Gupta2019-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | Clang is diagnosing implicit fallthrough in C code past https://reviews.llvm.org/rL369414. Detect the support for the fallthrough attributes in gcc/clang and enable it as VBOOT_FALLTHROUGH (copied from boringssl). This is needed to fix ToT clang builds. Note: GCC apparently does not diagnose fallthrough to another case with break but clang does (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432). And clang does not detect the fallthrough based on code comments. Bug: chromium:997709 Test: CQ Change-Id: Id8b4be4deabca2d0f1b2efd80efa72a485a5dc8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1772474 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* vboot: fix up some headers, includes, comments, spacingJoel Kitching2019-08-281-2/+2
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id97f544da845f7070555e5e8cc6e782b2d45c300 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758151 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Makefile: Enable more warnings for host utilities / testsJulius Werner2019-05-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a bunch of more warnings that are already enabled in coreboot and thus already enabled for firmware builds anyway (because coreboot just passes its CFLAGS through). Enabling it in the vboot Makefile means they also apply to host utilities and tests, which sounds desirable for consistency. Fix enough of the cruft and bad coding practices that accumulated over the years of not having warnings enabled to get it to build again (this includes making functions static, removing dead code, cleaning up prototypes, etc.). Also remove -fno-strict-aliasing from the x86 firmware build options, because it's not clear why it's there (coreboot isn't doing this, so presumably it's not needed). BRANCH=None BUG=None TEST=make runtests Change-Id: Ie4a42083c4770a4eca133b22725be9ba85b24184 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1598721 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* Fix more coverity warnings in utilitiesRandall Spangler2016-09-151-5/+6
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I8fcf0c51e33d5dc49f650f4069f1579091cf188d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383713 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility/host lib: Fix coverity warningsRandall Spangler2016-09-141-2/+4
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: Ib37b45dea54bd506b519b0304300b8d192e34339 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/382319 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: Let each command provide its own helpBill Richardson2015-03-181-5/+14
| | | | | | | | | | | | | | | | | | | 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-181-20/+17
| | | | | | | | | | | | | | | | | | 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>
* futility: Add global args to specify vboot API and formatstabilize-6842.Bstabilize-6835.BBill Richardson2015-02-281-5/+6
| | | | | | | | | | | | | | | | | | | | | | 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>
* futility: allow dump_fmap to specify where to extract areaBill Richardson2014-09-251-6/+34
| | | | | | | | | | | | | | | | | | | Previously, you could extract FMAP areas like so: futility dump_fmap -x bios.bin FW_MAIN_A VBLOCK_A ... This lets you decide what to name each area as it's extracted: futility dump_fmap -x bios.bin FW_MAIN_A:/tmp/rw_a ../vblock BUG=none BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: If02b57e03294b0b0b1dbc216ef57afdd3bdf2960 Reviewed-on: https://chromium-review.googlesource.com/219646 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Improve help messagesstabilize-6297.BBill Richardson2014-09-241-41/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* cleanup: add some easier-to-use FMAP parsing functions.Bill Richardson2014-08-291-11/+8
| | | | | | | | | | | | | | | | The functions that look for the FMAP and its entries should return more useful values. BUG=none BRANCH=ToT TEST=make runtests No functional changes. Change-Id: I4b62ea0de972bceb3d58f4ee8eb82ad065ddcbae Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/214630 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Reformat to use kernel coding styleBill Richardson2014-08-251-384/+391
| | | | | | | | | | | | | | This just reformats the futility sources to conform to the Linux kernel coding style. No functional changes. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I82df07dd3f8be2ad2f3df24cebe00a9a378b13f4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213915 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Avoid coredumps if the FMAP is wrong.Bill Richardson2014-07-171-11/+17
| | | | | | | | | | | | | 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>
* Cleanup: remove some noisy output from some utilitiesBill Richardson2014-07-151-2/+0
| | | | | | | | | | | | | | | | | There are a few utilities that print the full path of any file they open. This isn't necessary, and it just has to be ignored when running regression tests from different directories. This just removes that extra noise. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I4291bca7952a0d7371f8682b7d57545361c6341c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207619 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Revert "futility: Use flashrom for 'dump_fmap -x'"Simon Glass2013-07-151-34/+24
| | | | | | | | | | | | | | | | | | | | It seems likely that this is causing the reported autoupdate failure, although it will take a bit of time to understand the mechanism. For now, a revert seems safest. BUG=chromium:20939 BRANCH=none TEST=none This revert should be safe since it takes us back to the previous behavior. I will work on repeating the problem and diagnosing it properly. This reverts commit c1bbc75e3ba77019c62eda69db556109faeba607. Change-Id: I303fcbf45d835639b6d5a7f5f6423d0c18890ddf Reviewed-on: https://gerrit.chromium.org/gerrit/62004 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* futility: Use flashrom for 'dump_fmap -x'factory-pit-4390.BSimon Glass2013-07-111-24/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | New ARM boards use an FDTMAP, which is basically just an FDT. This means that we don't have two potentially conflicting flash maps in the image. Flashrom supports this without issue, but the firmware signer needs dump_fmap to support it also. It would be nice if we had libfmap implementing all this, but this is apparently a long-running clean-up task. So the next best thing is to deal with the flashmap in one program - i.e. flashrom. So support FDTMAP in futility by redirecting 'dump_fmap -x' to flashrom. BUG=chromium:256912 BRANCH=none TEST=manual With the flashrom -x option added, run this: sudo futility dump_fmap -x /build/peach_pit/firmware/image-peach-pit.bin gbb_utility --rootkey=rootkey.bin GBB See that the various chunks of data from the image are output and that gbb_utility completes without error. Change-Id: Id8b2c774a16bdd07968765be5e6609b1b0661a0f Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60862 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Build dump_fmap into futility.Bill Richardson2013-04-091-0/+476
This stops creating dump_fmap as a standalone utility and builds it into futility. Since it was already invoked as a symlink, no user-visible changes should be observed. BUG=chromium:224734 BRANCH=none TEST=manual, trybots sudo FEATURES=test emerge vboot_reference FEATURES=test emerge-$BOARD vboot_reference Change-Id: I68d1bea0c1867043b2633e15509b95c2717009a7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47672 Reviewed-by: Randall Spangler <rspangler@chromium.org>