From a6c337dec0837135949cc3927a77b07290e1d2cb Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 3 Feb 2010 17:56:37 +0000 Subject: Guards against errors that are hard to track down: - if crt0s is empty (eg. because crt0-y is still used), break the build, and say where that behaviour changed - if a stage is unusable for cbfstool because it's placed outside the ROM space (linked to 0 is somewhat notorious), warn about it, give some hints and exit instead of crashing. Signed-off-by: Patrick Georgi Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5077 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/arch/i386/Makefile.inc | 4 ++++ util/cbfstool/cbfs-mkstage.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/arch/i386/Makefile.inc b/src/arch/i386/Makefile.inc index 05f7894..5f7bab6 100644 --- a/src/arch/i386/Makefile.inc +++ b/src/arch/i386/Makefile.inc @@ -62,6 +62,10 @@ $(obj)/coreboot.a: $(objs) ####################################################################### # done +# crt0s should be set by now +ifeq ($(crt0s),) +$(error crt0s are empty. If your board still uses crt0-y and ldscript-y: It shouldn't, we moved away from that in r5065) +endif endif ifeq ($(CONFIG_TINY_BOOTBLOCK),y) diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c index 6e8daef..2f81da0 100644 --- a/util/cbfstool/cbfs-mkstage.c +++ b/util/cbfstool/cbfs-mkstage.c @@ -126,6 +126,11 @@ int parse_elf_to_stage(unsigned char *input, unsigned char **output, data_start = *location; } + if (data_end <= data_start) { + fprintf(stderr, "E: data ends before it starts. Make sure the ELF file is correct and resides in ROM space.\n"); + exit(1); + } + /* allocate an intermediate buffer for the data */ buffer = calloc(data_end - data_start, 1); -- cgit v1.1