RFC efi_loader: add capsule update support
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest0 of 14 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 14 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.
Cover letter [RFC 00/14] efi_loader: add capsule update support
Heinrich,
Quoted 48 lines · AKASHI Takahiro
Heinrich,
Thank you for your quick review.
Quoted 43 lines · Heinrich Schuchardt
Quoted 30 lines · AKASHI Takahiro
Summary
=======
'UpdateCapsule' is one of runtime services defined in UEFI specification and its aim is to allow a caller to pass information to the firmware. This is mostly used to update firmware binary on devices by instructions from OS.In this patch series, all the related definitions and structures are given as UEFI specification describes and basic framework for capsule support is implemented. Currently supported types of capsule are
* firmware update (Firmware Management Protocol or simply FMP)
* variable updateUpdateCapsule is a runtime services function, but is, at least initially, provided only before exiting boot services alike other runtime functions. This is because modifying storage which may be shared with OS must be carefully designed and there is no general assumption to do that as in the case of [Get/]SetVariable.
Instead, any capsule can be handed over to the firmware as a file on a specific file system. In other words, we only support "capsules on disk" for now.Regarding firmware update, most of functionality is provided by FMP driver and it will be by nature system/platform-specific. So you can and should implement FMP drivers based on your system requirements. In this patch series, only a simple FMP driver based on FIT image for a single region is supported. (So it is "for reference only") See more details in "
efi_loader: capsule: add simple firmware management protocol."Quoted 5 lines
Regarding variable update, the implementation here is based on a draft proposal[1] by Peter in Boot-arch ML. The specification should be discussed and finalized first. So the code doesn't fully implement Peter's idea.
[1] https://lists.linaro.org/pipermail/boot-architecture/2018-October/000883.html
I do not like the idea of exposing variables as a configuration table as operating system users may start doing strange things like accessing variables via the configuration table. Why not keep the pointer to the internal storage of variable hidden in your runtime code and expose the runtime services defined in the UEFI spec?
Quoted 5 lines
Quoted 1 line
Please, elaborate on the benefit of your approach.
I have already commented on your reply to my patch#11.
Rather, my aim of this patch is to discuss the following points:
Do you have any comments on them?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Issues
======
* Timing of executing capsules-on-disk
Currently, processing a capsule is triggered only as part of UEFI subsystem initialization. This means that, for example, firmware update, may not take place at system booting time and will potentially be delayed until a first call of any UEFI functions.
We, Linaro, internally discussed this issue and agreed that the current capsule handling should be split from UEFI initialization code, efi_init_obj_list(), and that both of them should be called respectively as early as possible in U-Boot initialization time, probably in board_init_r().
We may restrict this behavior only if CAPSULE is enabled.
Quoted 15 lines
and
Quoted 11 lines
Quoted 11 lines
TODO's
======
(May or may not be addressed in future versions of this series.)
* capsule authentication
* capsule dependency (dependency expression instruction set)
* loading drivers in a capsule
* handling RESET flag in a capsule and QeuryCapsuleCaps
* full semantics of ESRT (EFI System Resource Table)
* enabling capsule API at runtime
* json capsule
* recovery from update failure
Quoted 2 lines
What functionality should be initially included in my first implementation for capsule support.
Do you have any primary requirements so that you will be happy to accept my patch series?
-Takahiro Akashi
Quoted 61 lines
FYI, Sughosh is going to work on
* capsule authentication
* recovery from update failure (or at least, A/B partition)
in the coming months.Thanks,
-Takahiro AkashiQuoted 51 lines
Quoted 50 lines
Changes
=======
Initial release as RFC (March 17, 2020)AKASHI Takahiro (14):
efi_loader: define OsIndicationsSupported flags
efi_loader: define System Resource Table macros
efi_loader: export a couple of protocol related functions
efi_loader: correct a definition of structefi_capsule_header
efi_loader: define UpdateCapsule api
efi_loader: capsule: addcapsule_on_disksupport
efi_loader: capsule: add memory range capsule definitions
efi_loader: capsule: support firmware update
efi_loader: add simple firmware management protocol for FIT image
efi_loader: capsule: support variable update
efi_loader: variable: export variables table for runtime access
cmd: add "efidebug capsule" command
tools: add mkeficapsule command for UEFI capsule update test test/py: add efi capsule testcmd/efidebug.c | 234 +++++ include/efi_api.h | 214 ++++- include/efi_loader.h | 53 ++ lib/efi_loader/Kconfig | 65 ++ lib/efi_loader/Makefile | 2 + lib/efi_loader/efi_boottime.c | 29 +- lib/efi_loader/efi_capsule.c | 860 ++++++++++++++++++ lib/efi_loader/efi_firmware.c | 191 ++++ lib/efi_loader/efi_runtime.c | 104 ++- lib/efi_loader/efi_setup.c | 41 +- lib/efi_loader/efi_variable.c | 109 +++ test/py/tests/test_efi_capsule/conftest.py | 109 +++ test/py/tests/test_efi_capsule/defs.py | 21 + .../test_efi_capsule/test_capsule_firmware.py | 102 +++ .../test_efi_capsule/test_capsule_variable.py | 141 +++ test/py/tests/test_efi_capsule/uboot_env.its | 25 + tools/Makefile | 3 + tools/mkeficapsule.c | 501 ++++++++++ 18 files changed, 2744 insertions(+), 60 deletions(-)create mode 100644
lib/efi_loader/efi_capsule.c
create mode 100644lib/efi_loader/efi_firmware.c
create mode 100644test/py/tests/test_efi_capsule/conftest.pycreate mode 100644test/py/tests/test_efi_capsule/defs.pycreate mode 100644test/py/tests/test_efi_capsule/test_capsule_firmware.pycreate mode 100644test/py/tests/test_efi_capsule/test_capsule_variable.pycreate mode 100644 test/py/tests/test_efi_capsule/uboot_env.its create mode 100644tools/mkeficapsule.c