[PATCH] boot: Warn users about fdt_high=~0 usage

Tom Rini trini at konsulko.com
Thu Nov 13 16:49:00 CET 2025


On Thu, Nov 13, 2025 at 03:29:51PM +0100, Marek Vasut wrote:

> In case the 'fdt_high' environment variable is set to ~0 and DT is
> at non-8-byte aligned offset, warn users about the dangers of the
> fdt_high usage. This will hopefully lead to removal of most of the
> fdt_high ~0 usage over time.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: "João Paulo Gonçalves" <joao.goncalves at toradex.com>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Sam Protsenko <semen.protsenko at linaro.org>
> Cc: Sughosh Ganu <sughosh.ganu at linaro.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: u-boot at lists.denx.de
> ---
>  boot/image-fdt.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/boot/image-fdt.c b/boot/image-fdt.c
> index 3f0ac54f76f..e88525a3846 100644
> --- a/boot/image-fdt.c
> +++ b/boot/image-fdt.c
> @@ -189,6 +189,10 @@ int boot_relocate_fdt(char **of_flat_tree, ulong *of_size)
>  			/* All ones means use fdt in place */
>  			of_start = fdt_blob;
>  			addr = map_to_sysmem(fdt_blob);
> +			if (addr & 7) {
> +				printf("WARNING: The 'fdt_high' environment variable is set to ~0 and DT is at non-8-byte aligned address.\nWARNING: This system will likely fail to boot. Unset 'fdt_high' environment variable and submit fix upstream.\n");
> +			}
> +
>  			err = lmb_alloc_mem(LMB_MEM_ALLOC_ADDR, 0, &addr,
>  					    of_len, LMB_NONE);
>  			if (err) {

I think we need to yell about it sooner. Today (and for quite some
years) if you pass a 4 byte and not 8 byte aligned DT to Linux, it fails
to boot or breaks in loud and odd ways. This has in turn lead to much
time spent and some of our older threads with the libfdt folks years
ago. So I think we need something earlier in code where we're seeing
that fdt_high is set to ~0 and that's where we say "Stop doing this, it
will be removed soon". Historically it was either used to work-around
problems that don't exist anymore, or as a misguided boot time
optimization (this is different from disabling initrd relocation, which
can be noticeable).

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20251113/5a0a9056/attachment.sig>


More information about the U-Boot mailing list