[U-Boot] [U-Boot, v2] Enable expression support for CONFIG_BOARD_SIZE_LIMIT

Tom Rini trini at konsulko.com
Fri Mar 8 19:55:45 UTC 2019


On Fri, Mar 08, 2019 at 06:53:28PM +0100, Philipp Tomsich wrote:
> 
> 
> > On 08.03.2019, at 18:28, Martin Husemann <martin at NetBSD.org> wrote:
> > 
> > On Fri, Mar 08, 2019 at 12:17:09PM -0500, Tom Rini wrote:
> >> OK, so a few thoughts here.
> >> - What's the portable way to do hex-based math?  If we really need it?
> > 
> > Use printf(3) to convert to/from hex, and standard shell arithmetic
> > with $(( )).
> > 
> > Looks horrible, but something like:
> > 
> > v=$(( $( printf "%d\n" 0xa0 ) + $( printf "%d\n" 0x10 ) ))
> > printf "v = %d (%x)\n" $v $v
> 
> Can we just assume that awk is available?  After all, AWK is defined
> in the top-level Makefile...

No, we can't exactly.  In sum, gawk and mawk behave differently and mawk
doesn't do hex and yes, we run into that in the wild.  Whatever we do
here needs to be POSIX shell happy (or something more strict than that?)
as it needs to work on macOS and Free/Net/OpenBSD and anything else that
we can otherwise be building on.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190308/9587c88d/attachment.sig>


More information about the U-Boot mailing list