From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Wed, 17 Oct 2012 21:18:58 -0600 Subject: [U-Boot] [PATCH 3/4] ARM: tegra: check for SPL size overflow in makefile In-Reply-To: References: <1350424209-11186-1-git-send-email-swarren@wwwdotorg.org> <1350424209-11186-3-git-send-email-swarren@wwwdotorg.org> Message-ID: <507F7522.5040901@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/17/2012 06:03 PM, Simon Glass wrote: > Hi Stephen, > > On Tue, Oct 16, 2012 at 2:50 PM, Stephen Warren wrote: >> From: Stephen Warren >> >> 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.