pxe_utils: small fixups, implement BLS type 1 boot on top of them
Get series with b4
b4 am [email protected] change-id 20260604-bls-db6a30b913aeVersions newest first
- v2 Latest13 patches 1 replyIn review
- v17 patches 26 repliesSuperseded
Changes in v2 from the cover letter
- Dropped "default y" to avoid increasing image size for platforms which don't use Freedesktop-style userspace and won't benefit from BLS (thanks Tom)
- Fixed typo referring to BLS type 2 when type 1 was meant (thanks Simon)
- Added a kerneldoc for parse_label_keys() upon factoring it out, not just when it gets exported to a shared header (thanks Simon)
- Shared the pxelinux getfile helper rather than making a third copy of it in the new bootmeth (thanks Simon). It moves to a translation unit of its own, so that PXE_UTILS users without bootstd don't gain a dependency on the bootmeth uclass, and boards without PXE_UTILS don't pay for it
- Allocated the entry buffer with ARCH_DMA_MINALIGN rather than 1 (thanks Simon)
- Stopped retaining the parsed label in bflow->bootmeth_priv, which the core frees flat and would therefore leak (thanks Simon). It turned out to be worse than a leak: a bootflow is shallow-copied into the bootflow list, so the pointer was shared between the iterator's temporary and the stored copy and could be freed twice. bls_boot() now re-parses bflow->buf, as extlinux does
- Added a test for entries found under the '/boot/' prefix rather than at the root of the filesystem (thanks Simon for asking what happens there). No code change was needed
- Dropped the number prefix from the driver name (thanks Simon)
- Added sandbox tests and updated the bootmeth/bootflow expectations that binding a third bootmeth changes, plus a doc/develop/bootstd page (thanks Simon)
- Added a patch hardening the "append" parser. A bare "append" dereferenced NULL, and an "initrd=" at end-of-line computed a negative length before malloc()
- Link to v1: https://patch.msgid.link/[email protected]
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | pxe_utils: fix W=1 kernel-doc warningsboot/ | +12 | 0 replies | |
| 2/13 | pxe_utils: accept "options" as synonym for "append"boot/ | +1 | 0 replies | |
| 3/13 | pxe_utils: harden the "append" parser against malformed inputboot/ | +6 | 0 replies | |
| 4/13 | pxe_utils: extract per-entry key parsing into parse_label_keys()boot/ | +43 | 0 replies | |
| 5/13 | pxe_utils: export per-entry label helpersboot/ include/ | +60 | 0 replies | |
| 6/13 | pxe_utils: optionally ignore unknown keys in parse_label_keys()boot/ include/ | +34 | 0 replies | |
| 7/13 | pxe_utils: accept "title" inside a label as a synonym for "menu label"boot/ | +13 | 0 replies | |
| 8/13 | bootmeth: share the pxelinux getfile helperboot/ boot/ boot/ +3 more | +67 | 0 replies | |
| 9/13 | boot: add a minimal bootmeth for the Boot Loader Specificationboot/ boot/ boot/ | +387 | 0 replies | |
| 10/13 | test: bootstd: add a BLS entry to the Fedora fixture imagetest/ | +40 | 0 replies | |
| 11/13 | sandbox: enable BLS boot methodarch/ configs/ test/ +2 more | +332 | 0 replies | |
| 12/13 | test: bootstd: cover BLS entries below a prefixarch/ test/ test/ | +163 | 0 replies | |
| 13/13 | doc: bootstd: describe the BLS bootmethdoc/ doc/ doc/ | +58 | 0 replies |
Reviews trailers per patch
2 of 13 patches have a Reviewed-by or Acked-by.
| Patch | Tom Rini | Simon Glass |
|---|---|---|
| 1/13 | R-b | R-b |
| 2/13 | R-b | |
| 3/13 | ||
| 4/13 | ||
| 5/13 | ||
| 6/13 | ||
| 7/13 | ||
| 8/13 | ||
| 9/13 | ||
| 10/13 | ||
| 11/13 | ||
| 12/13 | ||
| 13/13 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 00/13] pxe_utils: small fixups, implement BLS type 1 boot on top of them
Add support for the Boot Loader Specification (BLS) type 1 boot entries, as generated by default by systemd's kernel-install when loader=bls.
Given that the format of BLS entries is pretty much the same as PXElinux, reuse the existing library for the parsing logic.
BLS type 2 entries are out of scope, as they are effectively just EFI applications and should be booted as such.
This implementation is also only allowing a single top-sorting entry to boot, as the standard boot infrastruture currently doesn't support multiple entries per partition-bootmeth tuple. I have a proposed extension to enable that and will post it separately as RFC - that enables the use of bootflow menu to select the kernel to boot without jumping through several menus with different behavior as is currently required with extlinux.conf.
CI passes all green [1]
[1] https://git.u-boot-project.org/u-boot/contributors/alchark/u-boot/-/pipelines/1089
---
Changes in v2:
- Dropped "default y" to avoid increasing image size for platforms which don't use Freedesktop-style userspace and won't benefit from BLS (thanks Tom)
- Fixed typo referring to BLS type 2 when type 1 was meant (thanks Simon)
- Added a kerneldoc for parse_label_keys() upon factoring it out, not just when it gets exported to a shared header (thanks Simon)
- Shared the pxelinux getfile helper rather than making a third copy of it in the new bootmeth (thanks Simon). It moves to a translation unit of its own, so that PXE_UTILS users without bootstd don't gain a dependency on the bootmeth uclass, and boards without PXE_UTILS don't pay for it
- Allocated the entry buffer with ARCH_DMA_MINALIGN rather than 1 (thanks Simon)
- Stopped retaining the parsed label in bflow->bootmeth_priv, which the core frees flat and would therefore leak (thanks Simon). It turned out to be worse than a leak: a bootflow is shallow-copied into the bootflow list, so the pointer was shared between the iterator's temporary and the stored copy and could be freed twice. bls_boot() now re-parses bflow->buf, as extlinux does
- Added a test for entries found under the '/boot/' prefix rather than at the root of the filesystem (thanks Simon for asking what happens there). No code change was needed
- Dropped the number prefix from the driver name (thanks Simon)
- Added sandbox tests and updated the bootmeth/bootflow expectations that binding a third bootmeth changes, plus a doc/develop/bootstd page (thanks Simon)
- Added a patch hardening the "append" parser. A bare "append" dereferenced NULL, and an "initrd=" at end-of-line computed a negative length before malloc()
- Link to v1: https://patch.msgid.link/[email protected]
To: [email protected]
Cc: Tom Rini <[email protected]>
Cc: Alexey Charkov <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Daniel Golle <[email protected]>
Cc: Johan Jonker <[email protected]>
Cc: "Lucien.Jheng" <[email protected]>
Cc: Casey Connolly <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Vincent Jardin <[email protected]>
Cc: Denis Mukhin <[email protected]>
Cc: Aristo Chen <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Marek Vasut <[email protected]>
---
Alexey Charkov (13):
pxe_utils: fix W=1 kernel-doc warnings
pxe_utils: accept "options" as synonym for "append"
pxe_utils: harden the "append" parser against malformed input
pxe_utils: extract per-entry key parsing into parse_label_keys()
pxe_utils: export per-entry label helpers
pxe_utils: optionally ignore unknown keys in parse_label_keys()
pxe_utils: accept "title" inside a label as a synonym for "menu label"
bootmeth: share the pxelinux getfile helper
boot: add a minimal bootmeth for the Boot Loader Specification
test: bootstd: add a BLS entry to the Fedora fixture image
sandbox: enable BLS boot method
test: bootstd: cover BLS entries below a prefix
doc: bootstd: describe the BLS bootmeth
arch/sandbox/dts/test.dts | 12 + boot/Kconfig | 24 ++ boot/Makefile | 2 + boot/bootmeth_bls.c | 370 +++++++++++++++++++++++++++++++ boot/bootmeth_extlinux.c | 20 -- boot/bootmeth_pxe.c | 22 +- boot/bootmeth_pxe_common.c | 34 +++ boot/pxe_utils.c | 146 +++++++----- configs/sandbox_defconfig | 1 + doc/develop/bootstd/bls.rst | 56 +++++ doc/develop/bootstd/index.rst | 1 + doc/develop/bootstd/overview.rst | 1 + include/extlinux.h | 23 ++ include/pxe_utils.h | 62 ++++++ test/boot/bootdev.c | 14 ++ test/boot/bootflow.c | 467 +++++++++++++++++++++++++++++++-------- test/boot/bootmeth.c | 38 +++- test/py/tests/test_ut.py | 122 ++++++++-- 18 files changed, 1200 insertions(+), 215 deletions(-)
---
base-commit: 2d379a529c257606946831a6dac1c37de6a3f8c0
change-id: 20260604-bls-db6a30b913ae
Best regards,
Signature · 1 line
Alexey Charkov <[email protected]>