
From: Simon Glass <sjg@chromium.org> At present global bootmeths always run first, before all other bootmeths. Optimisations in the code take advantage of this, putting them at the end, so they can be used once and then forgotten. In some cases it is useful to run global bootmeths later in the boot. For example, the EFI-bootmgr bootmeth may itself scan devices and the network, so running it first can hold up the boot significantly for boards not actually relying on EFI-bootmgr to boot. This series introduces a new field in global bootmeths which indicates the priority, using the same scheme as is used with bootdev hunters. Thus it is possible to insert the EFI-bootmgr bootmeth just before the hunter for network bootdevs is invoked. Despite the simplicity of the concept and the relatively small series, this is a fairly significant enhancement. It is also quite tricky to implement, largely due to the way the original code was written, with global bootmeths being a small, size-optimised add-on to the original bootstd implementation. For now we only allow each global bootmeth to run at most once, but this implementation is written in a way that we could relax that if needed. Then the bootmeth itself could decide whether to run at any particular point in the bootflow iteration. Size growth is about 390 bytes on Thumb2 (e.g. firefly-rk3288) if CONFIG_BOOTMETH_GLOBAL is enabled, which it normally is. With that disabled (which saves about 4K on the same platform), there is no growth. Simon Glass (15): boot: Improve comments related to global bootmeths boot: Add more debugging to iter_incr() boot: Move showing of bootflows out of the command boot: Add a new test for global bootmeths boot: Update first_glob_method when dropping a bootmeth boot: Add a flag for whether there are global bootmeths boot: Keep track of which bootmeths have been used boot: Move preparing bootdev into a function boot: Support rescanning the global bootmeths boot: Only run global bootmeths once each boot: Implement a priority for global bootmeths boot: Don't change the method count after global bootmeths boot: Run global bootmeths after all bootdevs are exhausted boot: Run the EFI bootmgr just before network devices boot: doc: Update for new global-bootmeth features boot/bootflow.c | 275 +++++++++++++++++++++++++++++-- boot/bootmeth-uclass.c | 15 +- boot/bootmeth_efi_mgr.c | 1 + cmd/bootflow.c | 68 +------- doc/develop/bootstd/overview.rst | 26 ++- include/bootflow.h | 29 +++- include/bootmeth.h | 4 + test/boot/bootflow.c | 73 +++++++- 8 files changed, 397 insertions(+), 94 deletions(-) -- 2.43.0 base-commit: 2617d1179c27ba51e9eb7996b7062a0205c587a9 branch: glob