From: William Cohen <wcohen@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Gracefully handle 64-bit Load Address and Entry Point Address mkimage parameters
Date: Tue, 16 Feb 2016 08:56:22 -0500 [thread overview]
Message-ID: <56C32A86.4040204@redhat.com> (raw)
In-Reply-To: <20160215113411.700693811B2@gemini.denx.de>
On 02/15/2016 06:34 AM, Wolfgang Denk wrote:
> Dear William,
>
> In message <1455506732-22307-1-git-send-email-wcohen@redhat.com> you wrote:
>>
>> Recent MIPS Linux kernels are using a 64-bit value for the load
>> address (0xffffffff80010000) for the Creator CI20 board kernel. When
>> this argument was passed to the mkimage program running on a 32-bit
>> machine such as the Creator CI20 board the load address was
>> incorrectly obtained from the first half of the argument, 0xffffffff
>> by the strtoul. The mkimage should be able to tolerate the longer,
>> 64-bit signed version of the arguments with the use of strtoull.
>
> Hm... I think we have multiple problems here.
Hi,
The write up in the patch wasn't as clear as it should have been. I
have revised the patch to try to make the reason for this patch
clearer. The MIP Linux kernel is using sign-extending 32-bit values
to 64-bit values, so the truncation of the strtoll values to 32-bits
is actually desired. The revised patch now passes the linux kernel
checkpatch.pl checks. I will be resending the patch in a moment.
-Will
>
> First, the old legacy uImage header usersd 32 bit data types for the
> addresses. This is a binary data structure, and there is no way to
> extend it for 64 bit addresses without breaking compatibility.
>
>
>> - params.addr = strtoul (*++argv, &ptr, 16);
>> + params.addr = strtoull (*++argv, &ptr, 16);
>
> I don't see what you win here... strtoull() returns unsigned long long,
> but params.addr is an unsigned int, so the value will be truncated to
> 32 bit. Are you sure this is what you want?
>
>> fprintf (stderr,
>> "%s: invalid load address %s\n",
>> @@ -146,7 +146,7 @@ int main(int argc, char **argv)
>> case 'e':
>> if (--argc <= 0)
>> usage ();
>> - params.ep = strtoul (*++argv, &ptr, 16);
>> + params.ep = strtoull (*++argv, &ptr, 16);
>
> Ditto...
>
>
> Also please note that your patch triggers a number of checkpatch
> warnings and an error, especially:
>
> WARNING: space prohibited between function name and open parenthesis '('
> #108: FILE: tools/mkimage.c:132:
> + params.addr = strtoull (*++argv, &ptr, 16);
>
> WARNING: space prohibited between function name and open parenthesis '('
> #117: FILE: tools/mkimage.c:149:
> + params.ep = strtoull (*++argv, &ptr, 16);
>
> ERROR: Missing Signed-off-by: line(s)
>
>
> Best regards,
>
> Wolfgang Denk
>
prev parent reply other threads:[~2016-02-16 13:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 3:25 [U-Boot] [PATCH] Gracefully handle 64-bit Load Address and Entry Point Address mkimage parameters William Cohen
2016-02-15 11:34 ` Wolfgang Denk
2016-02-16 13:56 ` William Cohen [this message]
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=56C32A86.4040204@redhat.com \
--to=wcohen@redhat.com \
--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