[Concept,08/16] bootstd: Also scan BLS target partitions by type

Message ID 20260421183511.2044469-9-sjg@u-boot.org
State New
Headers
Series efi-x86: Boot Ubuntu live ISOs via U-Boot + BLS, end to end |

Commit Message

Simon Glass April 21, 2026, 6:34 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

The Boot Loader Specification says a boot loader should discover Type #1
entries by locating the ESP and XBOOTLDR partitions (or an MBR type 0xea
partition) and reading loader/entry*.conf from them. It never mentions
the bootable attribute.

U-Boot's bootflow iterator currently skips any non-bootable partition
once a bootable one has been seen, which means a disk with only an ESP
and no 'bootable' flag (e.g. some hybrid media layouts) is not scanned
for BLS entries at all.

Also call part_is_bls_target() when deciding to skip, so ESP and
XBOOTLDR partitions are always tried regardless of the flag. Existing
bootable-partition behaviour is unchanged.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/bootdev-uclass.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
  

Patch

diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index faed1f3e5df..91d27d1e212 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -167,10 +167,16 @@  int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
 		 * for filesystems or partition contents on this disk
 		 */
 
-	/* if there are bootable partitions, scan only those */
+	/*
+	 * If there are bootable partitions, scan only those, plus any Boot
+	 * Loader Specification target partitions (ESP, XBOOTLDR, MBR 0xea)
+	 * which BLS discovery requires regardless of the bootable attribute.
+	 */
 	} else if ((iter->flags & BOOTFLOWIF_ONLY_BOOTABLE) &&
 		   iter->first_bootable >= 0 &&
-		   (iter->first_bootable ? !info.bootable : iter->part != 1)) {
+		   (iter->first_bootable ? !info.bootable : iter->part != 1) &&
+		   !(CONFIG_IS_ENABLED(BOOTMETH_BLS) &&
+		     part_is_bls_target(&info))) {
 		log_debug("Skipping non-bootable partition %d\n", iter->part);
 		return log_msg_ret("boot", -EINVAL);
 	} else {