Hi Carlo,

On 2026-07-28T13:20:42, Carlo Caione <[email protected]> wrote:
> efi_loader: bootmgr: install the firmware-owned devicetree
>
> SystemReady IR can boot through the UEFI boot manager without going
> through the per-device EFI bootmeth. Use the shared staging helper here
> as well so both EFI launch paths install the same firmware-owned
> devicetree.
>
> The precedence is an explicitly passed FDT, firmware-owned FDT, Boot####
> load-option FDT, then distro/ESP FDT. A configured source fails closed,
> and assembly failures are reported as EFI_DEVICE_ERROR.
>
> Route load-option errors through the common cleanup path while adding it.
>
> Signed-off-by: Carlo Caione <[email protected]>
>
> lib/efi_loader/efi_bootmgr.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)

> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> @@ -1320,13 +1323,27 @@ efi_status_t efi_bootmgr_run(void *fdt)
> +             if (!fdt) {
> +                     ulong fdt_addr = env_get_hex("fdt_addr_r", 0);
> +                     int err;
> +
> +                     err = efi_stage_firmware_fdt(fdt_addr, &fdt_size, NULL);

fdt_size is efi_uintn_t (size_t) but efi_stage_firmware_fdt() takes
ulong * -- on builds where size_t and unsigned long are distinct this
will warn, and is arguably a strict-aliasing issue. Patch 3 declares a
separate ulong fw_fdt_size in bootmeth_efi.c for exactly this reason -
please do the same here rather than aliasing the distro-FDT size
variable. That also decouples the cleanup at 'out:', where the size
passed to efi_free_pages() only happens to be correct because
fdt_distro is NULL on the firmware-FDT path.

> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> @@ -1320,13 +1323,27 @@ efi_status_t efi_bootmgr_run(void *fdt)
> +                     err = efi_stage_firmware_fdt(fdt_addr, &fdt_size, NULL);

Please pass a non-NULL namep so a failure to stage the firmware-owned
FDT can be logged with the FIT filename, matching what bootmeth_efi
does via bflow->fdt_fname

Regards,
Simon

Reply via email to