diff options
| author | Tom Rini <[email protected]> | 2024-04-02 07:03:25 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-04-02 07:03:25 -0400 |
| commit | d312d9831f25a8e70d64df46fb2fe9aab2e8c939 (patch) | |
| tree | 9afa8b258222e66221f8239d8ad51372d63c5ac3 /boot/bootdev-uclass.c | |
| parent | 25049ad560826f7dc1c4740883b0016014a59789 (diff) | |
| parent | bc39e06778168a34bb4e0a34fbee4edbde4414d8 (diff) | |
Merge branch 'next'
Merge in all changes from the next branch now that the release is out.
Diffstat (limited to 'boot/bootdev-uclass.c')
| -rw-r--r-- | boot/bootdev-uclass.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 35afb93c0e7..46815ea2fdb 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -39,7 +39,6 @@ int bootdev_add_bootflow(struct bootflow *bflow) struct bootflow *new; int ret; - assert(bflow->dev); ret = bootstd_get_priv(&std); if (ret) return ret; @@ -173,8 +172,10 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, */ iter->max_part = MAX_PART_PER_BOOTDEV; - /* If this is the whole disk, check if we have bootable partitions */ - if (!iter->part) { + if (iter->flags & BOOTFLOWIF_SINGLE_PARTITION) { + /* a particular partition was specified, scan it without checking */ + } else if (!iter->part) { + /* This is the whole disk, check if we have bootable partitions */ iter->first_bootable = part_get_bootable(desc); log_debug("checking bootable=%d\n", iter->first_bootable); } else if (allow_any_part) { @@ -711,8 +712,37 @@ int bootdev_setup_iter(struct bootflow_iter *iter, const char *label, struct udevice *bootstd, *dev = NULL; bool show = iter->flags & BOOTFLOWIF_SHOW; int method_flags; + char buf[32]; int ret; + if (label) { + const char *end = strchr(label, ':'); + + if (end) { + size_t len = (size_t)(end - label); + const char *part = end + 1; + + if (len + 1 > sizeof(buf)) { + log_err("label \"%s\" is way too long\n", label); + return -EINVAL; + } + + memcpy(buf, label, len); + buf[len] = '\0'; + label = buf; + + unsigned long tmp; + + if (strict_strtoul(part, 0, &tmp)) { + log_err("Invalid partition number: %s\n", part); + return -EINVAL; + } + + iter->flags |= BOOTFLOWIF_SINGLE_PARTITION; + iter->part = tmp; + } + } + ret = uclass_first_device_err(UCLASS_BOOTSTD, &bootstd); if (ret) { log_err("Missing bootstd device\n"); |
