* [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation
@ 2014-10-22 6:39 Ye.Li
2014-10-22 7:22 ` Stefano Babic
0 siblings, 1 reply; 6+ messages in thread
From: Ye.Li @ 2014-10-22 6:39 UTC (permalink / raw)
To: u-boot
The bootdata.size should contain the IVT offset part, but the calculation
in imximage tool does not have. This will cause some data at
the end of image not be loaded into memory.
Signed-off-by: Ye.Li <B37916@freescale.com>
---
tools/imximage.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/imximage.c b/tools/imximage.c
index faba238..526b7d4 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -587,7 +587,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
*
* The remaining fraction of a block bytes would not be loaded!
*/
- *header_size_ptr = ROUND(sbuf->st_size, 4096);
+ *header_size_ptr = ROUND((sbuf->st_size + imximage_ivt_offset), 4096);
if (csf_ptr && imximage_csf_size) {
*csf_ptr = params->ep - imximage_init_loadsize +
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation
2014-10-22 6:39 [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation Ye.Li
@ 2014-10-22 7:22 ` Stefano Babic
2014-10-22 7:38 ` Li Ye-B37916
0 siblings, 1 reply; 6+ messages in thread
From: Stefano Babic @ 2014-10-22 7:22 UTC (permalink / raw)
To: u-boot
Hi Ye,
On 22/10/2014 08:39, Ye.Li wrote:
> The bootdata.size should contain the IVT offset part, but the calculation
> in imximage tool does not have. This will cause some data at
> the end of image not be loaded into memory.
>
> Signed-off-by: Ye.Li <B37916@freescale.com>
> ---
> tools/imximage.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/imximage.c b/tools/imximage.c
> index faba238..526b7d4 100644
> --- a/tools/imximage.c
> +++ b/tools/imximage.c
> @@ -587,7 +587,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
> *
> * The remaining fraction of a block bytes would not be loaded!
> */
> - *header_size_ptr = ROUND(sbuf->st_size, 4096);
> + *header_size_ptr = ROUND((sbuf->st_size + imximage_ivt_offset), 4096);
>
Can you help me pointing which part of the manual(s) is describing this
? Checking into i.MX6Q, length is defined as size of the program image,
that means without IVT. I have not yet checked into MX53.
Which is the use case you find the error ? Do you had a size of exactly
a multiple of 4K and have you discover that the whole image was not loaded ?
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation
2014-10-22 7:22 ` Stefano Babic
@ 2014-10-22 7:38 ` Li Ye-B37916
2014-10-22 8:14 ` Stefano Babic
2014-10-22 16:52 ` Fabio Estevam
0 siblings, 2 replies; 6+ messages in thread
From: Li Ye-B37916 @ 2014-10-22 7:38 UTC (permalink / raw)
To: u-boot
Hi Stefano,
On 10/22/2014 3:22 PM, Stefano Babic wrote:
> Hi Ye,
>
> On 22/10/2014 08:39, Ye.Li wrote:
>> The bootdata.size should contain the IVT offset part, but the calculation
>> in imximage tool does not have. This will cause some data at
>> the end of image not be loaded into memory.
>>
>> Signed-off-by: Ye.Li <B37916@freescale.com>
>> ---
>> tools/imximage.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/tools/imximage.c b/tools/imximage.c
>> index faba238..526b7d4 100644
>> --- a/tools/imximage.c
>> +++ b/tools/imximage.c
>> @@ -587,7 +587,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
>> *
>> * The remaining fraction of a block bytes would not be loaded!
>> */
>> - *header_size_ptr = ROUND(sbuf->st_size, 4096);
>> + *header_size_ptr = ROUND((sbuf->st_size + imximage_ivt_offset), 4096);
>>
> Can you help me pointing which part of the manual(s) is describing this
> ? Checking into i.MX6Q, length is defined as size of the program image,
> that means without IVT. I have not yet checked into MX53.
>
> Which is the use case you find the error ? Do you had a size of exactly
> a multiple of 4K and have you discover that the whole image was not loaded ?
>
> Best regards,
> Stefano Babic
>
>
You can look into the "Figure 8-21. Image Vector Table" in the system boot chapter of i.MX6Q manual. The bootdata.start points
to the beginning of the destination memory, which means the bootdata.size should have IVT offset included. We also have checked
the boot rom codes for this.
We found this issue when booting from QSPI NOR on i.MX6SX. The u-boot runs into abnormal (crash or stop) after booting. We checked the
destination memory where the image is loaded to, and found hundreds of bytes at the image end are not loaded into memory. Since there
is a 4096 bytes round in the calculation, so the image size decides if the issue can be reproduced. It is not easy to see the issue by SD boot.
Best regards,
Ye Li
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation
2014-10-22 7:38 ` Li Ye-B37916
@ 2014-10-22 8:14 ` Stefano Babic
2014-10-22 8:32 ` Li Ye-B37916
2014-10-22 16:52 ` Fabio Estevam
1 sibling, 1 reply; 6+ messages in thread
From: Stefano Babic @ 2014-10-22 8:14 UTC (permalink / raw)
To: u-boot
Hi Ye,
On 22/10/2014 09:38, Li Ye-B37916 wrote:
> You can look into the "Figure 8-21. Image Vector Table" in the system boot chapter of i.MX6Q manual. The bootdata.start points
> to the beginning of the destination memory, which means the bootdata.size should have IVT offset included.
Well, ok, this is an interpretation....
> We also have checked
> the boot rom codes for this.
ok - this is the most important thing. Is it the same for all MX6 and
MX53 ?
>
> We found this issue when booting from QSPI NOR on i.MX6SX. The u-boot runs into abnormal (crash or stop) after booting. We checked the
> destination memory where the image is loaded to, and found hundreds of bytes at the image end are not loaded into memory. Since there
> is a 4096 bytes round in the calculation, so the image size decides if the issue can be reproduced. It is not easy to see the issue by SD boot.
ok - the only thing that it looks weird is that the issue happens now
and not with a MX6Q(D) booting from SPI-NOR. There are several boards
booting from SPI, but I have not heard about such as problems.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation
2014-10-22 8:14 ` Stefano Babic
@ 2014-10-22 8:32 ` Li Ye-B37916
0 siblings, 0 replies; 6+ messages in thread
From: Li Ye-B37916 @ 2014-10-22 8:32 UTC (permalink / raw)
To: u-boot
Hi Stefano,
On 10/22/2014 4:14 PM, Stefano Babic wrote:
> Hi Ye,
>
> On 22/10/2014 09:38, Li Ye-B37916 wrote:
>
>> You can look into the "Figure 8-21. Image Vector Table" in the system boot chapter of i.MX6Q manual. The bootdata.start points
>> to the beginning of the destination memory, which means the bootdata.size should have IVT offset included.
> Well, ok, this is an interpretation....
>
>> We also have checked
>> the boot rom codes for this.
> ok - this is the most important thing. Is it the same for all MX6 and
> MX53 ?
Yes. This is same for all MX6 and MX53.
>
>> We found this issue when booting from QSPI NOR on i.MX6SX. The u-boot runs into abnormal (crash or stop) after booting. We checked the
>> destination memory where the image is loaded to, and found hundreds of bytes at the image end are not loaded into memory. Since there
>> is a 4096 bytes round in the calculation, so the image size decides if the issue can be reproduced. It is not easy to see the issue by SD boot.
> ok - the only thing that it looks weird is that the issue happens now
> and not with a MX6Q(D) booting from SPI-NOR. There are several boards
> booting from SPI, but I have not heard about such as problems.
>
> Best regards,
> Stefano Babic
>
>
There are some reasons:
1. The SPI-NOR IVT offset is 0x400, but QSPI-NOR IVT offset is 0x1000. Because of the 0x1000 round, the possibility of showing the issue on SPI-NOR is less than QSPI-NOR. Even for QSPI-NOR, we only
reproduce it on some image with particular size .
2. The IVT_offset was once included in the calculation before this patch "2013-08-31 Stefano Babic tools: imx_header should not include flash_offset".
3. At the end of the image, most of data are zero.
Best regards,
Ye Li
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation
2014-10-22 7:38 ` Li Ye-B37916
2014-10-22 8:14 ` Stefano Babic
@ 2014-10-22 16:52 ` Fabio Estevam
1 sibling, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2014-10-22 16:52 UTC (permalink / raw)
To: u-boot
Hi Ye Li,
On Wed, Oct 22, 2014 at 5:38 AM, Li Ye-B37916 <b37916@freescale.com> wrote:
> You can look into the "Figure 8-21. Image Vector Table" in the system boot chapter of i.MX6Q manual. The bootdata.start points
> to the beginning of the destination memory, which means the bootdata.size should have IVT offset included. We also have checked
> the boot rom codes for this.
>
> We found this issue when booting from QSPI NOR on i.MX6SX. The u-boot runs into abnormal (crash or stop) after booting. We checked the
> destination memory where the image is loaded to, and found hundreds of bytes at the image end are not loaded into memory. Since there
> is a 4096 bytes round in the calculation, so the image size decides if the issue can be reproduced. It is not easy to see the issue by SD boot.
This explanation should be part of the commit log.
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-22 16:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22 6:39 [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation Ye.Li
2014-10-22 7:22 ` Stefano Babic
2014-10-22 7:38 ` Li Ye-B37916
2014-10-22 8:14 ` Stefano Babic
2014-10-22 8:32 ` Li Ye-B37916
2014-10-22 16:52 ` Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox