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 5EB30C433EF for ; Sat, 22 Jan 2022 16:34:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1548D83065; Sat, 22 Jan 2022 17:34:56 +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="S7t+aQ9d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17E25836E6; Sat, 22 Jan 2022 17:34:55 +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 B0DC481F7E for ; Sat, 22 Jan 2022 17:34:52 +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 6568BB808C8; Sat, 22 Jan 2022 16:34:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 040F5C004E1; Sat, 22 Jan 2022 16:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642869291; bh=ku+gGQnrxhjMmeQE0HrIIq8jSe7KytGjZYUmf9+8+0s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S7t+aQ9dsouN0i3mIdCuaAZBDnEFf3ZqQt/av9q20GZxkFh+V2Gj7RU9Tn9/2oCQV MEuys9hPJeioEs/XYFCY8sxa269KIwGIm3SN9EkzjtYtydsrj36Q+VQN9k5TD59FjY HX2rkaUBNrofniWhnY5Gsm+UmezORZcgSmNyEs90/Q8ucYdN7lZFtaX7YbfipaSMGI kAfc81AOhI/57CfNoqJru21OSivjils8Z/xtwa6TYziTE3ILNO7ofOaviUfwN0eU/f GsugqPSlVuErJP4O3XdtpdnBLpNZwJ5M+NqOkuCm18tSyzSJ4IwVN23XbDycYopqF1 KaLr/XiDgJrfw== Received: by pali.im (Postfix) id 94257883; Sat, 22 Jan 2022 17:34:48 +0100 (CET) Date: Sat, 22 Jan 2022 17:34:48 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Tom Rini Cc: Simon Glass , Alexandru Gagniuc , 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: <20220122163448.3xokb3wteghx7aop@pali> References: <20220114173443.9877-1-pali@kernel.org> <20220121212133.GA2826984@bill-the-cat> <20220122014422.4hir3y4a6ipqic42@pali> <20220122021543.GP7004@bill-the-cat> <20220122163118.5puevbiklty6xb5d@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220122163118.5puevbiklty6xb5d@pali> 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 Saturday 22 January 2022 17:31:18 Pali Rohár wrote: > 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. Just to note validation is failing on this tools/pblimage.c check: if (pbl_hdr->rcwheader != reverse_byte(RCW_HEADER)) > What to do with it now?