mbox series

[v5,0/4] cmd: bootefi: refactor the code for bootmgr

Message ID 20240117043944.477358-1-takahiro.akashi@linaro.org
Headers show
Series cmd: bootefi: refactor the code for bootmgr | expand

Message

AKASHI Takahiro Jan. 17, 2024, 4:39 a.m. UTC
This patch set is motivated by the discussion[1] regarding
CONFIG_BOOTEFI_BOOTMGR option.

# This version (v5) contains only the remaining commits.

At the end, bootefi.c will be decomposed into two parts, one for
providing the command itself and one for implementing helper functions.
EFI_LOADER will now be available without CONFIG_CMDLINE or specifically
CONFIG_CMD_BOOTEFI if invoked via bootmeth/bootstd.

Then, EFI_LOADER library side will be further split into two options
for fine-grain control:
CONFIG_EFI_BINARY_EXEC: execute UEFI binaries which are to be explicitly
    loaded by U-Boot's load commands/functions or other methods
    (like a jtag debugger?)
    It supports bootmeth_efi as well as "bootefi <addr>|hello"(/"bootm"?).

CONFIG_EFI_BOOTMGR: provide EFI boot manger functionality
    It supports bootmeth_efi_mgr as well as "bootefi bootmgr".

As such, We will no longer need CONFIG_EFI_BINARY_EXEC if we want to only
make use of the UEFI boot manger for booting a next stage OS.

Prerequisite
============
This patch set is based on top of the latest "master" branch.

Tests
=====
* ran and passed py/efi_selftest on sandbox locally
* ran and passed py/test_efi_bootmgr on sandbox locally
* passed CI check (github pull request[2])

Changes
=======
v4 (Jan 17, 2024)
* rebased onto the latest master branch again

v4 (Jan 10, 2024)
* rebased onto the latest master branch
* moved binary execution portion of code (EFI_BINARY_EXEC) to
  a new file, efi_bootbin.c, instead of efi_helper.c (patch#1)

v3 (Dec 18, 2023)
* rebased onto Tom's latest next branch
* remove already-merged commits

v2 (Nov 21, 2023)
* rebased onto Tom's next branch
* remove already merged commits
* revise commit messages
* add patch #5 which was split from ex-patch#5
RFC (Oct 26, 2023)

[1] https://lists.denx.de/pipermail/u-boot/2023-October/534598.html
[2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=7760&view=results

AKASHI Takahiro (4):
  efi_loader: split unrelated code from efi_bootmgr.c
  efi_loader: rename BOOTEFI_BOOTMGR to EFI_BOOTMGR
  net: tftp: remove explicit efi configuration dependency
  fs: remove explicit efi configuration dependency

 boot/Kconfig                     |   4 +-
 boot/Makefile                    |   2 +-
 cmd/Kconfig                      |  10 +-
 cmd/efidebug.c                   |   4 +-
 fs/fs.c                          |   7 +-
 include/efi_loader.h             |  28 +-
 lib/efi_loader/Kconfig           |  11 +-
 lib/efi_loader/Makefile          |   3 +-
 lib/efi_loader/efi_bootbin.c     | 211 +++++++++++++
 lib/efi_loader/efi_bootmgr.c     | 488 -------------------------------
 lib/efi_loader/efi_device_path.c |   3 +-
 lib/efi_loader/efi_helper.c      | 286 ++++++++++++++++++
 net/tftp.c                       |  10 +-
 test/boot/bootflow.c             |   2 +-
 14 files changed, 546 insertions(+), 523 deletions(-)
 create mode 100644 lib/efi_loader/efi_bootbin.c

Comments

Heinrich Schuchardt Jan. 17, 2024, 7:43 a.m. UTC | #1
On 1/17/24 05:39, AKASHI Takahiro wrote:
> This patch set is motivated by the discussion[1] regarding
> CONFIG_BOOTEFI_BOOTMGR option.
>
> # This version (v5) contains only the remaining commits.
>
> At the end, bootefi.c will be decomposed into two parts, one for
> providing the command itself and one for implementing helper functions.
> EFI_LOADER will now be available without CONFIG_CMDLINE or specifically
> CONFIG_CMD_BOOTEFI if invoked via bootmeth/bootstd.
>
> Then, EFI_LOADER library side will be further split into two options
> for fine-grain control:
> CONFIG_EFI_BINARY_EXEC: execute UEFI binaries which are to be explicitly
>      loaded by U-Boot's load commands/functions or other methods
>      (like a jtag debugger?)
>      It supports bootmeth_efi as well as "bootefi <addr>|hello"(/"bootm"?).
>
> CONFIG_EFI_BOOTMGR: provide EFI boot manger functionality
>      It supports bootmeth_efi_mgr as well as "bootefi bootmgr".
>
> As such, We will no longer need CONFIG_EFI_BINARY_EXEC if we want to only
> make use of the UEFI boot manger for booting a next stage OS.
>
> Prerequisite
> ============
> This patch set is based on top of the latest "master" branch.
>
> Tests
> =====
> * ran and passed py/efi_selftest on sandbox locally
> * ran and passed py/test_efi_bootmgr on sandbox locally
> * passed CI check (github pull request[2])

Thanks for rebasing. Testing on CI
https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/19342
looks good.

Best regards

Heinrich

>
> Changes
> =======
> v4 (Jan 17, 2024)
> * rebased onto the latest master branch again
>
> v4 (Jan 10, 2024)
> * rebased onto the latest master branch
> * moved binary execution portion of code (EFI_BINARY_EXEC) to
>    a new file, efi_bootbin.c, instead of efi_helper.c (patch#1)
>
> v3 (Dec 18, 2023)
> * rebased onto Tom's latest next branch
> * remove already-merged commits
>
> v2 (Nov 21, 2023)
> * rebased onto Tom's next branch
> * remove already merged commits
> * revise commit messages
> * add patch #5 which was split from ex-patch#5
> RFC (Oct 26, 2023)
>
> [1] https://lists.denx.de/pipermail/u-boot/2023-October/534598.html
> [2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=7760&view=results
>
> AKASHI Takahiro (4):
>    efi_loader: split unrelated code from efi_bootmgr.c
>    efi_loader: rename BOOTEFI_BOOTMGR to EFI_BOOTMGR
>    net: tftp: remove explicit efi configuration dependency
>    fs: remove explicit efi configuration dependency
>
>   boot/Kconfig                     |   4 +-
>   boot/Makefile                    |   2 +-
>   cmd/Kconfig                      |  10 +-
>   cmd/efidebug.c                   |   4 +-
>   fs/fs.c                          |   7 +-
>   include/efi_loader.h             |  28 +-
>   lib/efi_loader/Kconfig           |  11 +-
>   lib/efi_loader/Makefile          |   3 +-
>   lib/efi_loader/efi_bootbin.c     | 211 +++++++++++++
>   lib/efi_loader/efi_bootmgr.c     | 488 -------------------------------
>   lib/efi_loader/efi_device_path.c |   3 +-
>   lib/efi_loader/efi_helper.c      | 286 ++++++++++++++++++
>   net/tftp.c                       |  10 +-
>   test/boot/bootflow.c             |   2 +-
>   14 files changed, 546 insertions(+), 523 deletions(-)
>   create mode 100644 lib/efi_loader/efi_bootbin.c
>