Skip to content

efi_loader: rework bootefi/bootmgr

AKASHI Takahiro u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 9 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 9 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

Heinrich,

Quoted 56 lines · Heinrich Schuchardt
Quoted 20 lines · AKASHI Takahiro

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.

Quoted 8 lines

# 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:

Quoted 10 lines

=> 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
=>

Yeah, this is not what I intended.

Quoted 7 lines

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.

I agree.
Basically, "bootargs" is only for "bootefi <addr>" command, while "BootXXXX" should work in the exact same way as the UEFI specification defines.

Thanks,
-Takahiro Akashi

Quoted 3 lines

Best regards

Heinrich