[coreboot-gerrit] New patch to review for coreboot: 9155cdf cbfstool fix for old images

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Tue Jan 21 21:09:33 CET 2014


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4771

-gerrit

commit 9155cdff373d30059f80be4d751171608ea1b002
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Tue Jan 21 14:03:52 2014 -0600

    cbfstool fix for old images
    
    Change-Id: I4918d2e0b930b72dd40c07b9c9d246b70db148b9
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 util/cbfstool/cbfs_image.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index eb9d574..52727ef 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -748,8 +748,15 @@ struct cbfs_header *cbfs_find_header(char *data, size_t size)
 struct cbfs_file *cbfs_find_first_entry(struct cbfs_image *image)
 {
 	assert(image && image->header);
-	return (struct cbfs_file *)(image->buffer.data +
+	if (ntohl(image->header->offset) == 0)  {
+		if (image->buffer.size > ntohl(image->header->romsize)) {
+			return (struct  cbfs_file *)(image->buffer.data + image->buffer.size - ntohl(image->header->romsize + ntohl(image->header->offset)));
+		}
+	} else {
+		return (struct cbfs_file *)(image->buffer.data +
 				   ntohl(image->header->offset));
+	}
+	return NULL;
 }
 
 struct cbfs_file *cbfs_find_next_entry(struct cbfs_image *image,



More information about the coreboot-gerrit mailing list