From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 12 Sep 2023 18:43:34 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) 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 1qg6UB-00Cr8B-8a for lore@lore.pengutronix.de; Tue, 12 Sep 2023 18:43:34 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qg6U9-0007nI-RG; Tue, 12 Sep 2023 18:43:33 +0200 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qg6Tl-0007n7-AO for ptxdist@pengutronix.de; Tue, 12 Sep 2023 18:43:09 +0200 Received: from rhi by pty.whiteo.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qg6Tk-00Gxno-Uj for ptxdist@pengutronix.de; Tue, 12 Sep 2023 18:43:08 +0200 Date: Tue, 12 Sep 2023 18:43:08 +0200 From: Roland Hieber To: ptxdist@pengutronix.de Message-ID: <20230912164308.hgv7ihk6jpzfj75f@pengutronix.de> References: <20230823103409.2840820-1-rhi@pengutronix.de> <20230823104959.2870164-1-rhi@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=4.0 tests=AWL,BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Subject: Re: [ptxdist] [PATCH v2] 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 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On Fri, Sep 01, 2023 at 08:31:58AM +0200, Michael Olbrich wrote: > On Wed, Aug 23, 2023 at 12:49:59PM +0200, Roland Hieber wrote: > > 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. > > This looks suspicious. The FIT image is not a sparse file, so why would you > get errors from the sparse file handling code? Sorry, I have no idea. As far as I understood Ahmad's barebox patch, fastboot tries to sparse it on-the-fly…? - Roland > Michael > > > > > Suggested-by: Ahmad Fatoum > > Signed-off-by: Roland Hieber > > --- > > 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 > > > > > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > > -- Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |