fwupd/plugins/uefi-capsule
Javier Martinez Canillas f2327011a7 uefi-capsule: Include crt0 for arm and aarch64 that add a SBAT section
Due the lack of pei-aarch64 support in binutils, the gnu-efi crt0 harcodes
the PE32+ sections among other things. These crt0 aren't aware of the SBAT
section and so custom ones have to be used.

In the same vein as commit cfd1f2f42a ("uefi-capsule: Ensure SBAT metadata
is added correctly") included custom linker scripts, this change add a set
of crt0 for arm and aarch64 that hardcode a SBAT section in the PE headers.

These are the crt0 from gnu-efi plus the following fixes from Peter Jones:

* Include .sbat in section headers
* Fix some PE headers
* Calculate the VirtualSize of .sbat separately
* Put .rel* and .dyn* in .rodata
2021-04-07 13:46:58 +01:00
..
efi uefi-capsule: Include crt0 for arm and aarch64 that add a SBAT section 2021-04-07 13:46:58 +01:00
tests uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-plugin-uefi-capsule.c Split out a shared system context 2021-04-01 21:11:29 +01:00
fu-self-test.c uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-ucs2.c uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-ucs2.h uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-bgrt.c uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-bgrt.h uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-bootmgr.c uefi-capsule: Check if the fwupd BootXXXX entry exists on failure 2021-01-27 14:49:57 +00:00
fu-uefi-bootmgr.h uefi-capsule: Check if the fwupd BootXXXX entry exists on failure 2021-01-27 14:49:57 +00:00
fu-uefi-common.c uefi-capsule: Read the BMP in a more safe way 2021-02-10 16:29:57 +00:00
fu-uefi-common.h Only include the start year in the copyright header 2021-01-07 14:48:16 +00:00
fu-uefi-device.c Remove FuFirmwareImage and just use FuFirmware instead 2021-03-09 21:14:12 +00:00
fu-uefi-device.h Only include the start year in the copyright header 2021-01-07 14:48:16 +00:00
fu-uefi-devpath.c Only include the start year in the copyright header 2021-01-07 14:48:16 +00:00
fu-uefi-devpath.h Only include the start year in the copyright header 2021-01-07 14:48:16 +00:00
fu-uefi-pcrs.c uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-pcrs.h uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-tool.c uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-update-info.c uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
fu-uefi-update-info.h uefi: Rename to uefi-capsule 2021-01-05 15:31:22 +00:00
make-images.py Install the UX data into a single .tar.xz file 2021-01-20 11:03:20 +00:00
meson.build Move the plugin build logic to the plugins themselves 2021-02-18 14:46:20 +00:00
README.md Add a new internal flag to opt-in to GUID matching 2021-02-25 15:47:25 +00:00
uefi_capsule.conf rename config section in uefi_capsule.conf to plugin name 2021-01-12 17:53:26 +00:00
uefi-capsule.quirk Simplify the quirk file format 2021-03-03 08:30:34 +00:00

UEFI Capsule Support

Introduction

The Unified Extensible Firmware Interface (UEFI) is a specification that defines the software interface between an OS and platform firmware. With the UpdateCapsule boot service it can be used to update system firmware.

If you don't want or need this functionality you can use the -Dplugin_uefi_capsule=false option.

Lenovo Specific Behavior

On Lenovo hardware only the boot label is set to Linux-Firmware-Updater rather than "Linux Firmware Updater" (with spaces) due to long-fixed EFI boot manager bugs. Many users will have these old BIOS versions installed and so we use the use-legacy-bootmgr-desc quirk to use the safe name.

On some Lenovo hardware only one capsule is installable due to possible problems with the UpdateCapsule coalesce operation. As soon as one UEFI device has been scheduled for update the other UEFI devices found in the ESRT will be marked as updatable-hidden rather than updatable. Rebooting will restore them so they can be updated on next OS boot.

UEFI SBAT Support

If compiling with -Dsupported_build=true the packager must also specify the SBAT metadata required for the secure boot revocation support. See the specification for more information: https://github.com/rhboot/shim/blob/sbat/SBAT.md

Typically, this will be set as part of the package build script, e.g.

-Defi_sbat_distro_id="fedora" \
-Defi_sbat_distro_summary="The Fedora Project" \
-Defi_sbat_distro_pkgname="%{name}" \
-Defi_sbat_distro_version="%{version}" \
-Defi_sbat_distro_url="https://src.fedoraproject.org/rpms/%{name}" \

Firmware Format

The daemon will decompress the cabinet archive and extract a firmware blob in EFI capsule file format.

See https://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf for details.

This plugin supports the following protocol ID:

  • org.uefi.capsule

Update Behavior

The firmware is deployed when the OS is running, but it is only written when the system has been restarted and the fwupd*.efi binary has been run. To achieve this fwupd sets up the EFI BootNext variable, creating the new boot entry if required.

GUID Generation

These devices use the UEFI GUID as provided in the ESRT. Additionally, for the system device the main-system-firmware GUID is also added.

For compatibility with Windows 10, the plugin also adds GUIDs of the form UEFI\RES_{$(esrt)}.

Vendor ID Security

The vendor ID is set from the BIOS vendor, for example DMI:LENOVO for all devices that are not marked as supporting Firmware Management Protocol. For FMP device no vendor ID is set.

UEFI Unlock Support

On some Dell systems it is possible to turn on and off UEFI capsule support from within the BIOS. This functionality can also be adjusted from within the OS by fwupd. This requires compiling with libsmbios support.

When fwupd has been compiled with this support you will be able to enable UEFI support on the device by using the unlock command.

Custom EFI System Partition

Since version 1.1.0 fwupd will autodetect the ESP when it is mounted on /boot/efi, /boot, or /efi. A custom EFI system partition location can be used by modifying OverrideESPMountPoint in /etc/fwupd/uefi_capsule.conf.

Setting an invalid directory will disable the fwupd plugin.

External interface access

This plugin requires:

  • read/write access to the EFI system partition.
  • read access to /sys/firmware/efi/esrt/
  • read access to /sys/firmware/efi/fw_platform_size
  • read/write access to /sys/firmware/efi/efivars