diff options
author | Ye.Li <B37916@freescale.com> | 2014-10-30 17:54:08 +0800 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2014-11-03 10:33:01 +0100 |
commit | de97980478db4378719a529deb8e203e33bf6f66 (patch) | |
tree | 21a3401750a985766e476cec72090849d6561bb2 /tools/imximage.c | |
parent | d12159b63b0e0fe4842afedf84b4a497f2323b8b (diff) | |
download | u-boot-de97980478db4378719a529deb8e203e33bf6f66.tar.gz u-boot-de97980478db4378719a529deb8e203e33bf6f66.tar.bz2 u-boot-de97980478db4378719a529deb8e203e33bf6f66.zip |
imximage: Fix the bootdata.size calculation
In system boot chapter of i.MX6 reference manual, the "Image Vector Table"
figure shows the bootdata.start points to the beginning of the destination
memory. It means the bootdata.size should contain the IVT offset part,
but the calculation in imximage tool does not have.
We found this issue when booting from QuadSPI NOR on i.MX6SX. The u-boot
runs into abnormal (crash or stop) after booting. After checked the destination
memory where the image is loaded to, there are hundreds of bytes at
the image end are not loaded into memory. Since there is a 4096 bytes
round in the calculation, for the booting devices using smaller IVT offset,
such as SD and SPI booting, they are not easy to reproduce.
Signed-off-by: Ye.Li <B37916@freescale.com>
Diffstat (limited to 'tools/imximage.c')
-rw-r--r-- | tools/imximage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/imximage.c b/tools/imximage.c index faba23860f..526b7d490d 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 + |