diff mbox series

[1/5] Nokia RX-51: Fix invalidating zImage kernel format

Message ID 20220811202725.24752-1-pali@kernel.org
State Accepted
Commit 7c4ad9821758f98db127e9d6864671c906c02d3b
Delegated to: Tom Rini
Headers show
Series [1/5] Nokia RX-51: Fix invalidating zImage kernel format | expand

Commit Message

Pali Rohár Aug. 11, 2022, 8:27 p.m. UTC
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(-)

Comments

Tom Rini Aug. 20, 2022, 11:01 p.m. UTC | #1
On Thu, Aug 11, 2022 at 10:27:21PM +0200, Pali Rohár wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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 */