diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:47:42 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:40 -0500 |
commit | f0e358f07d75579b40eff8f723b280ab5d53d338 (patch) | |
tree | dd22560415627197881a374a11b4d55f4fff5af2 /boot/bootdev-uclass.c | |
parent | dcffa4428d0359fd09348fc05cf5b5ce2db38c5f (diff) | |
download | u-boot-f0e358f07d75579b40eff8f723b280ab5d53d338.tar.gz |
bootstd: Only scan bootable partitions
At present all partitions are scanned, whether marked bootable or not.
Use only bootable partitions, defaulting to partition 1 if none is
found.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootdev-uclass.c')
-rw-r--r-- | boot/bootdev-uclass.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 081b94ce33..3dcf317c15 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -163,7 +163,15 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, */ iter->max_part = MAX_PART_PER_BOOTDEV; - if (iter->part) { + /* If this is the whole disk, check if we have bootable partitions */ + if (!iter->part) { + iter->first_bootable = part_get_bootable(desc); + log_debug("checking bootable=%d\n", iter->first_bootable); + + /* if there are bootable partitions, scan only those */ + } else if (iter->first_bootable ? !info.bootable : iter->part != 1) { + return log_msg_ret("boot", -EINVAL); + } else { ret = fs_set_blk_dev_with_part(desc, bflow->part); bflow->state = BOOTFLOWST_PART; |