Commit Graph

269 Commits

Author SHA1 Message Date
Richard Hughes
51a869a01d Use XMLb to query quirks
During startup we do 1898 persistent allocations to load the quirk files, which
equates to ~90kb of RSS. Use libxmlb to create a mmap'able store we can query
with XPath queries at runtime.
2019-10-30 08:29:58 -05:00
Mario Limonciello
e7b2ea02b9 uefi: use genpeimg to mark ASLR and DP/NX on EFI binary
If the tool is available at build time use it to this.
2019-10-26 12:59:11 -05:00
Mario Limonciello
44b9e46d37 uefi: rework ESP path detection and lifecycle
This makes the daemon less destructive at startup, especially if the ESP
is not mounted.

It's stored in 3 different places right now, so move it into one point of truth.

Now the ESP is detected when needed including all point of time safety checks and
dynamically mounted and unmounted if necessary.
2019-10-24 15:22:01 -05:00
Mario Limonciello
9160fd4dd1 trivial: uefi: show more metadata in to_string method 2019-10-24 15:22:01 -05:00
Mario Limonciello
97c1e727c4 Add new device flags indicating update resilience
fwupd clients will ideally use this information as part of a policy to schedule
updates in the background without user interactions on safe devices.
2019-10-17 11:38:46 -05:00
Mario Limonciello
8fa0b382fa Add new flags can-verify and can-verify-image
These are used to indicate that the device can verify checksums or
can dump an image for checksumming.
2019-10-14 12:41:09 -05:00
Mario Limonciello
069449e427 trivial: uefi: don't add PCRs with all 0's
I was seeing on a CML laptop with a Nuvoton TPM the following which
is definitely wrong:
```
  Checksum:             SHA1(791183aa2c4993dfaf75e95c91bdad067ac2cce1)
  Checksum:             SHA256(8a0656fe0024cc3300cc4dc8af4fc336112a51013aeb74b21c138ed116bb8691)
  Checksum:             SHA1(000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
```
2019-10-14 08:58:14 -05:00
Richard Hughes
8653e70480 trivial: Remove G_BEGIN_DECLS from all private headers 2019-10-09 20:02:16 +01:00
Mario Limonciello
e42b42bf9b trivial: uefi: Make efivarvs errors clearer (Fixes: 1330) 2019-10-07 07:23:54 -05:00
Mario Limonciello
01c2f651da trivial: uefi: don't prefix efivar errors
Although they can be useful for debugging the codepath leading to
a problem, they are also confusing when it comes to the end user
messages:

```
{error #0} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory
{error #1} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory
{error #2} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory
{error #3} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory:
Error writing to file descriptor: No space left on device
```

