summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-10-22 12:37:47 +0200
committerStefan Roese <sr@denx.de>2021-10-28 10:33:32 +0200
commit0089f61e2dad50650d848ce8625d2b2141f56984 (patch)
tree03399ce00835ba65c43ad4ba450817d4ee17c62b
parent2fdba4f6585c31da748eee69a8dea1cf0a11d311 (diff)
downloadu-boot-0089f61e2dad50650d848ce8625d2b2141f56984.tar.gz
u-boot-0089f61e2dad50650d848ce8625d2b2141f56984.tar.bz2
u-boot-0089f61e2dad50650d848ce8625d2b2141f56984.zip
tools: kwboot: Patch nandpagesize to zero also for v1 image
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> Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r--tools/kwboot.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index eb4f5ab879..7e1be29623 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;