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 9D4A3C433EF for ; Wed, 6 Apr 2022 05:32:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9B25D83C35; Wed, 6 Apr 2022 07:32:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1649223146; bh=T8qSBBTahls+X/wh+Ov5yYCt76krjb1ml5f8ckNYYCk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BZf6/hckbArbxbaJKKUgtp5StIHNtjGV43gF0s4Enkgsv/HA4JOVtF47kBZ8uGKGj UdPUjmoHlFayEBF52PrDeVi8Qi1dhJ8vch+4y9fgp8eYmlO444vyLhUGivXnbeV/Ah 6toXcCgWlIy98LBxCD7KolENdzzpA4MGtJ6cqjmKcfBBCh36P1RXYu2nCLPVLvT6Yk qtc6iKo83mfd/6XA9Qdd0avv/kWTqTuYs/0vWVCaNq6Ig6LepX9L2NsOuFX3zgZPgZ fC+xs3/qrBOsQf0wv+9F1bSH0WtJmXvsa+WbMDdi282wZC+cXIm8Ev10IbLIiTjY6i tlkqNepF2hBCg== Received: by phobos.denx.de (Postfix, from userid 109) id EA8C983B06; Wed, 6 Apr 2022 07:32:24 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [IPv6:2001:67c:2050:1::465:107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3291B83C54 for ; Wed, 6 Apr 2022 07:32:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp202.mailbox.org (unknown [91.198.250.118]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4KYCnZ4mvCz9sRB; Wed, 6 Apr 2022 07:32:18 +0200 (CEST) Message-ID: <81372cf8-b595-c6f0-d380-3efe75d42ba6@denx.de> Date: Wed, 6 Apr 2022 07:32:13 +0200 MIME-Version: 1.0 Subject: Re: [RFC PATCH 2/7] spl: Convert ext to use spl_load Content-Language: en-US To: Sean Anderson , Simon Glass Cc: =?UTF-8?Q?Marek_Beh=c3=ban?= , u-boot@lists.denx.de, Marek Vasut , =?UTF-8?Q?Pali_Roh=c3=a1r?= References: <20220401190405.1932697-1-sean.anderson@seco.com> <20220401190405.1932697-3-sean.anderson@seco.com> From: Stefan Roese In-Reply-To: <20220401190405.1932697-3-sean.anderson@seco.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 4/1/22 21:04, Sean Anderson wrote: > This converts the ext load method to use spl_load. As a consequence, it > also adds support for FIT and IMX images. > > Signed-off-by: Sean Anderson Reviewed-by: Stefan Roese Thanks, Stefan > --- > > common/spl/spl_ext.c | 24 +++++++++++++++++------- > 1 file changed, 17 insertions(+), 7 deletions(-) > > diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c > index ebd914c492..1384842776 100644 > --- a/common/spl/spl_ext.c > +++ b/common/spl/spl_ext.c > @@ -9,6 +9,18 @@ > #include > #include > > +static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, > + ulong size, void *buf) > +{ > + int ret; > + loff_t actlen; > + > + ret = ext4fs_read(buf, file_offset, size, &actlen); > + if (ret) > + return ret; > + return actlen; > +} > + > int spl_load_image_ext(struct spl_image_info *spl_image, > struct spl_boot_device *bootdev, > struct blk_desc *block_dev, int partition, > @@ -18,6 +30,10 @@ int spl_load_image_ext(struct spl_image_info *spl_image, > struct image_header *header; > loff_t filelen, actlen; > struct disk_partition part_info = {}; > + struct spl_load_info load = { > + .read = spl_fit_read, > + .bl_len = 1, > + }; > > header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); > > @@ -47,13 +63,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image, > goto end; > } > > - err = spl_parse_image_header(spl_image, bootdev, header); > - if (err < 0) { > - puts("spl: ext: failed to parse image header\n"); > - goto end; > - } > - > - err = ext4fs_read((char *)spl_image->load_addr, 0, filelen, &actlen); > + err = spl_load(spl_image, bootdev, &load, header, filelen, 0); > > end: > #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de