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 9056BC433F5 for ; Wed, 10 Nov 2021 08:24:04 +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 0F4BB6109F for ; Wed, 10 Nov 2021 08:24:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0F4BB6109F 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 1CDFA839A0; Wed, 10 Nov 2021 09:24:02 +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=1636532642; bh=2YIfwns9wJzFaweWEEiHfQKFAwAr8/QCeSeUIa1T/4Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ymrzgUfp2WWjdPoZQtnptsPhaD2NZ9ALJ8AoMKhL+aPsCtmchu9mVcssAo+aK/UFu uQ1nlbVidnOrMsgD5xZpRH8ijhctPC8O5HPDxfcREiVfPj64QYcRb2S7GnIeCLJiH1 F4qN2tPC9wE+gBjjY22ignsmhujc37hforaaPZSFGHwvOaALmmOTEPzB6WbgEjF6yu YtbDW2R9zvg7Cq945U7hcE0hT+uzJeE7AX9RSBK7+UhaIZmS2xx3i1/VBmozhdeY32 givJ3n+4C5DaKChcq8zWLqEhBlEBaXDGGDKpMZtc/0cdzP1y27C4vvzbQn043N42o5 +0I3DDFHUhdhg== Received: by phobos.denx.de (Postfix, from userid 109) id 87CD5839A1; Wed, 10 Nov 2021 09:24:00 +0100 (CET) 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 0E9118399F for ; Wed, 10 Nov 2021 09:23:57 +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 smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (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 4HpyYT0BNRzQkFr; Wed, 10 Nov 2021 09:23:57 +0100 (CET) Message-ID: <13a9b3f2-a91b-d54b-3548-e064bd0edc2d@denx.de> Date: Wed, 10 Nov 2021 09:23:52 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell 03/11] tools: kwbimage: Set BOOT_FROM by default to SPI 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-4-kabel@kernel.org> From: Stefan Roese In-Reply-To: <20211108171251.25382-4-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 > > kwbimage must have valid blockid member instead of zero value. Thus if > config file does not contain BOOT_FROM command, use by default the value > for SPI booting (which is probably the most common). > > Signed-off-by: Pali Rohár > Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > tools/kwbimage.c | 32 +++++++++++++++----------------- > 1 file changed, 15 insertions(+), 17 deletions(-) > > diff --git a/tools/kwbimage.c b/tools/kwbimage.c > index d29f2cfcce..38b6e2fed2 100644 > --- a/tools/kwbimage.c > +++ b/tools/kwbimage.c > @@ -266,6 +266,18 @@ static bool image_get_spezialized_img(void) > return e->sec_specialized_img; > } > > +static int image_get_bootfrom(void) > +{ > + struct image_cfg_element *e; > + > + e = image_find_option(IMAGE_CFG_BOOT_FROM); > + if (!e) > + /* fallback to SPI if no BOOT_FROM is not provided */ > + return IBR_HDR_SPI_ID; > + > + return e->bootfrom; > +} > + > /* > * Compute a 8-bit checksum of a memory area. This algorithm follows > * the requirements of the Marvell SoC BootROM specifications. > @@ -884,10 +896,8 @@ static void *image_create_v0(size_t *imagesz, struct image_tool_params *params, > main_hdr->version = 0; > main_hdr->destaddr = cpu_to_le32(params->addr); > main_hdr->execaddr = cpu_to_le32(params->ep); > + main_hdr->blockid = image_get_bootfrom(); > > - e = image_find_option(IMAGE_CFG_BOOT_FROM); > - if (e) > - main_hdr->blockid = e->bootfrom; > e = image_find_option(IMAGE_CFG_NAND_ECC_MODE); > if (e) > main_hdr->nandeccmode = e->nandeccmode; > @@ -1232,9 +1242,8 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, > main_hdr->srcaddr = cpu_to_le32(headersz); > main_hdr->ext = hasext; > main_hdr->version = 1; > - e = image_find_option(IMAGE_CFG_BOOT_FROM); > - if (e) > - main_hdr->blockid = e->bootfrom; > + main_hdr->blockid = image_get_bootfrom(); > + > e = image_find_option(IMAGE_CFG_NAND_BLKSZ); > if (e) > main_hdr->nandblocksize = e->nandblksz / (64 * 1024); > @@ -1559,17 +1568,6 @@ static int image_get_version(void) > return e->version; > } > > -static int image_get_bootfrom(void) > -{ > - struct image_cfg_element *e; > - > - e = image_find_option(IMAGE_CFG_BOOT_FROM); > - if (!e) > - return -1; > - > - return e->bootfrom; > -} > - > static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd, > struct image_tool_params *params) > { > 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