From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 23 Aug 2023 12:35:15 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qYlCm-0064jL-HY for lore@lore.pengutronix.de; Wed, 23 Aug 2023 12:35:15 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qYlCk-0000Bn-Lw; Wed, 23 Aug 2023 12:35:14 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qYlCI-0000BS-TT; Wed, 23 Aug 2023 12:34:46 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qYlCI-0011QZ-8z; Wed, 23 Aug 2023 12:34:46 +0200 Received: from rhi by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1qYlCH-00Bv62-36; Wed, 23 Aug 2023 12:34:45 +0200 From: Roland Hieber To: ptxdist@pengutronix.de Date: Wed, 23 Aug 2023 12:34:10 +0200 Message-Id: <20230823103409.2840820-1-rhi@pengutronix.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Mail-Followup-To: Roland Hieber , ptxdist@pengutronix.de Content-Transfer-Encoding: 8bit Subject: [ptxdist] [PATCH] ptxd_make_fit_image: pad FIT image to block size of 4096 bytes X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Ahmad Fatoum , Roland Hieber Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false 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 Signed-off-by: Roland Hieber --- scripts/lib/ptxd_make_fit_image.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/lib/ptxd_make_fit_image.sh b/scripts/lib/ptxd_make_fit_image.sh index dd0f63b7b72d..660dd236f241 100644 --- a/scripts/lib/ptxd_make_fit_image.sh +++ b/scripts/lib/ptxd_make_fit_image.sh @@ -139,6 +139,7 @@ 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 } export -f ptxd_make_image_fit -- 2.39.2