mbox series

[U-Boot,RFC,v2,00/11] efi_loader: rework bootefi/bootmgr

Message ID 20190327044042.13707-1-takahiro.akashi@linaro.org
Headers show
Series efi_loader: rework bootefi/bootmgr | expand

Message

AKASHI Takahiro March 27, 2019, 4:40 a.m. UTC
There are several reasons that I want to rework/refactor bootefi command
as well as bootmgr:
* Some previous commits on bootefi.c have made the code complicated
  and a bit hard to understand.

* do_bootefi_exec() would better be implemented using load_image() along
  with start_image() to be aligned with UEFI interfaces.

* Contrary to the other part, efi_selftest part of the code is unusal
  in terms of loading/execution path in do_bootefi().

* When we will support "secure boot" in the future, EFI Boot Manager
  is expected to be invoked as a standalone command without any arguments
  to mitigate security surfaces.

In this patch set,
Patch#1 is a bug fix.
Patch#2 to #9 are preparatory patches for patch#10.
Patch#10 is a core part of reworking.
Patch#11 is for standalone boot manager.

# Please note that some patches, say patch#4 and #5, can be combined into one
# but I intentionally keep them separated to clearify my intentions of changes.

Prerequsite patch:
* "efi_loader: bootmgr: support BootNext and BootCurrent variable behavior"
* "efi_loader: release file buffer after loading image"

