Message ID | 20160719092614.17130-1-lokeshvutla@ti.com |
---|---|
State | Accepted |
Commit | 3cc1f380e518999e68fa64d200d19063f31cb023 |
Delegated to: | Tom Rini |
Headers | show |
On Tue, Jul 19, 2016 at 02:56:14PM +0530, Lokesh Vutla wrote: > In raw mode a full sector is to be read even if image covers part of > a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT > framework. This calculation assumes that image is at the 0th offset of a sector, > which is not true always in FIT case. So, include the image offset while > calculating number of sectors. > > Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
On Tue, Jul 19, 2016 at 02:56:14PM +0530, Lokesh Vutla wrote: > In raw mode a full sector is to be read even if image covers part of > a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT > framework. This calculation assumes that image is at the 0th offset of a sector, > which is not true always in FIT case. So, include the image offset while > calculating number of sectors. > > Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> > Reviewed-by: Tom Rini <trini@konsulko.com> Applied to u-boot/master, thanks!
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 069e94d..be86072 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -115,8 +115,10 @@ static int get_aligned_image_overhead(struct spl_load_info *info, int offset) static int get_aligned_image_size(struct spl_load_info *info, int data_size, int offset) { + data_size = data_size + get_aligned_image_overhead(info, offset); + if (info->filename) - return data_size + get_aligned_image_overhead(info, offset); + return data_size; return (data_size + info->bl_len - 1) / info->bl_len; }
In raw mode a full sector is to be read even if image covers part of a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT framework. This calculation assumes that image is at the 0th offset of a sector, which is not true always in FIT case. So, include the image offset while calculating number of sectors. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> --- common/spl/spl_fit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)