fmap: Find more correct FMAP when multiple signatures exist.

Our firmware now more depends on FMAP to find contents inside itself; so FMAP
signature may appear multiple times (>2) in one image file, and the real FMAP
section may not always be in the beginning.

Function fmapFind only returns the first found signature. On a DUT, when the
first found signature is invalid, vpd utility will try to use live EPS value to
find correct FMAP section. However, when dealing with image files outside DUT
(ex, in build system), it will simply read unrelated data and then fail.

To fix the problem, we can add "FMAP checksum" in future; but for right now,
adding a check of "major version" would be sufficient.

BUG=none
TEST=emerge vpd; vpd -l -f image.bin # found correct fmap.

Change-Id: Id2e511ac43109676a73b19550240e00bb858f6ce
Reviewed-on: https://chromium-review.googlesource.com/189184
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
1 file changed
tree: bc97c870b4482b99d35f47984f097cfd21b8c0f9
  1. include/
  2. lib/
  3. tests/
  4. util/
  5. LICENSE
  6. Makefile
  7. README
  8. vpd.c