coreboot-kgpe-d16/util
Vadim Bendebury 458a12e52b cbfstool: allow user to explicitly specify header location
There potentially could be multiple CBFS instances present in the
firmware image. cbfstool should be able to operate on any of them, not
just the first one present.

To accomplish that, allow all CBFS commands to accept the -H parameter
(which specifies the exact CBFS header location in the image).

If this parameter is specified, the image is not searched for the CBFS
header, only the specified location is checked for validity, If the
location is valid, it is considered to be the CBFS header, if not -
the tool exits with an error status.

Note, that default behavior of the tool does not change.

BRANCH=storm
BUG=chrome-os-partner:34161, chromium:445938
TEST=run the following experiments:

  - examined an image with three CBFS instances, was able to print all
    of them.

  - built a rambi coreboot image and tried the following (cbfstool output abbreviated):

  $ ./util/cbfstool/cbfstool /build/rambi/firmware/coreboot.rom print
  coreboot.rom: 8192 kB, bootblocksize 2448, romsize 8388608, offset 0x700000
  alignment: 64 bytes, architecture: x86

  Name                           Offset     Type         Size
  cmos_layout.bin                0x700000   cmos_layout  1164
  ...
  (empty)                        0x7ec600   null         77848
  $ \od -tx4 -Ax /build/rambi/firmware/coreboot.rom | tail -2
  7ffff0 fff67de9 000000ff fff6dfe9 fffff650
  800000
  $ ./util/cbfstool/cbfstool /build/rambi/firmware/coreboot.rom print  -H 0x7ff650
  coreboot.rom: 8192 kB, bootblocksize 2448, romsize 8388608, offset 0x700000
  alignment: 64 bytes, architecture: x86

  Name                           Offset     Type         Size
  cmos_layout.bin                0x700000   cmos_layout  1164
  ...
  (empty)                        0x7ec600   null         77848
  $ ./util/cbfstool/cbfstool /build/rambi/firmware/coreboot.rom print  -H 0x7ff654
  E: /build/rambi/firmware/coreboot.rom does not have CBFS master header.
  E: Could not load ROM image '/build/rambi/firmware/coreboot.rom'.
  $

Change-Id: I64cbdc79096f3c7a113762b641305542af7bbd60
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 86b88222df6eed25bb176d653305e2e57e18b73a
Original-Change-Id: I486092e222c96c65868ae7d41a9e8976ffcc93c4
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/237485
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/9741
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-04-18 08:48:05 +02:00
..
abuild abuild: also consider verstage architecture 2015-04-10 07:42:20 +02:00
acpi GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
amdtools Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
arm_boot_tools/mksunxiboot arm_boot_tools: Add 'b' to fopen flags for Windows compatibility 2014-12-19 18:55:34 +01:00
bimgtool util/bimgtool: Add verification mode 2015-04-10 12:03:35 +02:00
board_status board-status: update mediawiki interface 2015-03-04 20:46:01 +01:00
cbfstool cbfstool: allow user to explicitly specify header location 2015-04-18 08:48:05 +02:00
cbmem timestamps: You can never have enough of them! 2015-04-14 09:03:40 +02:00
crossgcc crossgcc: Fix calling outside util/crossgcc 2015-03-30 12:04:39 +02:00
dtd_parser GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
dumpmmcr dumpmmcr: Fix compilation warnings in printf 2012-01-26 09:57:56 +01:00
ectool ectool: add query function to ectool 2015-04-08 08:41:59 +02:00
exynos exynos: Install the BL1 and set the checksum in the Makefile. 2014-09-09 20:01:18 +02:00
fletcher util/fletcher: fix debug option parsing 2014-10-18 14:45:42 +02:00
genbuild_h util/genbuild_h: work around GNU date 2015-03-29 22:45:08 +02:00
genprof util/genprof: improve handling of command line arguments 2014-08-12 09:02:44 +02:00
gitconfig git: add rebase helper script 2015-04-10 09:01:30 +02:00
i915tool util/i915tool: close the file also when fread() returned an error 2014-07-30 13:16:53 +02:00
ifdfake ifdfake - Create an IFD with just a section layout 2013-06-24 17:56:42 +02:00
ifdtool ifdtool: Add O_BINARY to open flags for Windows compatibility 2014-12-19 18:55:48 +01:00
inteltool inteltool: add ICH8M-E support 2015-03-26 03:33:46 +01:00
ipqheader util/ipqheader: Add utility to create uber-SBL for IPQ8064 2015-04-13 17:36:27 +02:00
k8resdump GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
kconfig kconfig: Add wildcard support for "source" 2015-04-06 23:52:57 +02:00
lbtdump lbtdump: Dump forwarded tables. 2014-03-09 21:19:29 +01:00
lint lint: Add check for new board name scheme 2015-04-18 08:31:36 +02:00
msrtool utils/msrtool: add westmere cpuids to nehalem 2015-02-11 02:51:16 +01:00
nvidia cbootimage: Add HOSTCC and flags 2015-02-15 09:21:02 +01:00
nvramtool nvramtool: fix getopt handling with unsigned char 2015-04-06 23:29:06 +02:00
optionlist GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
resetcf Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
rockchip add make_idb.py & update bootblock 2015-03-24 15:24:52 +01:00
romcc romcc: avoid use-after-free 2014-09-06 09:21:07 +02:00
runfw ARM: Generalize armv7 as arm. 2014-09-08 18:59:23 +02:00
sconfig sconfig: add cpu device type 2014-10-07 21:03:25 +02:00
showdevicetree ARM: Generalize armv7 as arm. 2014-09-08 18:59:23 +02:00
spkmodem_recv Add spkmodem receiver 2013-06-12 05:18:24 +02:00
superiotool util/superiotool: change displayed name of chip id 0xc333 (nct6776) 2014-12-19 19:01:47 +01:00
uio_usbdebug uio_usbdebug: User-space-i/o framework for usbdebug 2015-03-19 19:19:42 +01:00
vgabios Rename devices -> device 2012-11-30 23:59:58 +01:00
viatool viatool: Add utility to read various configuration bits on VIA systems 2013-06-04 22:36:26 +02:00
xcompile armv7-m: add armv7-m configuration 2015-04-10 07:42:18 +02:00