]> git.ipfire.org Git - thirdparty/u-boot.git/commit
common: Add an option to relocate on ram top
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Wed, 17 Jun 2026 07:48:23 +0000 (10:48 +0300)
committerTom Rini <trini@konsulko.com>
Thu, 25 Jun 2026 00:13:24 +0000 (18:13 -0600)
commit55a34217698491cc0bb8d53d630644dc8756629c
treec3ee2c86e5dacb429866dcc5fb7ebd023d585aff
parentd19d9e1c064b6c782959d1da7bddf1e9da1c55d4
common: Add an option to relocate on ram top

Right now we only relocate u-boot to the top of the first
memory bank unless the board specific code overwrites it.
This is problematic when loading big binaries as it
fragments the contiguous memory space for no apparent reason.

On certain platforms, it is currently not possible to relocate U-Boot
above the 32bit boundary, due to various dependencies on content located
below the 32bit boundary. One such example is ethernet, where the packet
buffer built into U-Boot binary is placed below the 32bit boundary and
allows loading of data via ethernet even above 32bit boundary due to
memory copy from the packet buffer to the destination location.

A previous patch moves the bi_dram[] info from bd to gd and make
the memory bank information available early. So move the
dram_init_banksize() INITCALL before the relocation address calculation
and use it to derive the address.

Also add a Kconfig option and allow the common code to relocate U-Boot
to the top of the last discovered bank.
It's worth noting that this patch changes when dram_init_banksize()
is called. It's now called  much earlier in the board init process.
That is a significant ordering change for every board with a custom
dram_init_banksize(), and it is unconditional (not gated on RELOC_ADDR_TOP).

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # Radxa ROCK 5B
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Kconfig
common/board_f.c