Add flashmap (fmap) support to Flashrom

This adds flashmap parsing to Flashrom. If an fmap data structure is found, entries will be added to flashrom's internal rom layout.

BUG=chromium-os:115
TEST=Tested on Alex

Testing methodology is similar to what was used in the -i argument patch (git hash d0ea9e), except now fmap data was present in the original bios image:
- Partial write test (automated script)

- Manual partial reads test by reading 4K chunks from ROM and comparing against original BIOS image file and also inspecting the chip-sized file.

- Ensure final chip-size image is generated properly by omitting :file from one of the -i arguments.

- Full read if no -i options are used when fmap is present

- Entire chip written if no -i option is specified and fmap is present. Same holds true if a layout file is specified by no regions are included. A command like "flashrom -w bios.bin" or "flashrom -l layout.txt -w bios.bin" will consistently write the full image to ROM.

- Specifying a non-existent region caused flashrom to fail (expected result).

TODO: Automate all of the above.

Review URL: http://codereview.chromium.org/6025013
6 files changed