[flashrom] [PATCH 4/5] Use layout for verify operations too

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Sun Dec 25 17:56:07 CET 2011


---
this still reads the whole image in...

Signed-off-by: Stefan Tauner <stefan.tauner at 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;
 }
 
-- 
1.7.1





More information about the flashrom mailing list