--- this still reads the whole image in...
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- flashrom.c | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/flashrom.c b/flashrom.c index 2eec0d6..57a5565 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1022,16 +1022,29 @@ notfound:
int verify_flash(struct flashctx *flash, uint8_t *buf) { - int ret; unsigned int total_size = flash->total_size * 1024; + int ret = 0; + romlayout_t *l;
- msg_cinfo("Verifying flash... "); - - ret = verify_range(flash, buf, 0, total_size, NULL); + msg_cinfo("Verifying... ");
- if (!ret) - msg_cinfo("VERIFIED. \n"); + l = get_next_included_romentry(0); + /* No included rom entries. Assume complete verify wanted. */ + if (l == NULL) + ret = verify_range(flash, buf, 0, total_size, NULL); + else do { + unsigned int len = l->end - l->start + 1; + msg_gdbg2("Verifying "%s" 0x%08x - 0x%08x (%uB)... ", l->name, + l->start, l->end, len); + if(verify_range(flash, buf + l->start, l->start, len, NULL)) { + return 1; + } + msg_gdbg2("done. "); + l = get_next_included_romentry(l->end + 1); + } while (l != NULL);
+ if (ret == 0) + msg_cinfo("VERIFIED.\n"); return ret; }