Whereas if they weren't shown, that last message would have been plenty.
2019-10-07 07:23:54 -05:00
Mario Limonciello
5bd649ef31 uefi: detect unmounted ESP partitions (Fixes: #1405)
Mount these while writing out updates.
Leave them mounted when done (you gotta reboot anyway).
2019-09-26 10:39:45 -05:00
Mario Limonciello
dc227c6037 uefi: stop recording efibootmgr output after flash
We've not had to reference this in a long time for bugs, all the major
IBVs and OEMs have good fwupd support now.
2019-09-26 10:39:45 -05:00
Mario Limonciello
a1f9d5850b trivial: uefi, dell: skip self tests with TPM if non-root (Fixes: #1396)
There are some packaging problems in some distributions that lead
to TSS stack emitting warnings that will fail self tests.

These don't occur as root, and furthermore those distributions run
CI as root already.

And in the dell plugin make it non-fatal to have TPM register read failures
in case the system has TPM1.2 not TPM2.0
2019-09-25 08:38:04 -05:00
Mario Limonciello
42ee62ef34 trivial: uefi: allow forcing to TPM2 via environment variable
Use this environment variable to ensure that TPM2 is used in self
tests even if the system has TPM1.2.
2019-09-25 08:38:04 -05:00
Mario Limonciello
01a7958cd1 uefi, dell-esrt: Show firmware version when capsule updates unavailable
When the system doesn't support UEFI capsule updates no firmware version
is displayed for the BIOS.  Fix this by creating a dummy device:
```
├─System Firmware:
│     Device ID:           123fd4143619569d8ddb6ea47d1d3911eb5ef07a
│     Current version:     1.7.0
│     Vendor:              Dell Inc.
│     Update Error:        UEFI Capsule updates not available or enabled
│     Flags:               internal|require-ac|registered|needs-reboot
```

If the dell-esrt plugin determines that capsule updates can be enabled
however, make the device it creates replace the dummy device:
```
├─Dell UEFI updates:
│     Device ID:           123fd4143619569d8ddb6ea47d1d3911eb5ef07a
│     Summary:             Enable UEFI Update Functionality
│     Current version:     0
│     Update Error:        Firmware updates disabled; run 'fwupdmgr unlock' to enable
│     Flags:               locked|supported|registered|needs-reboot
```

Fixes: #1366
2019-09-19 15:48:39 +01:00
Mario Limonciello
78987fb394 uefi: make the TPM optional for runtime again (Fixes: #1362)
It's intentional to use a different error message for library failure
so that we can tell if there is a regression in CI related to TPM usage.
2019-09-17 23:41:41 +01:00
Mario Limonciello
5206592347 trivial: uefi: Make the TCTI output less verbose 2019-09-17 23:41:41 +01:00
Richard Hughes
04cb360847 uefi-recovery: Add a plugin to add a fake ESRT entry for device recovery
The factory-shipped MinnowBoardMAX board has firmware that does not include
the ESRT table. Create a 'fake' UEFI device with the lowest possible version
so that it can be updated to any version firmware.

All the HwId GUIDs are used for the fake UEFI device, and so should be used in
the firmware metadata for releases that should recover the system.
2019-09-11 12:47:31 +01:00
Richard Hughes
1984180592 Add a DMI quirk for the Minnowboard Turbot
The fwupd UEFI plugin refuses to start if bit 3 of the "BIOS Characteristics
Extension Byte 2" (13h) is cleared. Bit 3 is UEFI Specification is supported.

Also, double-check that /sys/firmware/efi does not exist before disabling the
plugin as other machines may be affected too. The quirk then acts to supress
the console warning about the broken SMBIOS value.

Fixes https://github.com/fwupd/fwupd/issues/1342
2019-09-10 20:39:45 +01:00
Mario Limonciello
20cc9eebc5 Try to only show DMI product name once
* libfwupd: export new property HostProduct
* clients: Use this property for setting the title of trees

Before:
```
○
├─XPS 13 7390 TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─XPS 13 7390 System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot

```

After:
```
XPS 13 7390
│
├─TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot
```
2019-09-05 11:22:39 -05:00
Mario Limonciello
0f490525f0 trivial: UEFI skip self tests if library fails to initialize
This means no simulator or TPM actually available
2019-08-29 12:52:27 -05:00
Richard Hughes
758f3b5abd trivial: Fix running the tests on devices with the TPM in v1.2 mode 2019-08-27 20:03:53 +01:00
Jonas Witschel
5a7575d947 uefi: add test for TPM 2.0 PCR read function
The test is run if a physical TPM is available or if the environment
variable "TPM_SERVER_RUNNING" is set. In the latter case, the user is
expected to start a TPM simulator on their own, like we do in the Arch
Linux CI script here.
2019-08-27 06:23:42 -05:00
Jonas Witschel
1b5f1da202 uefi: use tpm2-tss library to read PCR values
Using the library instead of the command line tools provides a more
stable interface. This implementation only fetches PCR 0 for all
available hash algorithms since this is the only PCR that is actually
used in fwupd.
2019-08-27 06:23:42 -05:00
Jonas Witschel
db82620413 uefi: add support for tpm2-tools 4.X
tpm2_pcrlist has been renamed to tpm2_pcrread in
aedb0291d2
and the output format has changed slightly to include a leading "0x" in
9374bd70f4
Also add an example of the new output format to the self test.
2019-08-25 09:56:16 +01:00
Mario Limonciello
71d2f62dc2 trivial: update references of hughsie/fwupd to fwupd/fwupd 2019-08-22 09:47:52 -05:00
Mario Limonciello
8de8e3523a trivial: uefi: set vendor name for system firwmare from DMI data 2019-08-21 12:37:06 -05:00
Richard Hughes
6e3e62bee8 Use fu_common_string_append_kv() in subclassed device
Also define the indent level in the the ->to_string vfunc so we can correctly
print client devices in all cases.
2019-08-14 16:48:37 +01:00
Richard Hughes
7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00
Richard Hughes
a7715bc74a uefi: Actually write the new device path if different than before
If we add or remove a quirk from a machine using the uefi plugin then the new
setting is not used until the BootXXXX EFI key is manually removed. Rather than
just writing the contents of the found key back to the key (doh) just write the
new DP buffer contents if it is different from the previous buffer.
2019-08-02 14:34:12 +01:00
Richard Hughes
fad78a758e Allow setting custom flags when using fwupdate
This allows the ODM to specify command line arguments such as:

    --flags=use-shim-unique,use-legacy-bootmgr-desc,no-ux-capsule

..which is useful for testing broken firmware.
2019-08-02 14:34:12 +01:00
Richard Hughes
c5eb83cb87 trivial: Do not show a critical warning if no firmware is specified 2019-08-02 14:34:12 +01:00
Richard Hughes
90da72ad76 trivial: Fix overzealous search-replace action in user string 2019-08-02 14:34:12 +01:00
Mario Limonciello
e219a994dd trivial: uefi: use UEFI-dummy for device ID instead of just uefi 2019-07-11 09:33:23 -07:00
Mario Limonciello
badef4daf3 trivial: fix error handling for non UEFI case (#1220) 2019-07-11 09:33:23 -07:00
Mario Limonciello
65a4894bba uefi: Determine whether running in legacy mode or not (Fixes: #1220)
* In startup, check BIOS characteristics for UEFI supported instead of for /sys/firmware/uefi
* In coldplug check for /sys/firmware/uefi
* If /sys/firwmare/uefi missing, create a dummy device telling the user it is in legacy mode
2019-07-10 10:20:49 -07:00
Richard Hughes
59e375707a uefi: Try to find a duplicate using the loadopt name
This means if the loadoptdata changes for any reason (e.g. we start using a
different quirk) we don't get duplicate entries in efibootmgr.
2019-06-05 11:12:07 +01:00
Richard Hughes
49c99038eb uefi: Provide a quirk to disable the use of the UX capsule 2019-06-05 11:12:07 +01:00
Mario Limonciello
53f0c585ed trivial: uefi: use the path for efibootmgr that was detected
A failure report on LVFS shows that NixOS wasn't able to launch
efibootmgr.
2019-05-31 10:07:59 -05:00
Sean-StarLabs
7239c6ab45 Lite Mk II flag for use-shim-unique
Added AMI fix for the "duplicate entry" issue to firmware version 1.0.4 - quirk is needed to install new version
2019-05-23 14:57:17 +01:00
Mario Limonciello
d83f5fe05e trivial: uefi: clarify error message
Help people to debug when their ESP isn't found.
2019-05-20 10:59:54 -07:00
Richard Hughes
dfa9e11bb2 Allow handling FORCE for devices that subclass FuDevice
Pass FwupdInstallFlags down to the vfunc to allow us to check the flags when
parsing the firmware and updating the device.
2019-05-05 15:29:00 -05:00
Richard Hughes
26d3da4074 uefi: Fix a libasan failure when reading a UEFI variable
It seems some older versions of libefi var incorrectly build the 'length' value
in the DP returned from efi_generate_file_device_path(). This means we copy past
the end of the allocated buffer when parsing the efi_update_info_t structure.

This bug seems fixed in efivar git master, and this fix is only going to help
people with older efivar versions. It's probably a good thing to be a bit more
paranoid about EFI variable data anyway.

    DEBUG: UpdateInfo:
           ? 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
    ????????????????????????????????????????????????????????????????????????????????????????????????????????
    0x0000 ? 07 00 00 00 20 d9 7b 69 cf 12 a9 4d 83 85 99 69 09 bc 65 59 00 00 05 00 00 00 00 00 00 00 00 00
    0x0020 ? 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 01 2a 00 01 00 00 00 00 08 00 00
    0x0040 ? 00 00 00 00 00 40 06 00 00 00 00 00 5a aa 97 5a 10 d5 7e 49 99 0b ca 8d 35 4d c8 6d 02 02 04 04
    0x0060 ? 86 00 5c 00 45 00 46 00 49 00 5c 00 66 00 65 00 64 00 6f 00 72 00 61 00 5c 00 66 00 77 00 5c 00
    0x0080 ? 66 00 77 00 75 00 70 00 64 00 2d 00 36 00 39 00 37 00 62 00 64 00 39 00 32 00 30 00 2d 00 31 00
    0x00a0 ? 32 00 63 00 66 00 2d 00 34 00 64 00 61 00 39 00 2d 00 38 00 33 00 38 00 35 00 2d 00 39 00 39 00
    0x00c0 ? 36 00 39 00 30 00 39 00 62 00 63 00 36 00 35 00 35 00 39 00 2e 00 63 00 61 00 70 00 00 00 7f ff
    0x00e0 ? 04 00
    DEBUG: DP type:0x04 subtype:0x01 size:0x002a
    DEBUG: DP type:0x04 subtype:0x04 size:0x0086
    DEBUG: found END_ENTIRE at 0x00aa
    DEBUG: DP length invalid! Truncating from 0x0086 to 0x0080
    DEBUG: DP type:0x7f subtype:0xff size:0x0004
2019-05-02 17:25:34 +01:00
Richard Hughes
5079f26f0e Never guess the version format from the version string
This leads to madness, as some formats are supersets of the detected types,
e.g. 'intel-me' is detected as 'quad' and 'bcd' is detected as 'pair'.

Where the version format is defined in a specification or hardcoded in the
source use a hardcoded enum value, otherwise use a quirk override.

Additionally, warn if the version does not match the defined version format
2019-04-30 09:25:41 +01:00
Richard Hughes
c84b36c541 Export the version-format to clients
This allows a vendor to verify the VersionFormat of a device without running
the daemon in verbose mode.
2019-04-30 09:25:41 +01:00
Richard Hughes
cdd390a785 trivial: Fix fwupdate --apply 2019-04-25 12:52:59 +01:00
Richard Hughes
7886c086a1 Don't upload reports when the user has configured their system in a broken way
I'm getting a bit fed up with failed reports from arch users where they just
have a broken system. I don't think it's useful to upload to the LVFS or notify
the vendor about failures like this.
2019-04-18 22:06:01 +08:00
Mario Limonciello
c73c02fa70 trivial: uefi: clarify errors related to secure boot 2019-04-17 16:39:29 +08:00
Mario Limonciello
a50b02faf2 uefi: Don't leak the application build path into the binary
This can be set at runtime if needed using environment variables.
2019-04-17 16:39:29 +08:00
Richard Hughes
cce6a1cb5a Do not report transient failures
We don't need to report failures to do with AC or battery level to the LVFS.
2019-04-17 08:20:44 +08:00
Richard Hughes
dce91204c9 Fix some typos spotted using codespell 2019-04-08 12:47:53 +01:00
Gary Lin
5d9984e5ad uefi: add a new option to specify the os name
fu_uefi_get_esp_path_for_os() generates the path to the OS directory
based on "ID" in /etc/os-release, and it may not work for some distros.

Take openSUSE as an example, the "ID" for openSUSE Leap is
"opensuse-leap" and that for openSUSE Tumbleweed is "opensuse-tumbleweed".
However, both of them use the same OS directory in the ESP, i.e.
"/EFI/opensuse".

This commit adds a new build option, efi_os_dir, to allow the packager to
specify the name of OS directory at build time instead of the runtime
detection.

Signed-off-by: Gary Lin <glin@suse.com>
2019-03-29 04:29:42 -04:00
Richard Hughes
0a57b90d75 uefi: More carefully check the output from tpm2_pcrlist
Otherwise we can get a PCR0 of 'getcapability:getpcrallocationstatuserror'...
2019-03-27 14:18:19 -04:00
Richard Hughes
77d97406f2 uefi: Don't overwrite CustomFlags if set from a quirk 2019-03-27 14:21:00 +00:00
Richard Hughes
5c18617e8f uefi: Actually upload the UPDATE_INFO entry for the UX capsule 2019-03-15 14:22:01 +00:00
Richard Hughes
72e7a82c88 uefi: Check the error code of QueryCapsuleCapabilities() correctly
We can't print max or reset as they are undefined in the event of failure.
2019-03-15 09:27:55 +00:00
Peter Jones
fda89fd15e Update the UEFI UX Capsule Header checksum when needed.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-03-14 14:06:06 -05:00
Richard Hughes
35b6e13d96 uefi: Copy the shimx64.efi binary for known broken firmware
Some system firmware helpfully 'deduplicate' the boot loader entries based on
the filepath, without taking into account either the label or optional data.

This means we have to use a custom copy of shim for firmware updates.
2019-03-14 17:00:53 +00:00
Mario Limonciello
f4c43592fc trivial: uefi: correct an order of operations looking for UX capsule
This was caught by LGTM.

This pointer might have type struct <unnamed> (size 28), but the
pointer arithmetic here is done with type UX_CAPSULE_HEADER * (size 16).
2019-03-05 09:39:29 +00:00
Mario Limonciello
65415e6c8d trivial: uefi: Remove an unnecessary warning caught by LGTM
This clause is indeed impossible to hit due to earlier checks
for the size of `is`.
2019-03-05 09:39:29 +00:00
Richard Hughes
f45c651dd1 uefi: Fix the self tests when running on Fedora SilverBlue 2019-02-26 19:13:35 +00:00
Richard Hughes
b768e4d924 Do not fail to start the daemon if tpm2_pcrlist hangs
In some situations SELinux prevents fwupd from executing tpm2_pcrlist, but the
failure mode is that the process just hangs and never completes. This causes
systemd to time out the fwupd daemon startup and then errors to be shown in
GNOME Software.

To prevent this happening, add an optional timeout argument to
fu_common_spawn_sync() and cancel the subprocess if it takes longer than this
to complete.

See https://bugzilla.redhat.com/show_bug.cgi?id=1665701 for details.
2019-02-26 14:27:13 +00:00
Mrmaxmeier
49448a99d4 uefi: fix segfault in fwup_set_update_statuses
If the near-zero memory region is populated, this caused UEFI
updates to get stuck trying to deref random pointers.
2019-02-15 21:26:56 +00:00
Richard Hughes
20f14c29cb uefi: Allow devices to create more complete fake UEFI devices
Also, gets rid of two 'TODO' warnings with LGTM.
2019-02-12 06:28:51 -06:00
Richard Hughes
10b2fef1bd trivial: Fix a 'Comparison is always true' LGTM warning
Not a bug, but somewhat muddled logic I guess.
2019-02-12 06:28:51 -06:00
Richard Hughes
bfd946e463 Use '#pragma once' to avoid a lot of boilerplate 2019-02-09 08:42:30 -06:00
Richard Hughes
65c81921b6 Add fu_device_add_instance_id() and prefer explicit conversion 2019-02-04 15:19:57 +00:00
Richard Hughes
592baedfff Export some of the GUID functionality 2019-02-04 15:19:57 +00:00
Richard Hughes
96e6783982 trivial: Fix potential compile failures for high -j values 2019-02-01 16:52:16 +00:00
Richard Hughes
1e07ec95b6 uefi: Disable -Wno-address-of-packed-member
Unaligned reads don't really matter on all the architectures the EFI binary is
being built for.
2019-02-01 16:38:14 +00:00
Richard Hughes
c6b94791ec uefi: Don't unconditionally enable Werror for the EFI binary 2019-02-01 16:38:14 +00:00
Richard Hughes
44ce5aeae4 uefi: Add a quirk to use the legacy bootmgr description
Some hardware from Lenovo deduplicates UEFI Boot entries, and uses the old
string 'Linux-Firmware-Updater' to avoid removing the firmware update entry.
Although this is forbidden in the UEFI specification we shouldn't break
firmware updates from old firmware versions.

Provide a quirk for this, and automatically whitelist anything with the LENOVO
SMBIOS Manufacturer.
2019-01-30 12:13:39 +00:00
Richard Hughes
4fef28d0ac trivial: Add the missing protocol IDs to the plugin READMEs 2019-01-29 22:28:09 +00:00
Richard Hughes
0a212fd1d6 uefi: Add a trivial debugging statement to debug a UX capsule failure 2019-01-25 11:04:35 +00:00
Richard Hughes
9ba9d8a98b uefi: Use fwup_new0() to allocate the updates table array
Although malloc probably works due to the page size, it's not the thing to use.
2019-01-25 11:04:30 +00:00
Mario Limonciello
68fb11f453 uefi: Correct a boot order creation bug (Fixes: #956)
Unfortunately the previous fix (6131f5d) introduced this bug.

The code previously was actually looking for the non-zero case
which was correct, but non-obvious since `efi_guid_cmp` works like
`g_strcmp0` where a match returns zero.

So rather than revert 6131f5d make this completly explicit.
2019-01-22 07:28:32 +00:00
Richard Hughes
088c258894 trivial: Make one uefi function static 2019-01-20 22:29:44 +00:00
Richard Hughes
c7327385f4 uefi: Remove all variable length arrays 2019-01-20 22:29:44 +00:00
Richard Hughes
31c10b7293 uefi: Fix a logic bug in fwup_search_file()
If n_handles==0 then we'd return with EFI_SUCCESS, rather than failure.
2019-01-20 22:29:44 +00:00
Richard Hughes
59407ca42d uefi: Use _cleanup_free in one more place 2019-01-20 22:29:44 +00:00
Richard Hughes
00b87884c4 uefi: Do not pass required attrs to fwup_delete_variable()
This lets us refactor some code and remove some complexity.
2019-01-20 22:29:44 +00:00
Richard Hughes
aa6498866c uefi: Delete the old Linux-Firmware-Updater boot entry 2019-01-20 22:29:44 +00:00
Richard Hughes
525433e4de uefi: Use the GNU-EFI BOOL type 2019-01-20 22:29:44 +00:00
Richard Hughes
818071d178 uefi: Refactor and simplify the EFI loader 2019-01-19 18:36:46 +00:00
Richard Hughes
f425d29a28 Show a console warning if loading an out-of-tree plugin
Fixes https://github.com/hughsie/fwupd/issues/950
2019-01-19 07:26:20 +00:00
Richard Hughes
4e30d25668 UEFI: Do the UX checksum calculation in fwupd
This makes the EFI binary much simpler.
2019-01-18 19:27:21 +00:00
Richard Hughes
09bf3b5246 trivial: Don't manually zero-fill efi_ux_capsule_header_t 2019-01-18 19:27:21 +00:00
Richard Hughes
4bdb513937 trivial: Make the capsule_image_size calculation more obvious 2019-01-18 19:27:21 +00:00
Richard Hughes
72c18fd4e4 Use GCC __cleanup__ features in the EFI loader
This simplifies memory management.
2019-01-16 12:06:09 -06:00
Richard Hughes
b6e9dacc9a uefi: Do not check the BGRT status before uploading a UX capsule
Microsoft description about the Status is:

    The Status field of the BGRT describes whether the image is currently
    displayed on the screen. This is not applicable to the firmware update
    display capsule.

Many thanks to Steven Chang for identifying this issue.

Fixes: https://github.com/hughsie/fwupd/issues/935
2019-01-16 13:08:48 +00:00
Richard Hughes
0e17e6d030 Fix building with -Wl,-z,defs
This allows us to find undefined references at compile time, not runtime.
2018-12-25 16:10:54 -06:00
Richard Hughes
b56015ed3f uefi: Add the PCR0 value as the device checksum for system firmware
We can't actually access the UEFI ROM from userspace, but the PCR0 is a hash
built from the ROM itself. We could use this value to ensure the firmware has
been written correctly, and that the PCR0 matches the expected value specified
in the metadata.
2018-12-14 19:23:04 +00:00
Richard Hughes
9729584ee4 Allow plugins to define support for a 'well-known' protocol
Future metadata from the LVFS will set the protocol the firmware is expected to
use. As vendors love to re-use common terms like DFU for incompatible protocols,
namespace them with the controlling company ID with an approximate reverse DNS
namespace.

This also allows more than one plugin to define support for the same protocol,
for instance rts54hid+rts54hub and synapticsmst+dell-dock.
2018-12-14 18:15:01 +00:00
Mario Limonciello
8612318158 uefi: When adding headers set the header size to 4k
This solves issues with implementations that require 4k alignment
of pages in BIOS which is seen on certain architectures.

The UEFI spec prescribes that the "minimum" size is the size of
the EFI header but that this may be increased up to larger sizes
due to extended header entries.
2018-12-11 12:51:57 -06:00
Mario Limonciello
2ac3aca2a7 uefi: Append the header on capsules without headers from Linux
This allows using better heuristics and potentially phasing this out
in the future.
2018-12-11 12:51:57 -06:00
Mario Limonciello
6131f5df8f trivial: uefi: correct a logic error in setting variable
efi_guid_cmp uses memcmp and hence should return 0 when a match
is found.
2018-12-11 12:51:57 -06:00
Richard Hughes
a0da340b60 uefi: Do not add devices with invalid GUIDs
Note: We deliberately don't add the device without 'UPDATABLE' as there's
nothing the user can actually do to repair this themselves.
2018-12-07 09:05:30 -06:00
Richard Hughes
0585172c17 trivial: Document the expected plugin firmware formats 2018-12-03 08:48:13 -06:00
Richard Hughes
ba2f0ae1d4 trivial: Document the GUID generation scheme
Fixes https://github.com/hughsie/fwupd/issues/837
2018-11-08 20:39:46 +00:00
Richard Hughes
74fe343213 Add version format quirks for several Lenovo machines 2018-10-18 19:31:04 +01:00