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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A87E7C433EF for ; Wed, 10 Nov 2021 08:29:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 26906610CB for ; Wed, 10 Nov 2021 08:29:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 26906610CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 62F56839B0; Wed, 10 Nov 2021 09:29:27 +0100 (CET) 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=1636532967; bh=tmG2AjtBB12mxhZD+QdoGYWOIu6zAN3rhWBA1MXMYxA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=r2M0a5ioRRehfidtEgOfau45j9USEekPkBi+ISQ2gvRHseAEpIXAAFR+n3r9piHKn aQSvPdqafXtnIABCRxyyCp59snb8daqR+ep9oRoGu4ouEtjr+UuixWE8tR8h1heYy8 FWVK2y/aK01Cg5p4tjn68pBFUmIS7hNoAXjv+jzO4Bcr5bPMXBEEgt8h6DFL8FOWQN lXaaYwC5wpAVjIt9Ab8k02VCiym4ROSFPMZayve5A1Y2qEisJaBgtcl6vTMyiXCS+Q SdjZ8ZkCbSBlBNo91Eh9zVfWtlRjjtTW7GYUKubzF3Z1x3ZpBU0DbcguDyWK1R358r pxxjC5dbEdT8A== Received: by phobos.denx.de (Postfix, from userid 109) id 7CE2783983; Wed, 10 Nov 2021 09:29:26 +0100 (CET) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [91.198.250.253]) (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 832BE839B0 for ; Wed, 10 Nov 2021 09:29:23 +0100 (CET) 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-204.mailbox.org (Postfix) with ESMTPS id 4Hpygl35kMzQkd7; Wed, 10 Nov 2021 09:29:23 +0100 (CET) Message-ID: Date: Wed, 10 Nov 2021 09:29:19 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell 09/11] tools: kwbimage: Fill the real header size into the main header Content-Language: en-US To: =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: u-boot@lists.denx.de, =?UTF-8?Q?Pali_Roh=c3=a1r?= , =?UTF-8?Q?Marek_Beh=c3=ban?= References: <20211108171251.25382-1-kabel@kernel.org> <20211108171251.25382-10-kabel@kernel.org> From: Stefan Roese In-Reply-To: <20211108171251.25382-10-kabel@kernel.org> 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.34 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.2 at phobos.denx.de X-Virus-Status: Clean On 08.11.21 18:12, Marek Behún wrote: > From: Pali Rohár > > Fill the real header size without padding into the main header > > This allows to reduce final image when converting image to another format > which does not need additional padding. > > Signed-off-by: Pali Rohár > Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > tools/kwbimage.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/kwbimage.c b/tools/kwbimage.c > index 8dcfebcb57..114b313b4d 100644 > --- a/tools/kwbimage.c > +++ b/tools/kwbimage.c > @@ -1220,6 +1220,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, > { > struct image_cfg_element *e; > struct main_hdr_v1 *main_hdr; > + struct opt_hdr_v1 *ohdr; > struct register_set_hdr_v1 *register_set_hdr; > struct secure_hdr_v1 *secure_hdr = NULL; > size_t headersz; > @@ -1370,6 +1371,14 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, > main_hdr->checksum = image_checksum8(main_hdr, headersz); > > *imagesz = headersz; > + > + /* Fill the real header size without padding into the main header */ > + headersz = sizeof(*main_hdr); > + for_each_opt_hdr_v1 (ohdr, main_hdr) > + headersz += opt_hdr_v1_size(ohdr); > + main_hdr->headersz_lsb = cpu_to_le16(headersz & 0xFFFF); > + main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16; > + > return image; > } > > 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