Patchwork [U-Boot] Allow CONFIG_BOARD_SIZE_LIMIT to be specified in hex

login
register
mail settings
Submitter Joe Hershberger
Date Nov. 8, 2012, 8:19 p.m.
Message ID <1352405949-693-1-git-send-email-joe.hershberger@ni.com>
Download mbox | patch
Permalink /patch/197878/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Joe Hershberger - Nov. 8, 2012, 8:19 p.m.
Use the printf command to convert the number in any valid format into
the expected decimal format.  The resulting errors should be printed to
stderr.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Tom Rini - Dec. 7, 2012, 3:49 p.m.
On Thu, Nov 08, 2012 at 10:19:09AM -0000, Joe Hershberger wrote:

> Use the printf command to convert the number in any valid format into
> the expected decimal format.  The resulting errors should be printed to
> stderr.
> 
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Applied to u-boot/master, thanks!

Patch

diff --git a/Makefile b/Makefile
index 2fe1490..41e3e43 100644
--- a/Makefile
+++ b/Makefile
@@ -386,12 +386,12 @@  __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
 BOARD_SIZE_CHECK = \
 	@actual=`wc -c $@ | awk '{print $$1}'`; \
-	limit=$(CONFIG_BOARD_SIZE_LIMIT); \
+	limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
 	if test $$actual -gt $$limit; then \
-		echo "$@ exceeds file size limit:"; \
-		echo "  limit:  $$limit bytes"; \
-		echo "  actual: $$actual bytes"; \
-		echo "  excess: $$((actual - limit)) bytes"; \
+		echo "$@ exceeds file size limit:" >&2 ; \
+		echo "  limit:  $$limit bytes" >&2 ; \
+		echo "  actual: $$actual bytes" >&2 ; \
+		echo "  excess: $$((actual - limit)) bytes" >&2; \
 		exit 1; \
 	fi
 else