[coreboot] Patch set updated for coreboot: 10daacf Exit building if romstage.bin is larger than size of XIP

Zheng Bao (zheng.bao@amd.com) gerrit at coreboot.org
Fri Feb 17 13:43:52 CET 2012

Zheng Bao (zheng.bao at amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/650


commit 10daacf118096519aeac961c1814f790cbf66d0e
Author: zbao <fishbaozi at gmail.com>
Date:   Fri Feb 17 21:44:09 2012 +0800

    Exit building if romstage.bin is larger than size of XIP
    When the romstage.bin becomes bigger than the size of XIP, the
    cbfstool can not allocate the romstage in the CBFS. But it doesn't
    report an error. It will take quite a while to find out the root
    Change-Id: I5be2a46a8b57934f14c5a0d4596f3bec4251e0aa
    Signed-off-by: Zheng Bao <zheng.bao at amd.com>
    Signed-off-by: zbao <fishbaozi at gmail.com>
 src/arch/x86/Makefile.inc |    2 +-
 util/cbfstool/cbfstool.c  |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index c9cbb01..624b510 100755
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -346,7 +346,7 @@ $(obj)/coreboot.romstage: $(obj)/coreboot.pre1 $$(romstage-objs) $(obj)/romstage
 	$(CC) -nostdlib -nostartfiles -static -o $(obj)/romstage.elf -L$(obj) -T $(obj)/romstage/ldscript.ld $(romstage-objs)
 	$(OBJCOPY) -O binary $(obj)/romstage.elf $(obj)/romstage.bin
 	printf "CONFIG_ROMBASE = 0x" > $(obj)/location.ld
-	$(CBFSTOOL) $(obj)/coreboot.pre1 locate $(obj)/romstage.bin $(CONFIG_CBFS_PREFIX)/romstage $(CONFIG_XIP_ROM_SIZE) > $(obj)/location.txt
+	$(CBFSTOOL) $(obj)/coreboot.pre1 locate $(obj)/romstage.bin $(CONFIG_CBFS_PREFIX)/romstage $(CONFIG_XIP_ROM_SIZE) > $(obj)/location.txt || { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; }
 	cat $(obj)/location.txt >> $(obj)/location.ld
 	printf ';\n' >> $(obj)/location.ld
 	$(CC) -nostdlib -nostartfiles -static -o $(obj)/romstage.elf -L$(obj) -T $(obj)/romstage/ldscript.ld $(romstage-objs)
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index b8abb51..939221e 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -232,9 +232,10 @@ static int cbfs_locate(int argc, char **argv)
 	uint32_t filesize = getfilesize(file);
 	const char *filename = argv[4];
 	int align = strtoul(argv[5], NULL, 0);
+	uint32_t location = cbfs_find_location(romname, filesize, filename, align);
-	printf("%x\n", cbfs_find_location(romname, filesize, filename, align));
-	return 0;
+	printf("%x\n", location);
+	return location == 0 ? 1 : 0;
 static int cbfs_print(int argc, char **argv)

More information about the coreboot mailing list