From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF8D3C433F5 for ; Sat, 22 Jan 2022 16:31:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 57069820FE; Sat, 22 Jan 2022 17:31:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="llmclz07"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 32736835CA; Sat, 22 Jan 2022 17:31:25 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B7251820FE for ; Sat, 22 Jan 2022 17:31:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 43451B808C8; Sat, 22 Jan 2022 16:31:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D25E9C004E1; Sat, 22 Jan 2022 16:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642869081; bh=8+nWZMg/g8qB7XzZIRLhc6X6PbhXm676ahn29potO00=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=llmclz07bDJkRvtiwTnT3d6xhKP4UN33WoKj1UF25+pEi71j3iovXXl0dJvyjIldi 5noSK08cTX9FKenbr3qPuCp3BDkcYYsbrl3vE6dk2a0rYeLte8Wl4ZAdoQ4JPBWL8E KnEpvePB1m1hccTaEtCV1PcZ6lrUMfXDovyq5nsJpfpZca0oD2QZs/bjuoN/CIe4zZ 3hoYIUKUFyArnT25dCxL3RmRYK/mpmOM4MOtwsFAM70PFjPxv+CFtRd6XvMCZ1nFJc Jbb9dWrv5NoDUTufJMXcRIZXR+dA6TKouPRois0G/271FjlqLkqqMKmDUOy+EhkUme ScCFf882nzJDg== Received: by pali.im (Postfix) id 8A516883; Sat, 22 Jan 2022 17:31:18 +0100 (CET) Date: Sat, 22 Jan 2022 17:31:18 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Tom Rini Cc: Simon Glass , Alexandru Gagniuc , Yann Dirson , Stefan Roese , Marek =?utf-8?B?QmVow7pu?= , u-boot@lists.denx.de Subject: Re: [PATCH v2] tools: mkimage: Call verify_header after writing image to disk Message-ID: <20220122163118.5puevbiklty6xb5d@pali> References: <20220114173443.9877-1-pali@kernel.org> <20220121212133.GA2826984@bill-the-cat> <20220122014422.4hir3y4a6ipqic42@pali> <20220122021543.GP7004@bill-the-cat> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220122021543.GP7004@bill-the-cat> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Friday 21 January 2022 21:15:43 Tom Rini wrote: > On Sat, Jan 22, 2022 at 02:44:22AM +0100, Pali Rohár wrote: > > On Friday 21 January 2022 16:21:33 Tom Rini wrote: > > > On Fri, Jan 14, 2022 at 06:34:43PM +0100, Pali Rohár wrote: > > > > > > > If image backend provides verify_header callback then call it after writing > > > > image to disk. This ensures that written image is correct. > > > > > > > > Signed-off-by: Pali Rohár > > > > Reviewed-by: Stefan Roese > > > > Reviewed-by: Simon Glass > > > > --- > > > > tools/mkimage.c | 41 +++++++++++++++++++++++++++++++++++++++++ > > > > 1 file changed, 41 insertions(+) > > > > > > This breaks a number of platforms such as ls1021atwr_sdcard_qspi and > > > it's not clear to me why exactly. > > > > Maybe they were already broken and this patch just detected it? > > Or verify_header callback for particular image type is reject valid > > image? > > > > Do you have some pointers to failed build logs? > > Try building for ls1021atwr_sdcard_qspi with your patch applied, the > only new thing that's shown in the logs is the error message. So... I have tried following without this patch: $ make ls1021atwr_sdcard_qspi_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi- -j8 It generated file spl/u-boot-spl.pbl without error. Now I called -l on this generated file for type pblimage and I got following output: $ ./tools/dumpimage -T pblimage -l spl/u-boot-spl.pbl GP Header: Size aa55aa55 LoadAddr 1ee0100 $ ./tools/mkimage -T pblimage -l spl/u-boot-spl.pbl GP Header: Size aa55aa55 LoadAddr 1ee0100 "GP Header:" line is from the TI OMAP image backend type gpimage or type omapimage (implemented in file gpimage-common.c). So it means that files generated by ls1021atwr_sdcard_qspi are already broken and my patch just detected it. Or it is also possible that validation code in pblimage.c file is incorrect and broken. What to do with it now?