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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 735C9C433EF for ; Fri, 22 Oct 2021 10:38:59 +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 B2DF26112F for ; Fri, 22 Oct 2021 10:38:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B2DF26112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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 A8ADA83522; Fri, 22 Oct 2021 12:38:47 +0200 (CEST) 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="ZVwdKi4w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AC92D834C5; Fri, 22 Oct 2021 12:38:27 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 9A310834E8 for ; Fri, 22 Oct 2021 12:38:20 +0200 (CEST) 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: by mail.kernel.org (Postfix) with ESMTPSA id 1A21F611CB; Fri, 22 Oct 2021 10:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634899099; bh=rWIXAM8j9H9t7Oqp99R8EQdTXWvWq7Bxi1XqlF/RcDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVwdKi4w636ULSLHWnsO67aKhf2W42zVotM3UnA9FwPrkYGotRWR6vRcNeSFgHsDi fSxXYc7g9lqTH+dDPfliQr5nRA0RMXANj85vXjqzz+JeRcEWN1R92aKrhDzy+WkFBG NfySwxS/3tXiDWt/fSg2B8RxuQ0+EMEJTJCY1tJ1zJt7wPAW/KjVWdeurKJIQPF83w aTOUlbdnQHhdJh6ayJualfMPdGVGpl76g//iZdT3wZHgRlmP0vGIHbv+T/oBn+jJtZ lGDwPud3IaVtFMR7ionfO5rBOB/nBlaBjM6ZQsjXffbCO4vbq2Z3AqYa+45BCTeYv4 crYZ247UmnnWQ== Received: by pali.im (Postfix) id 534BFAC8; Fri, 22 Oct 2021 12:38:17 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese Cc: =?UTF-8?q?Marek=20Beh=C3=BAn?= , u-boot@lists.denx.de Subject: [PATCH 2/3] tools: kwboot: Patch nandpagesize to zero also for v1 image Date: Fri, 22 Oct 2021 12:37:47 +0200 Message-Id: <20211022103748.25651-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211022103748.25651-1-pali@kernel.org> References: <20211022103748.25651-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 kwbimage v1 has also nandpagesize field. So set it to zero for both image versions when image is not signed. Signed-off-by: Pali Rohár --- tools/kwboot.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index eb4f5ab87917..7e1be2962302 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1428,13 +1428,6 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) if (csum != hdr->checksum) goto err; - if (image_ver == 0) { - struct main_hdr_v0 *hdr_v0 = img; - - hdr_v0->nandeccmode = IBR_HDR_ECC_DISABLED; - hdr_v0->nandpagesize = 0; - } - srcaddr = le32_to_cpu(hdr->srcaddr); switch (hdr->blockid) { @@ -1480,6 +1473,12 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) hdr->blockid = IBR_HDR_UART_ID; } + if (!is_secure) { + if (image_ver == 0) + ((struct main_hdr_v0 *)img)->nandeccmode = IBR_HDR_ECC_DISABLED; + hdr->nandpagesize = 0; + } + if (baudrate) { uint32_t codesz = sizeof(kwboot_baud_code); void *code; -- 2.20.1