diff options
| author | Simon Glass <[email protected]> | 2025-10-15 16:44:13 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-10-22 14:16:56 -0600 |
| commit | 060ce66b83e5ed19180103c26e525d85c2a2aa8b (patch) | |
| tree | 9bb650e623483eedcadebf3ef2d820f4c4fab8cc /boot | |
| parent | eff1dca96330269c8281b17d00f5d2d0e62bd26e (diff) | |
boot: Run global bootmeths after all bootdevs are exhausted
When there are no more bootdevs we should still go through the global
bootmeths, since some may not have yet been used, if their priority has
not yet come up.
Add a final check for this at the end of the iterator.
Update the documentation to match the new behaviour of global bootmeths.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/bootflow.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/boot/bootflow.c b/boot/bootflow.c index 38b8af916b2..d8a4a81a838 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -354,6 +354,18 @@ static int iter_incr(struct bootflow_iter *iter) return 0; } + /* if this was the final global bootmeth check, we are done */ + if (iter->cur_prio == BOOTDEVP_COUNT) { + log_debug("-> done global bootmeths\n"); + + /* print the same message as bootflow_iter_set_dev() */ + if ((iter->flags & (BOOTFLOWIF_SHOW | + BOOTFLOWIF_SINGLE_DEV)) == + BOOTFLOWIF_SHOW) + printf("No more bootdevs\n"); + return BF_NO_MORE_DEVICES; + } + /* * Don't move to the next dev as we haven't tried this * one yet! @@ -459,6 +471,17 @@ static int iter_incr(struct bootflow_iter *iter) ret = prepare_bootdev(iter, dev, method_flags, true); } + if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && ret) { + log_debug("no more bootdevs, trying global\n"); + + /* allow global bootmeths with any priority */ + iter->cur_prio = BOOTDEVP_COUNT; + if (!next_glob_bootmeth(iter)) { + log_debug("-> next method '%s'\n", iter->method->name); + return 0; + } + } + /* if there are no more bootdevs, give up */ if (ret) return log_msg_ret("incr", BF_NO_MORE_DEVICES); |
