host/lib: add lightweight flashrom wrapper library

Lightweight wrapper around flashrom, exposing two APIs:

    flashrom_read(programmer, region, data_out, size_out)
    flashrom_write(programmer, region, data, size)

|region| can be NULL, in which case operate on the whole flash chip.

The intended usage of this wrapper library is to read/write VBNV from
SPI flash directly, avoiding the call thru mosys (which has deprecated
the command).  Bringing this logic into crossystem directly will also
help with expanding VBNV to 64-bytes.

BUG=chromium:1032351,chromium:1030473,chromium:789276
BRANCH=none
TEST=provided unit tests

Change-Id: I3997bd03a2db7e58e4e76fc200c637dd3b5b20a4
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2218888
5 files changed