[PATCH] board: st: stm32mp1: update load address for FIT examples

Patrick Delaunay patrick.delaunay at st.com
Wed Nov 25 12:28:10 CET 2020


Update kernel load address for FIT examples to avoid relocation:
- Kernel example uses Image.gz with U-Boot gzip decompression
  at final kernel location 0x0xC0008000.
- Copro example loads zImage at a correct location (0xC4000000),
  to avoid zImage relocation before decompression by kernel code.

An other solution to avoid zImage relocation is to align
the kernel load and entry address with the real location in FIT
(the relocation of zImage is skipped in U-Boot bootm command for
identical address) but it is less flexible because this offset
depends on FIT content:

For example:

## Loading kernel from FIT Image at c2000000 ...
   Using 'ev1' configuration
   Trying 'kernel' kernel subimage
     Description:  Linux kernel
     Created:      2020-10-22   9:08:32 UTC
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0xc20000cc

The kernel offset in FIT is 0xCC in FIT and zImage is decompressed at
0xC0008000 by kernel code:

kernel {
	description = "Linux kernel";
	data = /incbin/("zImage");
	type = "kernel";
	arch = "arm";
	os = "linux";
	compression = "none";
	load = <0xC20000cc>;
	entry = <0xC20000cc>;
	hash-1 {
		algo = "sha1";
	};
};

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

 board/st/stm32mp1/fit_copro_kernel_dtb.its | 18 ++++++++++++++++--
 board/st/stm32mp1/fit_kernel_dtb.its       |  6 +++---
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/board/st/stm32mp1/fit_copro_kernel_dtb.its b/board/st/stm32mp1/fit_copro_kernel_dtb.its
index 3e08fd943e..dc43639af4 100644
--- a/board/st/stm32mp1/fit_copro_kernel_dtb.its
+++ b/board/st/stm32mp1/fit_copro_kernel_dtb.its
@@ -1,6 +1,20 @@
 /*
  * Compilation:
  * mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
+ *
+ * M4 firmware to load with remoteproc: rproc-m4-fw.elf
+ *
+ * Files in linux build dir:
+ * - arch/arm/boot/zImage
+ * - arch/arm/boot/dts/stm32mp157c-dk2.dtb
+ * - arch/arm/boot/dts/stm32mp157c-ev1.dtb
+ *
+ * load mmc 0:4 $kernel_addr_r fit_copro_kernel_dtb.itb
+ * bootm $kernel_addr_r
+ * bootm $kernel_addr_r#dk2
+ * bootm $kernel_addr_r#ev1
+ * bootm $kernel_addr_r#dk2-m4
+ * bootm $kernel_addr_r#ev1-m4
  */
 
 /dts-v1/;
@@ -29,8 +43,8 @@
 			arch = "arm";
 			os = "linux";
 			compression = "none";
-			load = <0xC0008000>;
-			entry = <0xC0008000>;
+			load = <0xC4000000>;
+			entry = <0xC4000000>;
 			hash-1 {
 				algo = "sha1";
 			};
diff --git a/board/st/stm32mp1/fit_kernel_dtb.its b/board/st/stm32mp1/fit_kernel_dtb.its
index 18d03ebf3c..8456a3c460 100644
--- a/board/st/stm32mp1/fit_kernel_dtb.its
+++ b/board/st/stm32mp1/fit_kernel_dtb.its
@@ -3,7 +3,7 @@
  * mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb
  *
  * Files in linux build dir:
- * - arch/arm/boot/zImage
+ * - arch/arm/boot/Image (gzipped in Image.gz)
  * - arch/arm/boot/dts/stm32mp157c-dk2.dtb
  * - arch/arm/boot/dts/stm32mp157c-ev1.dtb
  *
@@ -23,11 +23,11 @@
 	images {
 		kernel {
 			description = "Linux kernel";
-			data = /incbin/("zImage");
+			data = /incbin/("Image.gz");
 			type = "kernel";
 			arch = "arm";
 			os = "linux";
-			compression = "none";
+			compression = "gzip";
 			load = <0xC0008000>;
 			entry = <0xC0008000>;
 			hash-1 {
-- 
2.17.1



More information about the U-Boot mailing list