Re: [PATCH v2 3/5] bootmeth: efi: use the firmware-owned devicetree

Simon Glass <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <CAFLszTiJ_ksiogKHWJBZKbGz+i57dNUBcbwRyaYMyuJaCq-VLg__13961.4356261276$1786819490$gmane$org@mail.gmail.com>
Hi Carlo,

On 2026-07-28T13:20:42, Carlo Caione <[email protected]> wrote:
> bootmeth: efi: use the firmware-owned devicetree
>
> When a firmware-owned devicetree source is configured, stage it at the
> same fdt_addr_r value used by the normal EFI bootmeth fallback and pass it
> through bflow->fdt_addr to efi_install_fdt().
>
> Use the shared helper in both disk and network paths. Only -ENOENT, meaning
> that no source is configured, permits the existing ESP, network or
> prior-stage fallback. Any failure after a source is configured ends that
> bootflow.
>
> The firmware-owned devicetree is complete and authoritative, so do not
> apply extension-board overlays on top of it; those combinations belong in
> the FIT.
>
> Signed-off-by: Carlo Caione <[email protected]>
>
> boot/bootmeth_efi.c | 45 +++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 39 insertions(+), 6 deletions(-)

> diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
> @@ -130,6 +131,22 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,
> +     ret = efi_stage_firmware_fdt(fdt_addr, &fw_fdt_size,
> +                                  &bflow->fdt_fname);
> +     if (!ret) {
> +             bflow->fdt_size = fw_fdt_size;
> +             bflow->fdt_addr = fdt_addr;
> +             return 0;
> +     }

Just to check: distro_efi_try_bootflow_files() runs per candidate
bootflow, so on a machine with several block devices/partitions the
firmware FIT will be re-read, re-verified and re-assembled for every
scan. Since the source is fixed by the control DT, is there any reason
not to cache the assembled result across bootflows? It would also make
the fail-closed policy cheaper to enforce.

> diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
> @@ -279,10 +314,8 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
> -     fdt_addr_str = env_get("fdt_addr_r");
> -     if (!fdt_addr_str)
> +     if (!fdt_addr)
>               return log_msg_ret("fdt", -EINVAL);
> -     fdt_addr = hextoul(fdt_addr_str, NULL);

BTW this will reject a 0 address, but that seems fine as it should not
occur in practice.

Regards,
Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.