summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2013-02-06 12:41:49 +0800
committerDavid Hendricks <dhendrix@chromium.org>2013-02-06 10:53:19 +0100
commitc5ff6487e65294aac4dccbf6b2a56ac518f982e2 (patch)
tree970437091085bb0261e5d97908011f5d544e9fd1 /util/cbfstool
parent966e2dbb6537e9368514dfb3dfba24a8345c49bf (diff)
downloadcoreboot-c5ff6487e65294aac4dccbf6b2a56ac518f982e2.tar.xz
armv7: Prevent CBFS data overlapping bootblock.
For arm/snow, current bootblock is larger than previously assigned CBFS offset and will fail to boot. To prevent this happening again in future, cbfstool now checks if CBFS will overlap bootblock. A sample error message: E: Bootblock (0x0+0x71d4) overlap CBFS data (0x5000) E: Failed to create build/coreboot.pre1.tmp. arm/snow offset is also enlarged and moved to Kconfig variable. Change-Id: I4556aef27ff716556040312ae8ccb78078abc82d Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: http://review.coreboot.org/2295 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/cbfs_image.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index b7c6ee5af8..5c2ac260f9 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -174,6 +174,12 @@ int cbfs_image_create(struct cbfs_image *image,
bootblock_offset, bootblock->size, size);
return -1;
}
+ if (entries_offset > bootblock_offset &&
+ entries_offset < bootblock->size) {
+ ERROR("Bootblock (0x%x+0x%zx) overlap CBFS data (0x%x)\n",
+ bootblock_offset, bootblock->size, entries_offset);
+ return -1;
+ }
memcpy(image->buffer.data + bootblock_offset, bootblock->data,
bootblock->size);