From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] Inconsistency between $filesize and commands which accept numeric params.
Date: Thu, 30 Oct 2014 15:32:58 +0000 [thread overview]
Message-ID: <1414683178.2064.51.camel@hellion.org.uk> (raw)
In-Reply-To: <20141030152146.356D83809B0@gemini.denx.de>
On Thu, 2014-10-30 at 16:21 +0100, Wolfgang Denk wrote:
> Dear Ian,
>
> In message <1414677435.2064.34.camel@hellion.org.uk> you wrote:
> > It seems there is some inconsistency wrt number base between commands
> > which set $filesize in the env and the commands which might consume
> > them.
>
> That would be bugs, then.
>
> >
> > sun7i# load scsi 0 $fdt_addr_r dtbs/$fdtfile
> > 21639 bytes read in 191 ms (110.4 KiB/s)
> > sun7i# printenv filesize
> > filesize=5487
> >
> > So filesize is in hex, but without an 0x prefix. But:
>
> This is normal. U-Boot uses hex input base by default. All commands
> should take hex input; the only inglorious exception is the "sleep"
> command which takes decimal; numbers as arguments.
>
> > sun7i# fdt addr $fdt_addr_r 0x10000
> > sun7i# fdt set /chosen foo <$filesize>
> > sun7i# fdt print /chosen foo
> > foo = <0x0000156f>
> >
> > IOW the parameter to fdt set has been interpreted as a decimal.
>
> That's a bug.
>
> > So I'm not sure if the bug is that setenv_hex doesn't include the 0x, or
>
> No 0x prefix should be needed anywhere.
>
> > that fdt set interprets things as decimal by default instead of hex. Or
> > maybe there is no bug at all?
>
> The bug is in fdt set, then.
>
>
> Thanks for pointing out!
Thanks for pointing me in the right direction. CCing the folks who
get_maintainers.pl tells me might be involved with common/cmd_fdt.c
Looks like the function which does this is fdt_parse_prop, which is
documented with:
/*
* Parse the user's input, partially heuristic. Valid formats:
* <0x00112233 4 05> - an array of cells. Numbers follow standard
* C conventions.
* [00 11 22 .. nn] - byte stream
* "string" - If the the value doesn't start with "<" or "[", it is
* treated as a string. Note that the quotes are
* stripped by the parser before we get the string.
which is inconsistent with the "U-Boot uses hex input base by default"
mantra.
Ian.
next prev parent reply other threads:[~2014-10-30 15:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 13:57 [U-Boot] Inconsistency between $filesize and commands which accept numeric params Ian Campbell
2014-10-30 15:21 ` Wolfgang Denk
2014-10-30 15:32 ` Ian Campbell [this message]
2014-11-04 15:44 ` Tom Rini
2014-11-04 15:48 ` Ian Campbell
2014-11-04 20:53 ` Wolfgang Denk
2014-11-04 20:58 ` Tom Rini
2014-11-04 21:20 ` Wolfgang Denk
2014-11-04 22:02 ` Tom Rini
2014-11-04 22:11 ` Wolfgang Denk
2014-11-04 22:54 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414683178.2064.51.camel@hellion.org.uk \
--to=ijc@hellion.org.uk \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox