Trying to flash a FIT image over fastboot often results in errors like this:
Invalid sparse file format at header magic error: write_sparse_skip_chunk: don't care size 18394488 is not a multiple of the block size 4096 error: write_sparse_skip_chunk: don't care size 10009976 is not a multiple of the block size 4096 error: write_sparse_skip_chunk: don't care size 1625464 is not a multiple of the block size 4096 [...] FAILED (remote: 'writing sparse image: Invalid argument') The FIT image knows about its own size anyway, so to get around this issue, we can simply pad the image to a multiple of 4 kiB to make it work with the fastboot sparse magic. Suggested-by: Ahmad Fatoum <a.fat...@pengutronix.de> Signed-off-by: Roland Hieber <r...@pengutronix.de> --- v2: clean up the temp image too --- scripts/lib/ptxd_make_fit_image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/lib/ptxd_make_fit_image.sh b/scripts/lib/ptxd_make_fit_image.sh index dd0f63b7b72d..8162195fdfa3 100644 --- a/scripts/lib/ptxd_make_fit_image.sh +++ b/scripts/lib/ptxd_make_fit_image.sh @@ -139,6 +139,8 @@ ptxd_make_image_fit() { echo "Generated device-tree for the fit image:" cat "${its}" fi && - ptxd_exec mkimage -N pkcs11 -f "${its}" "${image_image}" -r "${sign_args[@]}" + ptxd_exec mkimage -N pkcs11 -f "${its}" "${image_image}.tmp" -r "${sign_args[@]}" && + ptxd_exec dd if="${image_image}.tmp" of="${image_image}" conv=sync bs=4k && + ptxd_exec rm "${image_image}.tmp" } export -f ptxd_make_image_fit -- 2.39.2