layout: Verify layout entries before building a new image using them

This fixes a SEGFAULT if a layout entry is included that addresses memory
outside the current chip's address range. flashrom will only abort if the
offending region(s) is/are included else it will just warn.

It will print warnings for regions with negative or zero-length address ranges
and bail out after checking all of them.

Also, abort for non-write operations if a layout file is given because there is
no layout support for other operations yet.

Corresponding to flashrom svn r1751.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
4 files changed