From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Ye-B37916 Date: Wed, 22 Oct 2014 15:38:30 +0800 Subject: [U-Boot] [PATCH] imximage: Fix the bootdata.size calculation In-Reply-To: <54475B29.3090902@denx.de> References: <1413959969-9688-1-git-send-email-B37916@freescale.com> <54475B29.3090902@denx.de> Message-ID: <54475EF6.6030107@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 >> --- >> 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