[Concept,08/16] bootstd: Also scan BLS target partitions by type
Commit Message
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(-)
@@ -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 {