[PATCH 0/9] efi_loader: rework bootefi/bootmgr

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Jan 3 01:17:05 CET 2020


On 4/19/19 5:22 AM, 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 unusual
>    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 to #7 are preparatory patches for patch#8.
> Patch#8 is a core part of reworking.
> Patch#9 is for standalone boot manager.
>
> # Please note that some patches, say patch#2 and #3, can be combined into one
> # but I intentionally keep them separated to clarify my intentions of changes.
>
> Issues:
> * It would be better off to change the semantics of efi_dp_from_name().
> no chance to free loaded_image_info->load_options. (see patch #8)
>
> -Takahiro Akashi

Hello Takahiro,

with the `efidebug boot add` command we can define load options for the
BootXXXX variables.

But in do_efibootmgr() we call do_bootefi_exec() which calls
set_load_options() and passes the value of environment variable bootargs
as load options or if the variable is not set an empty string.

Here is an example console output:

=> setenv bootargs This is a value from bootargs
=> efidebug boot add 0000 hello scsi 0:1 helloworld.efi 'This is a value
from efidebug'
=> efidebug boot order 0000
=> bootefi bootmgr
Booting: hello
Hello, world!
Running on UEFI 2.8
Have SMBIOS table
Have device tree
Load options: This is a value from bootargs
## Application terminated, r = 0

Now the same after deleting variable bootargs:

=> setenv bootargs
=> bootefi bootmgr
Booting: hello
Hello, world!
Running on UEFI 2.8
Have SMBIOS table
Have device tree
Load options: <none>
## Application terminated, r = 0
=>

What behavior would you expect:

a) if the boot option has a load options value,
b) if the boot option has no load options value?

One solution would be to define that bootargs is always ignored if the
boot manager is used.

Best regards

Heinrich


More information about the U-Boot mailing list