Issues:
* load_image() will take an argument of "parent_handle," but obviously
  we don't have any parent when invoking an application from command line.
  (See FIXME in patch#10.)
* Starting EDK2's Shell.efi from boot manager fails.
  (I need to find out a fix.)
* The semantics of efi_dp_from_name() should be changed.
  (See FIXME in patch#10.)

-Takahiro Akashi

Changes in RFC v2 (Mar 27, 2019)
* rebased on v2019.04-rc4
* use load_image API in do_bootmgr_load()
* merge efi_install_fdt() and efi_process_fdt()
* add EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL to image (patch#1)
* lots of minor changes

AKASHI Takahiro (11):
  efi_loader: boottime: add loaded image device path protocol to image
    handle
  efi_loader: boottime: export efi_[un]load_image()
  efi_loader: device_path: handle special case of loading
  cmd: bootefi: carve out fdt handling from do_bootefi()
  cmd: bootefi: merge efi_install_fdt() and efi_process_fdt()
  cmd: bootefi: carve out efi_selftest code from do_bootefi()
  cmd: bootefi: move do_bootefi_bootmgr_exec() forward
  cmd: bootefi: carve out bootmgr code from do_bootefi()
  cmd: bootefi: carve out do_boot_efi() from do_bootefi()
  efi_loader: rework bootmgr/bootefi using load_image API
  cmd: add efibootmgr command

 cmd/Kconfig                       |   8 +
 cmd/bootefi.c                     | 521 +++++++++++++++++++-----------
 include/efi_api.h                 |   4 +
 include/efi_loader.h              |  15 +-
 lib/efi_loader/efi_bootmgr.c      |  43 +--
 lib/efi_loader/efi_boottime.c     |  34 +-
 lib/efi_loader/efi_device_path.c  |   8 +
 lib/efi_loader/efi_image_loader.c |   2 +
 8 files changed, 411 insertions(+), 224 deletions(-)

Comments

AKASHI Takahiro April 12, 2019, 1:18 a.m. UTC | #1
Heinrich,

Can you kindly review this series of patches, in particular, patch#10?
I would like to push it for v2019.07.

-Takahiro Akashi

On Wed, Mar 27, 2019 at 01:40:31PM +0900, AKASHI Takahiro wrote:
> There are several reasons that I want to rework/refactor bootefi command
> as well as bootmgr:
> * Some previous commits on bootefi.c have made the code complicated
>   and a bit hard to understand.
> 
> * do_bootefi_exec() would better be implemented using load_image() along
>   with start_image() to be aligned with UEFI interfaces.
> 
> * Contrary to the other part, efi_selftest part of the code is unusal
>   in terms of loading/execution path in do_bootefi().
> 
> * When we will support "secure boot" in the future, EFI Boot Manager
>   is expected to be invoked as a standalone command without any arguments
>   to mitigate security surfaces.
> 
> In this patch set,
> Patch#1 is a bug fix.
> Patch#2 to #9 are preparatory patches for patch#10.
> Patch#10 is a core part of reworking.
> Patch#11 is for standalone boot manager.
> 
> # Please note that some patches, say patch#4 and #5, can be combined into one
> # but I intentionally keep them separated to clearify my intentions of changes.
> 
> Prerequsite patch:
> * "efi_loader: bootmgr: support BootNext and BootCurrent variable behavior"
> * "efi_loader: release file buffer after loading image"
> 
> Issues:
> * load_image() will take an argument of "parent_handle," but obviously
>   we don't have any parent when invoking an application from command line.
>   (See FIXME in patch#10.)
> * Starting EDK2's Shell.efi from boot manager fails.
>   (I need to find out a fix.)
> * The semantics of efi_dp_from_name() should be changed.
>   (See FIXME in patch#10.)
> 
> -Takahiro Akashi
> 
> Changes in RFC v2 (Mar 27, 2019)
> * rebased on v2019.04-rc4
> * use load_image API in do_bootmgr_load()
> * merge efi_install_fdt() and efi_process_fdt()
> * add EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL to image (patch#1)
> * lots of minor changes
> 
> AKASHI Takahiro (11):
>   efi_loader: boottime: add loaded image device path protocol to image
>     handle
>   efi_loader: boottime: export efi_[un]load_image()
>   efi_loader: device_path: handle special case of loading
>   cmd: bootefi: carve out fdt handling from do_bootefi()
>   cmd: bootefi: merge efi_install_fdt() and efi_process_fdt()
>   cmd: bootefi: carve out efi_selftest code from do_bootefi()
>   cmd: bootefi: move do_bootefi_bootmgr_exec() forward
>   cmd: bootefi: carve out bootmgr code from do_bootefi()
>   cmd: bootefi: carve out do_boot_efi() from do_bootefi()
>   efi_loader: rework bootmgr/bootefi using load_image API
>   cmd: add efibootmgr command
> 
>  cmd/Kconfig                       |   8 +
>  cmd/bootefi.c                     | 521 +++++++++++++++++++-----------
>  include/efi_api.h                 |   4 +
>  include/efi_loader.h              |  15 +-
>  lib/efi_loader/efi_bootmgr.c      |  43 +--
>  lib/efi_loader/efi_boottime.c     |  34 +-
>  lib/efi_loader/efi_device_path.c  |   8 +
>  lib/efi_loader/efi_image_loader.c |   2 +
>  8 files changed, 411 insertions(+), 224 deletions(-)
> 
> -- 
> 2.20.1
>
Heinrich Schuchardt April 12, 2019, 6:11 a.m. UTC | #2
On 4/12/19 3:18 AM, AKASHI Takahiro wrote:
> Heinrich,
>
> Can you kindly review this series of patches, in particular, patch#10?
> I would like to push it for v2019.07.
>
> -Takahiro Akashi


The first two patches have been merged by Tom Rini.

You should have comments for all of the remaining patches.

Please, base your series on the efi-2019-07 branch available at
https://git.u-boot.de/u-boot-efi.git
(or https://github.com/xypron2/u-boot.git).

Thanks a lot for taking the arduous task of cleaning this up.

Best regards

Heinrich
AKASHI Takahiro April 12, 2019, 6:25 a.m. UTC | #3
On Fri, Apr 12, 2019 at 08:11:04AM +0200, Heinrich Schuchardt wrote:
> On 4/12/19 3:18 AM, AKASHI Takahiro wrote:
> >Heinrich,
> >
> >Can you kindly review this series of patches, in particular, patch#10?
> >I would like to push it for v2019.07.
> >
> >-Takahiro Akashi
> 
> 
> The first two patches have been merged by Tom Rini.

Actually, first three?

> You should have comments for all of the remaining patches.

Sure

> Please, base your series on the efi-2019-07 branch available at
> https://git.u-boot.de/u-boot-efi.git
> (or https://github.com/xypron2/u-boot.git).
> 
> Thanks a lot for taking the arduous task of cleaning this up.

I think that it's time to convert efi_selftest to a real app, isn't it?

-Takahiro Akashi

> Best regards
> 
> Heinrich