diff mbox

[U-Boot,v2] Makefile: fix binary_size_check target

Message ID 1406145549-21773-1-git-send-email-jeroen@myspectrum.nl
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Jeroen Hofstee July 23, 2014, 7:59 p.m. UTC
first issue replace stat -c %s with wc:
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.

Second issue as reported by chris Packham:
file_size was being calculated using back-ticks but map_size uses
$(shell ...). Update the file_size calculation to use $(shell ...).

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
Chris Packham:
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 since v1:
use $(shell ...) as submitted by Chris Packham
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index ca212b5..1156133 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); \