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 | |
| 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')
| -rw-r--r-- | boot/bootdev-uclass.c | 36 | ||||
| -rw-r--r-- | boot/bootflow.c | 3 | ||||
| -rw-r--r-- | boot/image-fdt.c | 4 | ||||
| -rw-r--r-- | boot/image-sig.c | 8 | ||||
| -rw-r--r-- | boot/pxe_utils.c | 27 |
5 files changed, 66 insertions, 12 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"); diff --git a/boot/bootflow.c b/boot/bootflow.c index 05484fd5b1b..68bf99329ab 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -217,6 +217,9 @@ static int iter_incr(struct bootflow_iter *iter) } } + if (iter->flags & BOOTFLOWIF_SINGLE_PARTITION) + return BF_NO_MORE_DEVICES; + /* No more bootmeths; start at the first one, and... */ iter->cur_method = 0; iter->method = iter->method_order[iter->cur_method]; diff --git a/boot/image-fdt.c b/boot/image-fdt.c index 75bdd55f326..5e4aa9de0d2 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -217,14 +217,14 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) if (start + size < low) continue; - usable = min(size, (u64)mapsize); + usable = min(start + size, (u64)(low + mapsize)); /* * At least part of this DRAM bank is usable, try * using it for LMB allocation. */ of_start = map_sysmem((ulong)lmb_alloc_base(lmb, - of_len, 0x1000, start + usable), of_len); + of_len, 0x1000, usable), of_len); /* Allocation succeeded, use this block. */ if (of_start != NULL) break; diff --git a/boot/image-sig.c b/boot/image-sig.c index b5692d58b24..0421a61b040 100644 --- a/boot/image-sig.c +++ b/boot/image-sig.c @@ -17,6 +17,7 @@ DECLARE_GLOBAL_DATA_PTR; #define IMAGE_MAX_HASHED_NODES 100 struct checksum_algo checksum_algos[] = { +#if CONFIG_IS_ENABLED(SHA1) { .name = "sha1", .checksum_len = SHA1_SUM_LEN, @@ -24,6 +25,8 @@ struct checksum_algo checksum_algos[] = { .der_prefix = sha1_der_prefix, .calculate = hash_calculate, }, +#endif +#if CONFIG_IS_ENABLED(SHA256) { .name = "sha256", .checksum_len = SHA256_SUM_LEN, @@ -31,7 +34,8 @@ struct checksum_algo checksum_algos[] = { .der_prefix = sha256_der_prefix, .calculate = hash_calculate, }, -#ifdef CONFIG_SHA384 +#endif +#if CONFIG_IS_ENABLED(SHA384) { .name = "sha384", .checksum_len = SHA384_SUM_LEN, @@ -40,7 +44,7 @@ struct checksum_algo checksum_algos[] = { .calculate = hash_calculate, }, #endif -#ifdef CONFIG_SHA512 +#if CONFIG_IS_ENABLED(SHA512) { .name = "sha512", .checksum_len = SHA512_SUM_LEN, diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 83bc1677856..96205626750 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -634,7 +634,12 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) char *fdtfilefree = NULL; if (label->fdt) { - fdtfile = label->fdt; + if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { + if (strcmp("-", label->fdt)) + fdtfile = label->fdt; + } else { + fdtfile = label->fdt; + } } else if (label->fdtdir) { char *f1, *f2, *f3, *f4, *slash; @@ -731,14 +736,26 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) zboot_argc = 5; } - if (!bootm_argv[3]) - bootm_argv[3] = env_get("fdt_addr"); + if (!bootm_argv[3]) { + if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { + if (strcmp("-", label->fdt)) + bootm_argv[3] = env_get("fdt_addr"); + } else { + bootm_argv[3] = env_get("fdt_addr"); + } + } kernel_addr_r = genimg_get_kernel_addr(kernel_addr); buf = map_sysmem(kernel_addr_r, 0); - if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT) - bootm_argv[3] = env_get("fdtcontroladdr"); + if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT) { + if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { + if (strcmp("-", label->fdt)) + bootm_argv[3] = env_get("fdtcontroladdr"); + } else { + bootm_argv[3] = env_get("fdtcontroladdr"); + } + } if (bootm_argv[3]) { if (!bootm_argv[2]) |
