efi_loader: Improve disk image detection in efi_bootmgr
authorJavier Tia <javier.tia@linaro.org>
Thu, 9 Oct 2025 13:17:47 +0000 (07:17 -0600)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 14 Oct 2025 07:30:56 +0000 (10:30 +0300)
commit038ca2c803cd0f51dad7ebd1d3da96118fb67056
tree3aa2bdfab7a96d8df71e6be345136d2e2cce3494
parent28c341ca07169ac8caf9895667938d74bc0119ae
efi_loader: Improve disk image detection in efi_bootmgr

Enhances the process for identifying disk images within the EFI boot
manager. Utilize part_driver_lookup_type() to verify the validity of a
downloaded file as a disk image, rather than depending on file
extensions.

part_driver_lookup_type() is now used in the prepare_loaded_image()
function in the EFI boot manager to detect partitions on a block device
created from a downloaded image. This allows the boot manager to boot
from any disk image that can be recognized by a partition driver, not
just ISO and IMG images.

Update prepare_loaded_image() to create the ramdisk block device
internally, obtain the blk_desc and use part_driver_lookup_type() to
detect a valid partition table.

In try_load_from_uri_path(), try prepare_loaded_image() first to detect
disk images, and fall back to PE-COFF detection only if that fails.

Signed-off-by: Javier Tia <javier.tia@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_bootmgr.c