[U-Boot] [PATCH 3/4] ARM: tegra: check for SPL size overflow in makefile
Simon Glass
sjg at chromium.org
Thu Oct 18 02:03:50 CEST 2012
Hi Stephen,
On Tue, Oct 16, 2012 at 2:50 PM, Stephen Warren <swarren at wwwdotorg.org> wrote:
> From: Stephen Warren <swarren at nvidia.com>
>
> If the SPL extends beyond CONFIG_SYS_TEXT_BASE, then it will likely
> corrupt the main U-Boot binary during execution, causing the main U-Boot
> binary to fail. Check for this situation during the build to avoid
> extremely annoying and hard-to-find bugs. Note that checking the size of
> u-boot-spl.bin is not enough, since BSS size doesn't affect the size of
> u-boot-spl.bin.
>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
> Makefile | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 425adf4..2c2d8b6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -522,6 +522,11 @@ dtbfile=
> endif
>
> $(obj)u-boot-$(nodtb)-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(dtbfile)
> + ebss=`${CROSS_COMPILE}objdump -t spl/u-boot-spl|awk '/__bss_end__/ {print "0x"$$1}'` ; \
> + if [ $$(($$ebss)) -gt $$(($(CONFIG_SYS_TEXT_BASE))) ]; then \
> + echo ERROR: SPL BSS ends beyond CONFIG_SYS_TEXT_BASE > /dev/stderr; \
> + exit 1; \
> + fi
Just wanted to check that this works ok for hex values?
> $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
> cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(dtbfile) > $@
> rm $(obj)spl/u-boot-spl-pad.bin
> --
> 1.7.0.4
>
Regards,
Simon
More information about the U-Boot
mailing list