Per region file arguments: Difference between revisions

From flashrom
Jump to navigation Jump to search
No edit summary
Line 29: Line 29:
* if no '''-r/-w/-v <filename>''' (i.e. without a '''<region>''') is specified, no '''-i''' arguments may be given either
* if no '''-r/-w/-v <filename>''' (i.e. without a '''<region>''') is specified, no '''-i''' arguments may be given either


==== optional Rules: ====
==== optionally, stricter ====


* forbid combinations of '''-r/-w/-v <filename>''' without a '''<region>''' and with? less flexible but easier to use
Never mix '''<region>:<file>''' with the old '''-i''' syntax in one invocation:
 
    ([-i <region>]... (-r|-w|-v <filename>) | (-r|-w|-v <region>:<filename>)...)

Revision as of 21:56, 8 February 2018

Current chromium impl.

Current chromium flashrom implements the syntax like this:

   [-i <region>[:<file>]]... -r|-w|-v [<filename>]

Where <filename> can be given anywhere on the command line (non-positional).

Rules:

  • if no <filename> is given, all -i arguments must specify a <file>
  • For reading:
    • if any -i region:<file> is given along with <filename>, read all included regions into <filename> and all included regions with a <file> specified into the respective file
  • For writing and verifying:
    • if any -i region:<file> is given along with <filename>, the data of -i region:<file> takes precedence
    • regions with files given with -i region:<file> must not overlap

More details: https://www.chromium.org/chromium-os/packages/cros-flashrom#TOC-Partial-Reads-and-Writes

More explicit alternative

   [-i <region>]... (-r|-w|-v [<region>:]<filename>)...

Easier to implement, no optional arguments, no non-positional arguments.

Rules for sanity:

  • combinations of -r/-w/-v are not allowed
  • -r/-w/-v <filename> (i.e. without a <region>) may only be specified once
  • if no -r/-w/-v <filename> (i.e. without a <region>) is specified, no -i arguments may be given either

optionally, stricter

Never mix <region>:<file> with the old -i syntax in one invocation:

   ([-i <region>]... (-r|-w|-v <filename>) | (-r|-w|-v <region>:<filename>)...)