Exit building if romstage.bin is larger than size of XIP
authorzbao <fishbaozi@gmail.com>
Fri, 17 Feb 2012 13:44:09 +0000 (21:44 +0800)
committerMarc Jones <marcj303@gmail.com>
Fri, 17 Feb 2012 16:45:23 +0000 (17:45 +0100)
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
cause.

Change-Id: I5be2a46a8b57934f14c5a0d4596f3bec4251e0aa
Signed-off-by: Zheng Bao <zheng.bao@amd.com>
Signed-off-by: zbao <fishbaozi@gmail.com>
Reviewed-on: http://review.coreboot.org/650
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marcj303@gmail.com>
src/arch/x86/Makefile.inc
util/cbfstool/cbfstool.c

index c9cbb01b4a77ea9fdd9ebf2df88f3b65d872cfef..624b5104d0d962d8719bfd2c967a6487238f6520 100755 (executable)
@@ -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)
index b8abb515bf42cdddcb3dbb9a2f7b49c9958468ac..939221e66d61133d372594a7da65f3ab7382e156 100644 (file)
@@ -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)