[PATCH v2] board: rpi: Update memory layout for Aarch64

Walter Lozano walter.lozano at collabora.com
Tue Jul 23 21:34:30 CEST 2024


ARM and Aarch64 have different restrictions and trying to accommodate
larger kernels like the ones used in distros can be challenging. For this
reason, separate the layout and rearrange the map for Aarch64 to support
kernels larger than 36 MB.

The current approach is to reserve 128 MB for the kernel to allow boards
with 512 MB to have enough free space for other artifacts, such as
ramdisk.

Signed-off-by: Walter Lozano <walter.lozano at collabora.com>
---

Changes in v2:
    Bump space reserved for linux from 50 MB to 128 MB

 board/raspberrypi/rpi/rpi.env | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env
index 30228285edd..68221678f16 100644
--- a/board/raspberrypi/rpi/rpi.env
+++ b/board/raspberrypi/rpi/rpi.env
@@ -42,13 +42,19 @@ dfu_alt_info+=zImage fat 0 1
  *   For Aarch64, the kernel image is uncompressed and must be loaded at
  *   text_offset bytes (specified in the header of the Image) into a 2MB
  *   boundary. The 'booti' command relocates the image if necessary. Linux uses
- *   a default text_offset of 0x80000.  In summary, loading at 0x80000
- *   satisfies all these constraints and reserving memory up to 0x02400000
- *   permits fairly large (roughly 36M) kernels.
+ *   a default text_offset of 0x80000.  However, loading it at 0x80000
+ *   will allow to reserve only up to 0x02400000 which permits medium size
+ *   kernels (roughly 36M). This is good enough for customized kernels but
+ *   not for distros which by default enable drivers for many different
+ *   boards. Under these circumstances, using 0x00200000 provides room for
+ *   larger kernels.
  *
  * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't
  * conflict with something else. Reserving 1M for each of them at
- * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty.
+ * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty for ARM.
+ *
+ *   For Aarch64, since the kernel is placed in different location,
+ *   accommodate them to reserver 1M for each of them.
  *
  * On ARM, both the DTB and any possible initrd must be loaded such that they
  * fit inside the lowmem mapping in Linux. In practice, this usually means not
@@ -62,16 +68,21 @@ dfu_alt_info+=zImage fat 0 1
  * large initrds before they start colliding with U-Boot.
  */
 #ifdef CONFIG_ARM64
+pxefile_addr_r=0x00080000
+scriptaddr=0x00100000
+kernel_addr_r=0x00200000
+fdt_addr_r=0x09800000
+ramdisk_addr_r=0x09900000
 fdt_high=ffffffffffffffff
 initrd_high=ffffffffffffffff
 #else
-fdt_high=ffffffff
-initrd_high=ffffffff
-#endif
 kernel_addr_r=0x00080000
 scriptaddr=0x02400000
 pxefile_addr_r=0x02500000
 fdt_addr_r=0x02600000
 ramdisk_addr_r=0x02700000
+fdt_high=ffffffff
+initrd_high=ffffffff
+#endif
 
 boot_targets=mmc usb pxe dhcp
-- 
2.40.1



More information about the U-Boot mailing list