Subject: [PATCH] bootloader: extlinux: support for optional FDTDIR

From: Pavel Shlyak <[email-masked]>
Date: Thu, 25 Aug 2022 22:16:48 +0300

Hello, Mathieu
Thanks for joining us here!

Firstly, I kindly ask everyone in this thread to CC me as emails from this thread are not delivered to me for some reason I don’t really understand. I get emails from all other threads but this one.

Secondly, to reply you question "where is located the device tree that is loaded?", I would like to refer uboot source code comments, as I have not seen this point documented anywhere else. Check boot/pxe_utils.c

/*
	 * fdt usage is optional:
	 * It handles the following scenarios.
	 *
	 * Scenario 1: If fdt_addr_r specified and "fdt" or "fdtdir" label is
	 * defined in pxe file, retrieve fdt blob from server. Pass fdt_addr_r to
	 * bootm, and adjust argc appropriately.
	 *
	 * If retrieve fails and no exact fdt blob is specified in pxe file with
	 * "fdt" label, try Scenario 2.
	 *
	 * Scenario 2: If there is an fdt_addr specified, pass it along to
	 * bootm, and adjust argc appropriately.
	 *
	 * Scenario 3: If there is an fdtcontroladdr specified, pass it along to
	 * bootm, and adjust argc appropriately.
	 *
	 * Scenario 4: fdt blob is not available.
	 */

In other words, if there’s no fdtdir, uboot just passes the fdt_addr to bootm command, that means it passes the pointer to device tree loaded by firmware (or previous bootloader) to the kernel. If fdt_addr is also missing, it passes fdtcontroladdr to the kernel. If all of the previous scenarios don’t work, it passes no FDT and kernel boots without device tree, that is absolutely normal on some devices, check x86.

As for the tests and documentation, I think I should leave these questions to Reza, as they have more experience and deeper understanding.

Sincerely,
Pavel