public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v4 00/11] boot: Support priority for global bootmeths
@ 2025-10-15 15:44 Simon Glass
  2025-10-15 15:44 ` [PATCH v4 01/11] boot: Try all bootmeths on the final partition Simon Glass
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Simon Glass @ 2025-10-15 15:44 UTC (permalink / raw)
  To: u-boot
  Cc: Heinrich Schuchardt, Tom Rini, Simon Glass, Andrew Goodbody,
	Guillaume La Roque, Jerome Forissier, Martin Schwan, Martyn Welch,
	Mattijs Korpershoek, Maximilian Brune, Moritz Fischer,
	Sam Protsenko

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.

Changes in v4:
- Reword the commit message as Tom suggested
- Drop call to bootflow_show()
- Rebase on top of -master

Changes in v3:
- Pull doc changes into this patch

Changes in v2:
- Add a bit more detail suggested by Heinrich
- Update commit message to indicate the bootmeth will always run
- Document how the priority was chosen

Simon Glass (11):
  boot: Try all bootmeths on the final partition
  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: 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/bootflow.c                  | 181 ++++++++++++++++++++++++++++---
 boot/bootmeth-uclass.c           |  11 ++
 boot/bootmeth_efi_mgr.c          |   9 ++
 doc/develop/bootstd/overview.rst |  40 ++++++-
 include/bootflow.h               |  19 +++-
 include/bootmeth.h               |   4 +
 test/boot/bootflow.c             |  72 +++++++++++-
 7 files changed, 307 insertions(+), 29 deletions(-)

-- 
2.43.0

base-commit: 996ded5463fd48497b6aa904a5647c2533d73ab3
branch: globa-us4

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-10-22 22:16 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 15:44 [PATCH v4 00/11] boot: Support priority for global bootmeths Simon Glass
2025-10-15 15:44 ` [PATCH v4 01/11] boot: Try all bootmeths on the final partition Simon Glass
2025-10-15 19:04   ` Tom Rini
2025-10-16 12:55     ` Heinrich Schuchardt
2025-10-16 15:33       ` Tom Rini
2025-10-15 15:44 ` [PATCH v4 02/11] boot: Add a new test for global bootmeths Simon Glass
2025-10-15 15:44 ` [PATCH v4 03/11] boot: Update first_glob_method when dropping a bootmeth Simon Glass
2025-10-15 15:44 ` [PATCH v4 04/11] boot: Add a flag for whether there are global bootmeths Simon Glass
2025-10-15 15:44 ` [PATCH v4 05/11] boot: Keep track of which bootmeths have been used Simon Glass
2025-10-15 15:44 ` [PATCH v4 06/11] boot: Support rescanning the global bootmeths Simon Glass
2025-10-15 15:44 ` [PATCH v4 07/11] boot: Only run global bootmeths once each Simon Glass
2025-10-15 15:44 ` [PATCH v4 08/11] boot: Implement a priority for global bootmeths Simon Glass
2025-10-15 15:44 ` [PATCH v4 09/11] boot: Don't change the method count after " Simon Glass
2025-10-15 15:44 ` [PATCH v4 10/11] boot: Run global bootmeths after all bootdevs are exhausted Simon Glass
2025-10-15 15:44 ` [PATCH v4 11/11] boot: Run the EFI bootmgr just before network devices Simon Glass
2025-10-15 19:09 ` [PATCH v4 00/11] boot: Support priority for global bootmeths Tom Rini
2025-10-22 22:16 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox