diff mbox

[U-Boot,v2] Makefile: use $(shell ...) for determining file_size

Message ID 1406162665-10345-1-git-send-email-judge.packham@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Chris Packham July 24, 2014, 12:44 a.m. UTC
file_size was being calculated using back-ticks but map_size uses
$(shell ...). Update the file_size calculation to use $(shell ...).

From: Jeroen Hofstee <jeroen@myspectrum.nl>

The binary_size_check target relies on stat -c %s
to return the size of u-boot.bin. This only works
with GNU stat though. Use wc instead.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
The back ticks didn't work in my environment (GNU Make 3.81). Updating
to use $(shell ...) makes sense from a consistency view even if the
problem is my environment.

Changes in v2:
- Restore the missing @ that was unintentionally removed in v1
- Incorporate Jeroen's change http://patchwork.ozlabs.org/patch/371936/

 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass July 25, 2014, 2:28 p.m. UTC | #1
On 24 July 2014 01:44, Chris Packham <judge.packham@gmail.com> wrote:
> file_size was being calculated using back-ticks but map_size uses
> $(shell ...). Update the file_size calculation to use $(shell ...).
>
> From: Jeroen Hofstee <jeroen@myspectrum.nl>
>
> The binary_size_check target relies on stat -c %s
> to return the size of u-boot.bin. This only works
> with GNU stat though. Use wc instead.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>

Thanks for joining these.

Acked-by: Simon Glass <sjg@chromium.org>
Tom Rini Aug. 10, 2014, 10:21 p.m. UTC | #2
On Thu, Jul 24, 2014 at 12:44:25PM +1200, Chris Packham wrote:

> file_size was being calculated using back-ticks but map_size uses
> $(shell ...). Update the file_size calculation to use $(shell ...).
> 
> From: Jeroen Hofstee <jeroen@myspectrum.nl>
> 
> The binary_size_check target relies on stat -c %s
> to return the size of u-boot.bin. This only works
> with GNU stat though. Use wc instead.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/Makefile b/Makefile
index ca212b5..b98a80a 100644
--- a/Makefile
+++ b/Makefile
@@ -786,7 +786,7 @@  u-boot.hex u-boot.srec: u-boot FORCE
 OBJCOPYFLAGS_u-boot.bin := -O binary
 
 binary_size_check: u-boot.bin System.map FORCE
-	@file_size=`stat -c %s u-boot.bin` ; \
+	@file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat System.map | \
 		awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
 		| bc); \