[PATCH v6 0/2] Improve disk image detection in efi_bootmgr

Javier Tia javier.tia at linaro.org
Thu Sep 25 01:31:18 CEST 2025


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.

Include part.h in the EFI loader and export part_driver_lookup_type and
add its prototype and documentation in include/part.h. This makes the
partition-driver lookup available to other code paths that need to
detect partition tables on a block descriptor.

---
Changes in v6:
- Fix U-Boot CI build error.
- Split changes in two commits for clearer review.

- v5 link: https://lore.kernel.org/u-boot/20250905172330.135550-1-javier.tia@linaro.org/
- v4 link: https://lore.kernel.org/u-boot/20250903214417.431985-1-javier.tia@linaro.org/
- v3 link: https://lore.kernel.org/u-boot/20250829155415.90634-1-javier.tia@linaro.org/
- v2 link: https://lore.kernel.org/u-boot/20250808213627.649669-1-javier.tia@linaro.org/
- v1 link: https://lore.kernel.org/u-boot/20250805162158.117876-1-javier.tia@linaro.org/

Javier Tia (2):
  part: Export part_driver_lookup_type for external use
  efi_loader: Improve disk image detection in efi_bootmgr

 disk/part.c                  |  2 +-
 include/part.h               | 21 +++++++++++++++
 lib/efi_loader/efi_bootmgr.c | 51 +++++++++++++++++++++++++-----------
 3 files changed, 58 insertions(+), 16 deletions(-)

-- 
2.51.0



More information about the U-Boot mailing list