imximage: Fix the bootdata.size calculation
PATCH 1/1 imximage: Fix the bootdata.size calculation
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.
--- tools/imximage.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/imximage.c +1 -1
@@ -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 +
Signature · 1 line
1.7.4.1
PATCH 1/1 imximage: Fix the bootdata.size calculation
Hi Ye,
Quoted 14 lines · Ye.Li
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 <[email protected]>--- tools/imximage.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/imximage.c +0
-0
tools/imximage.c static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd, · line 591
Quoted 6 lines
tools/imximage.c +1
-1@@ -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
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 imximage: Fix the bootdata.size calculation
Hi Stefano,
Quoted 27 lines · Stefano Babic
Hi Ye,
Quoted 14 lines · Ye.Li
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 <[email protected]>--- tools/imximage.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/imximage.c +0
-0tools/imximage.c static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd, · line 591
Quoted 6 lines
tools/imximage.c +1
-1@@ -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.
Quoted 7 lines
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
PATCH 1/1 imximage: Fix the bootdata.size calculation
Hi Ye,
Quoted 2 lines · 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....
Quoted 2 lines
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 ?
Quoted 4 lines
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
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 imximage: Fix the bootdata.size calculation
Hi Stefano,
Quoted 4 lines · Stefano Babic
Hi Ye,
On 22/10/2014 09:38, Li Ye-B37916 wrote:
Quoted 8 lines
Quoted 2 lines
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....
Quoted 2 lines
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.
Quoted 4 lines
Quoted 4 lines
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.
Quoted 8 lines
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
Fabio Estevam
reviewerPATCH 1/1 imximage: Fix the bootdata.size calculation
In reply to Li Ye-B37916Hi Ye Li,
Quoted 7 lines · On Wed, Oct 22, 2014 at 5:38 AM, Li Ye-B37916 <[email protected]> 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