crossystem: add functions to read and write VBNV via flashrom

This will replace the usage of "mosys nvram vboot {read,write}" on x86
platforms, and all ARM platforms except veyron (chromebooks only) and
nyan_kitty (which use VBNV storage in the ChromeOS EC, deprecated for
new platforms).  These affected ARM devices will be going AUE sometime
this summer, and we can expect to remove the mosys usage in crossystem
later this year.

The code to find the active VBNV in SPI flash was modeled to match the
logic in mosys (see mosys/lib/vbnv/vbnv_flash.c).

TEST=provided unit tests

Signed-off-by: Jack Rosenthal <>
Change-Id: I4f42af2f9a6b0703302635f8d8ebb2d7599d9847
4 files changed