All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Marek Behún" <marek.behun@nic.cz>, 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	[thread overview]
Message-ID: <20211022103748.25651-3-pali@kernel.org> (raw)
In-Reply-To: <20211022103748.25651-1-pali@kernel.org>

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 <pali@kernel.org>
---
 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


  parent reply	other threads:[~2021-10-22 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 10:37 [PATCH 0/3] arm: mvebu: nandpagesize support for kwbimage v1 Pali Rohár
2021-10-22 10:37 ` [PATCH 1/3] tools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images Pali Rohár
2021-10-26  4:46   ` Stefan Roese
2021-10-22 10:37 ` Pali Rohár [this message]
2021-10-26  4:47   ` [PATCH 2/3] tools: kwboot: Patch nandpagesize to zero also for v1 image Stefan Roese
2021-10-22 10:37 ` [PATCH 3/3] arm: mvebu: Update name of kwbimage v1 field at offset 0x2-0x3 Pali Rohár
2021-10-26  4:47   ` Stefan Roese
2021-10-28 10:49 ` [PATCH 0/3] arm: mvebu: nandpagesize support for kwbimage v1 Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211022103748.25651-3-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.