public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [RFC 00/14] efi_loader: add capsule update support
@ 2020-03-17  2:12 AKASHI Takahiro
  2020-03-17  2:12 ` [RFC 01/14] efi_loader: define OsIndicationsSupported flags AKASHI Takahiro
                   ` (15 more replies)
  0 siblings, 16 replies; 49+ messages in thread
From: AKASHI Takahiro @ 2020-03-17  2:12 UTC (permalink / raw)
  To: u-boot

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 update

UpdateCapsule 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."

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

Patch structure
===============
Patch#1-#4: preparatory patches
Patch#5-#11: main part of implementation
Patch#12-#14: utilities and tests

Test
====
* passed all the pytests which are included in this patch series
  on sandbox build.
* passed Travis CI.

Currently, my pytest requires the following prerequisite patch to
run without errors:
[2] https://lists.denx.de/pipermail/u-boot/2020-March/401726.html
[3] https://lists.denx.de/pipermail/u-boot/2020-March/401727.html

In addition, you have to enable CONFIG_ENV_IS_IN_SPI_FLASH and
CONFIG_SPI_FLASH_SANDBOX to successfully run the test.

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.

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


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 struct efi_capsule_header
  efi_loader: define UpdateCapsule api
  efi_loader: capsule: add capsule_on_disk support
  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 test

 cmd/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 100644 lib/efi_loader/efi_firmware.c
 create mode 100644 test/py/tests/test_efi_capsule/conftest.py
 create mode 100644 test/py/tests/test_efi_capsule/defs.py
 create mode 100644 test/py/tests/test_efi_capsule/test_capsule_firmware.py
 create mode 100644 test/py/tests/test_efi_capsule/test_capsule_variable.py
 create mode 100644 test/py/tests/test_efi_capsule/uboot_env.its
 create mode 100644 tools/mkeficapsule.c

-- 
2.25.1

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2020-04-14  4:38 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-17  2:12 [RFC 00/14] efi_loader: add capsule update support AKASHI Takahiro
2020-03-17  2:12 ` [RFC 01/14] efi_loader: define OsIndicationsSupported flags AKASHI Takahiro
2020-03-17  7:03   ` Heinrich Schuchardt
2020-03-18  1:18     ` AKASHI Takahiro
2020-03-18 18:01       ` Heinrich Schuchardt
2020-03-17  2:12 ` [RFC 02/14] efi_loader: define System Resource Table macros AKASHI Takahiro
2020-03-17  7:06   ` Heinrich Schuchardt
2020-03-18 18:02     ` Heinrich Schuchardt
2020-03-17  2:12 ` [RFC 03/14] efi_loader: export a couple of protocol related functions AKASHI Takahiro
2020-03-17  7:19   ` Heinrich Schuchardt
2020-03-18 18:03   ` Heinrich Schuchardt
2020-03-17  2:12 ` [RFC 04/14] efi_loader: correct a definition of struct efi_capsule_header AKASHI Takahiro
2020-03-17  7:25   ` Heinrich Schuchardt
2020-03-18 18:03   ` Heinrich Schuchardt
2020-03-17  2:12 ` [RFC 05/14] efi_loader: define UpdateCapsule api AKASHI Takahiro
2020-03-17  2:12 ` [RFC 06/14] efi_loader: capsule: add capsule_on_disk support AKASHI Takahiro
2020-03-18  8:55   ` Heinrich Schuchardt
2020-03-19 17:08     ` Heinrich Schuchardt
2020-03-30  7:43       ` AKASHI Takahiro
2020-03-17  2:12 ` [RFC 07/14] efi_loader: capsule: add memory range capsule definitions AKASHI Takahiro
2020-03-17  8:11   ` Heinrich Schuchardt
2020-03-18  1:22     ` AKASHI Takahiro
2020-03-18  7:35       ` Heinrich Schuchardt
2020-03-18  7:57         ` AKASHI Takahiro
2020-04-06  7:48           ` AKASHI Takahiro
2020-03-17  2:12 ` [RFC 08/14] efi_loader: capsule: support firmware update AKASHI Takahiro
2020-03-18 14:09   ` Sughosh Ganu
2020-03-17  2:12 ` [RFC 09/14] efi_loader: add simple firmware management protocol for FIT image AKASHI Takahiro
2020-03-18  8:04   ` Heinrich Schuchardt
2020-03-18  8:17     ` AKASHI Takahiro
2020-03-18  9:06       ` Heinrich Schuchardt
2020-04-06  7:59         ` AKASHI Takahiro
2020-03-17  2:12 ` [RFC 10/14] efi_loader: capsule: support variable update AKASHI Takahiro
2020-03-17  2:12 ` [RFC 11/14] efi_loader: variable: export variables table for runtime access AKASHI Takahiro
2020-03-17  7:37   ` Heinrich Schuchardt
2020-03-18  1:53     ` AKASHI Takahiro
2020-03-19  9:30       ` Ilias Apalodimas
2020-03-18 13:54   ` Sughosh Ganu
2020-03-17  2:12 ` [RFC 12/14] cmd: add "efidebug capsule" command AKASHI Takahiro
2020-03-17  2:12 ` [RFC 13/14] tools: add mkeficapsule command for UEFI capsule update test AKASHI Takahiro
2020-03-17  7:58   ` Heinrich Schuchardt
2020-03-18  1:32     ` AKASHI Takahiro
2020-03-19  8:55       ` Ilias Apalodimas
2020-03-17  2:12 ` [RFC 14/14] test/py: add efi capsule test AKASHI Takahiro
2020-03-17  7:49 ` [RFC 00/14] efi_loader: add capsule update support Heinrich Schuchardt
2020-03-18  2:04   ` AKASHI Takahiro
2020-03-31  4:36     ` AKASHI Takahiro
2020-04-14  4:38       ` AKASHI Takahiro
2020-03-18 18:16 ` Sughosh Ganu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox