summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2012-02-17 16:04:29 -0800
committerGerrit <chrome-bot@google.com>2012-02-21 10:09:09 -0800
commit77fbe691f3b1607acfb6f84e978f73ad4fd5d6a0 (patch)
tree47d8ff2f7c1ab14331682c31f9f094364150f272
parentab3e59d66417919efd0e213757254a7c295e6c5a (diff)
Fix vbexport_test display
It turns out that running 'vbexport_test display' on coreboot platforms fails to display bitmap images, sometimes reporting memory corruption and rebooting the system. The problem was twofold: - the gbb pointer is not properly initialized (as it is supposed to when CONFIG_HARDWARE_MAPPED_SPI is defined). - the bitmap images block includes an element which in fact is not a bitmap. When scanning the block, the test tried displaying all elements, generating an error when this one-off element is encountered. This change fixes both issues. BUG=chromium-os:26586 TEST=manual . build a new chromeos-bootimage . reboot the system stopping it in u-boot console dialogue . run `vbexport_test display' command from the console The test was failing before this change, it is passing now. Change-Id: Iee9491d150b9ce5513f7446ab4df806d23e6d4d8 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/16206 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--common/cmd_vbexport_test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/common/cmd_vbexport_test.c b/common/cmd_vbexport_test.c
index cf7b9f95ac..1c3efb2694 100644
--- a/common/cmd_vbexport_test.c
+++ b/common/cmd_vbexport_test.c
@@ -423,6 +423,10 @@ static uint8_t *read_gbb_from_firmware(void)
return NULL;
}
+#ifdef CONFIG_HARDWARE_MAPPED_SPI
+ gbb = (void *) (fmap.readonly.gbb.offset + fmap.flash_base);
+#endif
+
if (gbb_init(gbb, &file, fmap.readonly.gbb.offset, gbb_size)) {
VbExDebug("Failed to read GBB!\n");
return NULL;
@@ -449,6 +453,14 @@ static int show_images_and_delay(BmpBlockHeader *bmph, int index)
void *rawimg;
uint32_t inoutsize;
+ if (memcmp(bmph->signature,
+ BMPBLOCK_SIGNATURE,
+ sizeof(bmph->signature))) {
+ VbExDebug("%s: corrupted BMP block header at %p\n",
+ __func__, bmph);
+ return 1;
+ }
+
screen = (ScreenLayout *)(bmph + 1);
screen += index;
@@ -457,6 +469,10 @@ static int show_images_and_delay(BmpBlockHeader *bmph, int index)
i++) {
info = (ImageInfo *)((uint8_t *)bmph +
screen->images[i].image_info_offset);
+
+ if (info->format != FORMAT_BMP)
+ continue;
+
inoutsize = info->original_size;
if (COMPRESS_NONE == info->compression) {