public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH 1/5] Nokia RX-51: Fix invalidating zImage kernel format
Date: Thu, 11 Aug 2022 22:27:21 +0200	[thread overview]
Message-ID: <20220811202725.24752-1-pali@kernel.org> (raw)

Prior starting copy of kernel image to target location, invalidate also
zImage magic header. This ensures that on target location would be image
with valid header only in the case valid header was also in the source
location and copy from source to target finished successfully. Copy is
always skipped when kernel image in source location is invalid.

Add also comment to the code which explain what is the code doing.

Fixes: cc434fccba4c ("Nokia RX-51: Add support for booting kernel in zImage format")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/nokia/rx51/lowlevel_init.S | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S
index 11c2cbef89a6..632595f83785 100644
--- a/board/nokia/rx51/lowlevel_init.S
+++ b/board/nokia/rx51/lowlevel_init.S
@@ -72,7 +72,8 @@ copy_kernel_start:
 
 	/* remove header in target kernel */
 	mov	r5, #0
-	str	r5, [r3]
+	str	r5, [r3]	/* remove 4 bytes header of kernel uImage */
+	str	r5, [r3, #36]	/* remove 4 bytes header of kernel zImage */
 
 	/* check for valid kernel uImage */
 	ldr	r4, [r0]	/* r4 - 4 bytes header of kernel */
@@ -93,6 +94,8 @@ copy_kernel_loop:
 	bhi	copy_kernel_loop
 
 copy_kernel_end:
+
+	/* remove header in source kernel image */
 	mov	r5, #0
 	str	r5, [r0]	/* remove 4 bytes header of kernel uImage */
 	str	r5, [r0, #36]	/* remove 4 bytes header of kernel zImage */
-- 
2.20.1


             reply	other threads:[~2022-08-11 20:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 20:27 Pali Rohár [this message]
2022-08-11 20:27 ` [PATCH 2/5] Nokia RX-51: Use U-Boot generic position independent code Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-11 20:27 ` [PATCH 3/5] Nokia RX-51: Simplify copy kernel code Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-11 20:27 ` [PATCH 4/5] Nokia RX-51: Simplify calculation of attached kernel image address Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-11 20:27 ` [PATCH 5/5] Nokia RX-51: Move board required options from defconfig to Kconfig Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-20 23:01 ` [PATCH 1/5] Nokia RX-51: Fix invalidating zImage kernel format Tom Rini

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=20220811202725.24752-1-pali@kernel.org \
    --to=pali@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox