Hello Louis Yung-Chieh Lo, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/19387
to look at the new patch set (#2).
Change subject: make args for -r/-w/-v non-positional and optional ......................................................................
make args for -r/-w/-v non-positional and optional
Ported from chromiumos: https://chromium-review.googlesource.com/#/c/60515/
This makes a filename following -r, -w, and -v operations non- positional. The first argument that does not begin with a hyphen (-) is the filename for -r/-w/-v. If no such argument exists, then -r/-w/-v options apply to files specified for individually included regions via -i.
This has a few side-effects: 1. It allows us to omit the ROM-sized filename entirely when a filename is provided for a particular region when using -i. For example, "flashrom -i FOO:foo.bin -r".
2. It allows, for better or worse, the filename be specified anywhere on the command line after the program name. Our scripts and docs should still specify the file after -r/-w/-v for clarity.
For our purposes, if a filename is given for every included region (-i region:filename) then the user does not need to specify a filename after -r/-w/-v. However, if any -i option does not specify a filename, then a file must be specified after -r/-w/-v.
The syntax will be backwards compatible for now so that one can still mix -i options with and without the added filename specifier for each region.
BUG=chromium:263495 BRANCH=none TEST=manual (see notes below)
1. Write random data to RW_UNUSED region (on snow in this case) without requiring an argument to -w. See that only RW_UNUSED is erased and written, and that verify works: dd if=/dev/urandom of=rw_unused.bin bs=1k count=1 conv=notrunc flashrom -p host -i RW_UNUSED:rw_unused.bin -w -V flashrom -p host -i RW_UNUSED:rw_unused.bin -v -V
2. Same as above, but specify a dummy file to test syntax backwards compatibility: dd if=/dev/urandom of=rw_unused.bin bs=1k count=1 conv=notrunc dd if=/dev/urandom of=random_4M.bin bs=1M count=4 flashrom -p host -i RW_UNUSED:rw_unused.bin -w random_4M.bin -V flashrom -p host -i RW_UNUSED:rw_unused.bin -v random_4M.bin -V
3. Test that dumping RW_UNUSED and GBB regions without -r arg dumps two files and that they can be used to verify the content: flashrom -p host -i RW_UNUSED:rw_unused.bin -i GBB:gbb.bin -r flashrom -p host -i RW_UNUSED:rw_unused.bin -i GBB:gbb.bin -v
4. Same as above, but with dummy file: flashrom -p host -i RW_UNUSED:rw_unused.bin -i GBB:gbb.bin -r x.bin flashrom -p host -i RW_UNUSED:rw_unused.bin -i GBB:gbb.bin -v x.bin
Change-Id: Iefbcb7dc4fefe26f5afd1292dfd5c1687fa62803 Reviewed-on: https://gerrit.chromium.org/gerrit/60515 Reviewed-by: Yung-Chieh Lo yjlou@chromium.org Commit-Queue: David Hendricks dhendrix@chromium.org Tested-by: David Hendricks dhendrix@chromium.org --- M cli_classic.c M flashrom.c M layout.c M layout.h 4 files changed, 209 insertions(+), 21 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/87/19387/2