[U-Boot] [RFC/PATCH] Makefile: allow boards to check file size limits

Mike Frysinger vapier at gentoo.org
Tue Oct 19 06:17:51 CEST 2010


On Monday, October 18, 2010 16:43:37 Wolfgang Denk wrote:
> Mike Frysinger wrote:
> > +ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
> > +BOARD_SIZE_CHECK = \
> > +	@actual=`wc -c $@ | awk '{print $$1}'`; \
> 
> How about using
> 
> 	stat -c '%s'
> 
> to get the file size in a single command, without need to actually
> read all the data?

because `stat` isnt portable :(.  it isnt part of the POSIX standard ... OS X 
certainly does not support this, and i imagine most *BSD's dont.

`wc -c` on the other hand should work everywhere and is part of POSIX.  
looking at the `strace` output, the GNU wc doesnt actually read() the file 
when using just the -c option.  seems to use lseek(SEEK_END).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101019/1ecdb70b/attachment.pgp 


More information about the U-Boot mailing list