mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 10:39:08 +00:00
bootstd: Allow iterating to the next label in a list
Add a function which moves to the next label in a list of labels. This allows processing the boot_targets environment variable. This works using a new label list in the bootflow iterator. The logic to set this up is included in a subsequent commit. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
66e3dce787
commit
e4b694893f
4 changed files with 123 additions and 3 deletions
|
@ -566,6 +566,25 @@ void bootdev_clear_bootflows(struct udevice *dev)
|
|||
}
|
||||
}
|
||||
|
||||
int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp,
|
||||
int *method_flagsp)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
log_debug("next\n");
|
||||
for (dev = NULL; !dev && iter->labels[++iter->cur_label];) {
|
||||
log_debug("Scanning: %s\n", iter->labels[iter->cur_label]);
|
||||
bootdev_hunt_and_find_by_label(iter->labels[iter->cur_label],
|
||||
&dev, method_flagsp);
|
||||
}
|
||||
|
||||
if (!dev)
|
||||
return log_msg_ret("fin", -ENODEV);
|
||||
*devp = dev;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* h_cmp_bootdev() - Compare two bootdevs to find out which should go first
|
||||
*
|
||||
|
@ -763,8 +782,11 @@ int bootdev_hunt(const char *spec, bool show)
|
|||
|
||||
log_debug("looking at %.*s for %s\n",
|
||||
(int)max(strlen(name), len), spec, name);
|
||||
if (spec && strncmp(spec, name, max(strlen(name), len)))
|
||||
continue;
|
||||
if (spec && strncmp(spec, name, max(strlen(name), len))) {
|
||||
if (info->uclass != UCLASS_ETH ||
|
||||
(strcmp("dhcp", spec) && strcmp("pxe", spec)))
|
||||
continue;
|
||||
}
|
||||
ret = bootdev_hunt_drv(info, i, show);
|
||||
if (ret)
|
||||
result = ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue