[U-Boot] [PATCH 3/4] ARM: tegra: check for SPL size overflow in makefile
Stephen Warren
swarren at wwwdotorg.org
Thu Oct 18 05:18:58 CEST 2012
On 10/17/2012 06:03 PM, Simon Glass wrote:
> 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.
>> diff --git a/Makefile b/Makefile
>> $(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?
Yes, the reason I used $(( )) around the value is because it was hex, so
I needed to convert it to an integer for -gt.
More information about the U-Boot
mailing list