rpi: Tidy up booting
v5 cover rpi: Tidy up booting
This series allows rpi to boot a compressed Ubuntu kernel with ~100MB ramdisk, by expanding the available space.
It also tidies up some strange behaviour with the provided FDT, where a separate pointer is maintained to it, even though U-Boot has copied it and placed it in its own space. This avoids strange bugs where it accidentally gets overwritten when loading a file into memory.
The patch to expand the devicetree was dropped, meaning that people should be careful to unset fdt_addr in the environment.
In version 2, it incorporates some changes to fdt_addr, etc. suggested by Tom, as well as adding myself as a maintainer.
Changes in v5:
- Rebase to -next
- Drop patch to add myself as a maintainer
Changes in v4:
- Expand the comment on set_fdt_addr()
- Update the commit message to talk in terms of my testing
Changes in v2:
- Drop patch to allow expanding the devicetree during relocation
Simon Glass (1):
rpi: Use the U-Boot control FDT for fdt_addr
board/raspberrypi/rpi/rpi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
Signature · 4 lines
2.43.0 base-commit: 14b784aaf2a96b0f597b4fc3c5a3b4cb70f18182 branch: stc5
PATCH v5 1/1 rpi: Use the U-Boot control FDT for fdt_addr
The fdt_addr variable is used in extlinux as a fallback devicetree if none is provided by the boot command. Otherwise the only use in U-Boot seems to me efi_install_fdt() when the internal FDT is required.
The existing mechanism uses the devicetree provided to U-Boot, but in its original, unrelocated position. In my testing on an rpi_4, this ends up at 2b35ef00 which is not a convenient place in memory, if the ramdisk is large.
U-Boot already deals with this sort of problem by relocating the FDT to a safe address.
So use the control-FDT address instead.
Remove the existing comment, which is confusing, since the FDT is not actually passed unmodified to the kernel: U-Boot adds various things using its FDT-fixup mechanism.
Note that board_get_usable_ram_top() reduces the RAM top for boards with less RAM. This behaviour is left unchanged as there is no other mechanism for U-Boot to handle this.
---
Changes in v5:
- Rebase to -next
- Drop patch to add myself as a maintainer
Changes in v4:
- Expand the comment on set_fdt_addr()
- Update the commit message to talk in terms of my testing
Changes in v2:
- Drop patch to allow expanding the devicetree during relocation
board/raspberrypi/rpi/rpi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
board/raspberrypi/rpi/rpi.c +10 -7
@@ -3,6 +3,8 @@* (C) Copyright 2012-2016 Stephen Warren */ +#define LOG_CATEGORY LOGC_BOARD +#include <config.h> #include <dm.h> #include <env.h>
@@ -354,15 +356,13 @@ static void set_fdtfile(void) }/* -* If the firmware provided a valid FDT at boot time, let's expose it in -* ${fdt_addr} so it may be passed unmodified to the kernel. +* Allow U-Boot to use its control FDT with extlinux if one is not provided. +* This will then go through the usual fixups that U-Boot does, before being +* handed off to Linux */ static void set_fdt_addr (void ) { -if (fdt_magic (fw_dtb_pointer) !=FDT_MAGIC ) -return ; - -env_set_hex ("fdt_addr" , fw_dtb_pointer); +env_set_hex ("fdt_addr" , (ulong )gd->fdt_blob); }/*
@@ -608,7 +608,10 @@ int ft_board_setup(void *blob, struct bd_info *bd) {int node; -update_fdt_from_fw (blob, (void *)fw_dtb_pointer); +if (blob == gd->fdt_blob) +log_debug ("Same FDT: nothing to do\n" ); +else +update_fdt_from_fw (blob, (void *)gd->fdt_blob);if (CONFIG_IS_ENABLED (FDT_SIMPLEFB )) { node =fdt_node_offset_by_compatible (blob,-1 ,"simple-framebuffer" );
Signature · 1 line
2.43.0