mbox series

[RFC,00/13] cmd: bootefi: refactor the code for bootmgr

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

Message

AKASHI Takahiro Oct. 26, 2023, 5:30 a.m. UTC
This patch set is motivated by the discussion[1] regarding
CONFIG_BOOTEFI_BOOTMGR option.

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_BINARY_EXEC if we want to only
make use of the boot manger for booting a next stage OS.

Prerequisite
============
This patch set is based on top of Simon/Tom's [2].

Patches
=======
Patch#1-#11: I hope that those commits show step-by-step refactoring
    without introducing degradation.
Patch#12-#13: Those are not directly related to the patch's aim, but
    they are necessary to compile U-Boot on sandbox (sandbox_defconfig)
    without CONFIG_CMDLINE.

[1] https://lists.denx.de/pipermail/u-boot/2023-October/534598.html
[2] origin/TEST/v4.1-tidy-up-use-of-CONFIG_CMDLINE

AKASHI Takahiro (13):
  cmd: bootefi: unfold do_bootefi_image()
  cmd: bootefi: re-organize do_bootefi_image()
  cmd: bootefi: carve out EFI boot manager interface
  cmd: bootefi: carve out binary execution interface
  cmd: bootefi: move library interfaces under lib/efi_loader
  cmd: efidebug: ease efi configuration dependency
  bootmeth: use efi_loader interfaces instead of bootefi command
  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
  lib: uuid: move CONFIG_RANDOM_UUID
  block: rkmtd: select CONFIG_RANDOM_UUID explicitly

 boot/Kconfig                     |   4 +-
 boot/Makefile                    |   2 +-
 boot/bootm_os.c                  |  31 +-
 boot/bootmeth_efi.c              |   8 +-
 boot/bootmeth_efi_mgr.c          |   3 +-
 cmd/Kconfig                      |  28 +-
 cmd/bootefi.c                    | 658 +++++--------------------------
 cmd/efidebug.c                   |   4 +-
 drivers/block/Kconfig            |   1 +
 fs/fs.c                          |   7 +-
 include/efi_loader.h             |  34 +-
 lib/Kconfig                      |   7 +
 lib/efi_loader/Kconfig           |  11 +-
 lib/efi_loader/Makefile          |   2 +-
 lib/efi_loader/efi_bootmgr.c     |  37 ++
 lib/efi_loader/efi_device_path.c |   3 +-
 lib/efi_loader/efi_helper.c      | 486 ++++++++++++++++++++++-
 net/tftp.c                       |  10 +-
 test/boot/bootflow.c             |   2 +-
 19 files changed, 697 insertions(+), 641 deletions(-)

Comments

Tom Rini Oct. 26, 2023, 12:47 p.m. UTC | #1
On Thu, Oct 26, 2023 at 02:30:39PM +0900, AKASHI Takahiro wrote:

> This patch set is motivated by the discussion[1] regarding
> CONFIG_BOOTEFI_BOOTMGR option.
> 
> 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_BINARY_EXEC if we want to only
> make use of the boot manger for booting a next stage OS.
> 
> Prerequisite
> ============
> This patch set is based on top of Simon/Tom's [2].
> 
> Patches
> =======
> Patch#1-#11: I hope that those commits show step-by-step refactoring
>     without introducing degradation.
> Patch#12-#13: Those are not directly related to the patch's aim, but
>     they are necessary to compile U-Boot on sandbox (sandbox_defconfig)
>     without CONFIG_CMDLINE.

I'm very happy to see this. In general, I need to make a v5 of my series
as that will also include Heinrich's patch (v3 of it) to have sandbox
enable --gc-sections and that in turn means that some of the work
around handling unused functions should be easier.