[U-Boot] [PATCH v2] common: Fix load and entry addresses in FIT image

Simon Glass sjg at chromium.org
Fri Sep 4 16:35:35 CEST 2015


Hi York,

On 4 September 2015 at 08:33, York Sun <yorksun at freescale.com> wrote:
>
>
> On 09/04/2015 09:12 AM, Simon Glass wrote:
>> Hi York,
>>
>> On 4 September 2015 at 07:59, York Sun <yorksun at freescale.com> wrote:
>>>
>>>
>>> On 09/03/2015 10:55 PM, Simon Glass wrote:
> <snip>
>
>>>> Yes of course %pa does not work on the host - I didn't think of that.
>>>>
>>>> I'm still not thrilled with everything being promoted to 64-bit. Do
>>>> you think using a #define in inttypes.h or similar might work, similar
>>>> to how LBAF works in ide.h?
>>>>
>>>> #if BITS_PER_LONG == 64
>>>> #define PRIpa "%08l"
>>>> #else
>>>> #define PRIpa "%08l"
>>>> #endif
>>>>
>>>> The odd thing is that they are both the same for ARM (unsigned long).
>>>> What arch are you using?
>>>
>>> This one works for me
>>>
>>> #if BITS_PER_LONG == 64
>>> #define PRIpa  "lx"
>>> #else
>>> #define PRIpa  "llx"
>>> #endif
>>>
>>> The trick here is host tool. I was testing on armv8.
>>
>> I'm hoping that we can use a 32-bit parameter for 32-bit machines and
>> 64-bit for 64-bit machines (and host).
>>
>
> I see what you mean. We can use 32-bit parameters for 32-bit targets, and 64-bit
> for 64-bit targets. "%08lx" takes care of that. However, the host may have
> 32-bit or 64-bit, which has nothing to do with the "#address-cell" or load/entry
> address in the image. mkimage should be able to deal with them all the time.
> That's why I use "unsigned long long" for the host.
>
> I think this works
>
> #ifdef USE_HOSTCC
> #define PRIpa "%08llx"
> #else
> #define PRIpa "%08lx"
> #endif

Seems like it, yes.

Regards,
Simon


More information about the U-Boot mailing list