spl: fit: Fix the number of bytes read in raw mode
PATCH 1/1 spl: fit: Fix the number of bytes read in raw mode
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.
--- common/spl/spl_fit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
common/spl/spl_fit.c +3 -1
@@ -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; }
Signature · 1 line
2.9.2
PATCH 1/1 spl: fit: Fix the number of bytes read in raw mode
Quoted 7 lines · Lokesh Vutla
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 <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160719/7465cd8d/attachment.sig>
Quoted 8 lines · Lokesh Vutla
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 <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/c608f406/attachment.sig>