Commit Graph

269 Commits

Author SHA1 Message Date
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
Richard Hughes
ce712426f8 uefi: Set the quirks on created devices
Ensure the quirk object is set, and then add the GUIDs first so that the
version format can be set from a quirk file.

Additionally, only overwrite the fallback name if the name has not already been
set manually from a quirk.
2018-10-18 19:31:04 +01:00
Richard Hughes
481aa2a923 Port from libappstream-glib to libxmlb
The libxmlb library is much faster to query, and does not require the daemon
to parse the XML metadata at startup. It's a zero-copy mmap design that is more
modern and less clunky.

RSS has reduced from 3Mb (peak 3.61Mb) to 1Mb (peak 1.07Mb) and the startup
time has gone from 280ms to 250ms.
2018-10-17 14:41:13 +01:00
Richard Hughes
05cbb7245c Don't use AppStream-glib for version helpers
Refactor the imported version format code now we now longer need to stick to
the API mistakes of libappstream-glib.
2018-10-11 07:54:01 +01:00
Mario Limonciello
dc48bec157 uefi: Move the TPM unlocking functionality from the Dell to UEFI plugin
This allows devices that have been registered to be correctly unlocked.
2018-10-10 14:30:49 +01:00
Mario Limonciello
56a4d82203 trivial: Add ESP path into fu_uefi_device_to_string() 2018-10-10 14:30:49 +01:00
Mario Limonciello
6ed307c5fb trivial: uefi: Only set EFI variables on real systems
Avoids copying from a NULL pointer.
Caught via clang static analysis
2018-09-21 07:35:08 +01:00
Richard Hughes
ccd3b2a61f uefi: Check the amount of free space on the ESP
Fixes https://github.com/hughsie/fwupd/issues/670
2018-09-12 13:56:02 +01:00
Mario Limonciello
4e0bb5d5c9 trivial: uefi: fix a signed vs unsigned issue
This started popping up in Arch CI:
../fwupd/plugins/uefi/fu-uefi-vars.c: In function ‘fu_uefi_vars_get_data’:
../fwupd/plugins/uefi/fu-uefi-vars.c:233:9: error: pointer targets in assignment from ‘gchar *’ {aka ‘char *’} to ‘guint8 *’ {aka ‘unsigned char *’} differ in signedness [-Werror=pointer-sign]
   *data = g_steal_pointer (&data_tmp);
         ^
2018-09-07 23:32:03 -05:00
Richard Hughes
c125ec02ed Clarify what the platform ID actually is by renaming it
It wasn't hugely clear what the platform ID was actually meant to represent. In
some cases it was being used like a physical ID, in others it was a logical ID,
and in others it was both. In some cases it was even used as a sysfs path.

Clear up all the confusion by splitting the platform ID into two parts, an
optional *physical* ID to represent the electrical connection, and an optional
*logical* ID to disambiguate composite devices with the same physical ID.

Also create an explicit sysfs_path getter for FuUdevDevice to make this clear.

This allows WAIT_FOR_REPLUG to always work, rather than depending on the order
that the GUIDs were added, and that the kernel would always return the same
sysfs path (which it doesn't have to do, especially for hidraw devices).
2018-09-06 16:22:46 +01:00
Richard Hughes
85f53a418c uefi: Add the Windows 10 device ID for compatibility 2018-09-05 05:59:43 -05:00
Richard Hughes
2aa3360d46 trivial: Include appstream-glib.h in the main plugin header 2018-09-04 08:22:39 -05:00
Richard Hughes
4adf3bb52c trivial: Remove duplicate header includes 2018-09-04 08:22:39 -05:00
Mario Limonciello
9ef5f741bc plugins: Set platform IDs for non-USB/non-UDEV plugins 2018-09-02 14:45:39 -05:00
Richard Hughes
22367e7948 trivial: Refactor out functionality from a mega-method 2018-08-30 16:53:19 +01:00
Richard Hughes
73bf2337c1 trivial: Add fu_common_strtoull() as a shared function 2018-08-28 09:41:10 +01:00
Richard Hughes
95227a919d trivial: Move gudev to the core plugin deps 2018-08-26 19:38:58 +01:00
Richard Hughes
29129ed4f4 uefi: Allow upgrades using a self-signed fwupd.efi binary
This doesn't require shim, so for this uncommon case add a configure option.

Fixes https://github.com/hughsie/fwupd/issues/669
2018-08-23 14:30:04 +01:00
Mario Limonciello
df60f69814 uefi: Add special handling for /efi (Closes #680)
This is a similar problem to #627 (which was fixed by 9bdbbc5ca).
Add special handling to allow writing to /efi/EFI
2018-08-22 16:43:20 -05:00
Mario Limonciello
25b49b6a6f uefi: Add 'autofs' to supported filesystems (Closes: #660)
systemd-automount will unmount the ESP when not in use for some
people.  This causes automatic ESP detection to fail.

In this case the ESP will need to be added to the conf file and
then this commit will let it keep working.
2018-08-20 07:44:17 -05:00
Richard Hughes
4721112601 uefi: Don't assert when run as non-root 2018-08-13 11:29:37 +01:00
Mario Limonciello
9bdbbc5ca8 uefi: Handle /boot properly (Closes: #627)
/boot is a special cased directory when using ProtectSystem=full

Due to this, it's marked read only even if it's listed in ReadWritePaths.

Allow folks to use this for their ESP, but they need to create /boot/EFI
in advance of starting fwupd.
2018-08-09 09:28:50 -05:00
Richard Hughes
e5e441908f uefi: Fix reporting errors when getting info about efivars
Found using Coverity.
2018-08-09 15:27:36 +01:00
Richard Hughes
84960d9ba2 uefi: Fix up some trivial NULL/FALSE confusion 2018-08-09 14:21:23 +01:00
Richard Hughes
d2808801a6 trivial: Ensure all source files include config.h 2018-08-09 14:21:23 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
4ab6116ea0 uefi: Fix encoding the GUID into the capsule EFI variable
Before:

$ /usr/lib/fwupd/fwupdate --info
Information for the update status entry 0:
  Information Version: 7
  Firmware GUID: {00000000-0000-0000-0000-000000000000}
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Capsule Flags: 0x00131072x
  Hardware Instance: 0
  Update Status: attempt-update
  Capsule File Path: /EFI/ubuntu/fw/fwupd-7ceaf7a8-0611-4480-9e30-64d8de420c7c.cap

After:

$ /usr/lib/fwupd/fwupdate --info
Information for the update status entry 0:
  Information Version: 7
  Firmware GUID: {7ceaf7a8-0611-4480-9e30-64d8de420c7c}
  Capsule Flags: 0x00131072x
  Hardware Instance: 0
  Update Status: attempt-update
  Capsule File Path: /EFI/ubuntu/fw/fwupd-7ceaf7a8-0611-4480-9e30-64d8de420c7c.cap
2018-08-09 08:14:04 +01:00
Mario Limonciello
fd99902ba8 uefi: Test for read only efivarfs (Closes: #625) 2018-08-09 08:11:40 +01:00
Richard Hughes
03aead9fe7 uefi: Check the filesystem type when checking the ESP 2018-08-08 20:35:04 +01:00
Richard Hughes
99b0b1be04 uefi: Check the user-supplied ESP path
Additionally, if the user specified something invalid, do not autodetect the
ESP but return with a journal error. It seems wrong to ignore what the user
explicitly set and perhaps do something dangerous.

Alternative to https://github.com/hughsie/fwupd/pull/599
2018-08-08 20:35:04 +01:00
Richard Hughes
34ea74fb2c uefi: Don't override _FORTIFY_SOURCE when building the EFI binary
Fixes https://github.com/hughsie/fwupd/issues/631
2018-08-08 20:16:53 +01:00
Mario Limonciello
d1775bc026 uefi: Populate UpdateError with reasons that the plugin won't run
Previously if missing secure boot binaries, or invalid ESP was created the
plugin would just not load.

Now instead populate UpdateError and remove the updateble flag, but still show
the device in fwupdmgr and fwupdtool.
2018-07-17 14:30:27 +01:00
Mario Limonciello
e6e2bf9d97 trivial: Allow EFI application path to come from a different root 2018-07-10 14:10:16 -05:00
Mario Limonciello
fd65ddda8a uefi: Rename all intermediary files and UEFI variables to prefix fwupd
fwupdate prefix is used by fwupdate and this will prevent clashes in case
its used instead.
2018-07-10 10:45:39 -05:00
Mario Limonciello
14fad85164 UEFI: Rename UEFI boot entry
1) Drop the path at the end of the title (\fwupdx64.efi)
2) Linux-Firmware-Updater to Linux Firmware Updater

The behavior that required the hacky name has been fixed since shim 10
which is in all the relevant distros now.
3322257e61
2018-07-10 10:45:39 -05:00
Mario Limonciello
44305bbde4 Rename EFI application from fwup<arch>.efi to fwupd<arch>.efi
This will prevent potentially clashing with fwupdate's EFI application
and allow them to remain co-installable.
2018-07-10 10:45:39 -05:00
Richard Hughes
7ecf0164de uefi: Show the stored capsule filename in fwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
57df956d7b uefi: Add a libexec tool to mimic the original fwupdate CLI interface 2018-06-28 15:51:11 +01:00
Richard Hughes
04f8f267c5 trivial: Move the guessing of the ESP to common code 2018-06-28 15:51:11 +01:00
Richard Hughes
1ccf35a9e4 dell: Register devices with the uefi plugin rather than using libfwup directly
The device registration allows us to create a 'virtual' device that can accept
capsule updates that is not found in the ESRT.
2018-06-28 15:51:11 +01:00
Richard Hughes
dd23871698 uefi: Do not link against libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
a80f79cb4d uefi: Upload the firmware capsule without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
11d62030a3 uefi: Upload the historical result without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
b157d6eff9 uefi: Unlock the ESRT without using libfwup
This will be handled by a Dell-specific plugin instead.
2018-06-28 15:51:11 +01:00
Richard Hughes
cff980cfda uefi: Do not get the custom ESP location from libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
fb0e94857f uefi: Upload the UX bitmap without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
f3f4ca0320 uefi: Clear the device status without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
5585b00892 uefi: Access /sys/firmware/efi/efivars directly rather than using efivars
This allows us to redirect the functions for our self tests.
2018-06-28 15:51:11 +01:00
Mario Limonciello
cfc22a8b90 uefi: Detect the EFI system partition location at runtime
Check across a list of common EFI system partition locations for a mounted
location before starting fwupd.

This also will cause the plugin to not initialize if the EFI system partition
is not mounted.
2018-06-28 15:51:11 +01:00
Richard Hughes
ca5b4a7c97 uefi: Do not use libfwupdate to get the list of resources 2018-06-28 15:51:11 +01:00
Richard Hughes
ae47a347e0 uefi: Do not enable the plugin if efivars are not available
If the user is using some super-old kernel or broken system we want to return
early with an error rather than try to catch each way this can fail at runtime.
2018-06-28 15:51:11 +01:00
Richard Hughes
af5ec20004 uefi: Get the framebuffer without calling into libfwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
d7cdf9fb67 uefi: Use FuUefiBgrt from the plugin code 2018-06-28 15:51:11 +01:00
Richard Hughes
b1e0ab98d1 uefi: Import the fwupd.efi sources from the fwupdate project 2018-06-28 15:51:11 +01:00
Richard Hughes
62ba9a6f2f uefi: Check the flashes left before installing firmware 2018-06-28 15:51:11 +01:00
Richard Hughes
83390f6556 uefi: Add functionality to parse the EFI framebuffer size 2018-06-28 15:51:11 +01:00
Richard Hughes
f758e7b73a uefi: Add functionality to parse the BGRT table supported 2018-06-28 15:51:11 +01:00
Richard Hughes
a593447695 uefi: Add functionality to get a bitmap size 2018-06-28 15:51:11 +01:00
Richard Hughes
6b8235660b trivial: Move getting the secure boot status to the common file 2018-06-28 15:51:11 +01:00
Richard Hughes
2b1fcfd662 trivial: Use FuUefiDeviceStatus in preference to the defines from fwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
25509c01ce trivial: Use FuUefiDeviceKind in preference to the defines from fwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
0766857407 uefi: Read the ESRT entries from a directory in sysfs 2018-06-28 15:51:11 +01:00
Richard Hughes
bd80edd6be uefi: Add a device superclass to model each ESRT entry 2018-06-28 15:51:11 +01:00
Richard Hughes
1a1d135b13 trivial: Add UTF8 to UCS2 helpers from the fwupdate project 2018-06-28 15:51:11 +01:00
Richard Hughes
87fb9ff447 Change the quirk file structure to be more efficient
This pivots the data storage so that the group is used as the preconditon
and the key name is used as the parameter to change. This allows a more natural
data flow, where a new device needs one new group and a few few keys, rather
than multiple groups, each with one key.

This also allows us to remove the key globbing when matching the version format
which is often a source of confusion.

Whilst changing all the quirk files, change the key prefixes to be more familiar
to Windows users (e.g. Hwid -> Smbios, and FuUsbDevice -> DeviceInstanceId)
who have to use the same IDs in Windows Update.

This also allows us to pre-match the desired plugin, rather than calling the
probe() function on each plugin.
2018-06-28 13:32:30 +01:00
Mario Limonciello
2d9bcf463f trivial: uefi: update the comment for _efi_get_variable_exists
The commit was merged in 0b3d29d2d8
which landed in efivar 35.
2018-06-24 06:53:24 +01:00
Mario Limonciello
2fd28a374d trivial: uefi: Don't return NULL matching devices
Fixes: 988e73c414
2018-05-30 19:57:13 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Richard Hughes
988e73c414 uefi: Search all available GUIDs when matching hardware
Using just the default GUID is fragile and might break if the GUIDs get added
in the 'wrong' order or if the GUID list is sorted.

Fixes https://github.com/hughsie/fwupd/issues/518
2018-05-19 23:07:40 +01:00
Mario Limonciello
dff281311c uefi: Set the alternate GUID for parenting later
Several places in the UEFI plugin operate on the default GUID rather
than iterating a list of GUIDs.  This is normally fine since UEFI
GUIDs are tied to the ESRT and normally one FuDevice shouldn't
have multiple GUIDs.

The alternate GUID was added to set parents accordingly but this
caused no CAB files to be able to install.

Fixes: cc664d7d (amt: Put the AMT device as a child under the system UEFI firmware)
2018-05-18 13:55:42 -05:00
Richard Hughes
cc664d7d36 amt: Put the AMT device as a child under the system UEFI firmware 2018-05-03 08:07:04 +01:00
Mario Limonciello
01b4f05072 uefi: Match the bootdir argument to fill in uefi.conf by default
This will make it more obvious which path it's defaulting to
2018-04-26 15:56:38 +01:00
Richard Hughes
34e0dab1f1 Add fu_plugin_add_compile_version()
This allows plugins to set and explicit build-time version. It also uses the
same AppStream component-ID scheme rather than the home-grown 'FooVersion' key.

Also, use the new runtime and compile-time versions in the report metadata.
Due to the key change we'll also need to update some LVFS rules.
2018-04-20 20:45:08 +01:00
Richard Hughes
0eb123b986 Allow requiring specific versions of libraries for firmware updates
In some cases firmware can only be installed with an up to date GUsb (e.g. with
some STM-DFU hardware) or with a new version of fwupdate (e.g. any UEFI
UpdateCapsule without a capsule header).

We should be able to match against other software versions like we can the
fwupd version, e.g.

    <requires>
      <id compare="ge" version="0.9.2">org.freedesktop.fwupd</id>
      <id compare="ge" version="11">com.redhat.fwupdate</id>
    </requires>

Also, rather than checking each requirement we know about on the component,
check each requirement on the component about things we know. This ensures we
don't allow firmware to be installs that requires for instance fwupdate 22 when
the runtime version is only being added in fwupdate 12 and up.

This means the following is now an error that will fail to allow the firmware
to be installed:

    <requires>
      <firmware>doesnotexist</firmware>
      <some_future_tag>also_unknown</some_future_tag>
    </requires>

Also add a lot of self tests to test the various new failure modes.

Fixes https://github.com/hughsie/fwupd/issues/463
2018-04-20 16:19:05 +01:00
Mario Limonciello
16d72a23ba Update the fwupdate minimum version to 10.
Similar logic as previous commit with versions in Ubuntu and Fedora.
2018-04-20 09:05:17 -05:00
Mario Limonciello
a98df55d82 Disable -Wunused-function on clang builds (Closes #467)
GLib creates two static inline functions for paramaters that may
not be used that set off warnings in clang but not gcc.

Ignore these on clang builds everywhere that
G_DEFINE_AUTOPTR_CLEANUP_FUNC is used.
2018-04-17 10:10:43 +01:00
Mario Limonciello
7877769cad trivial: uefi: Remove an unused variable
Caught by clang:

../plugins/uefi/fu-plugin-uefi.c:311:32:  warning: unused variable 'iter' [-Wunused-variable]
	g_autoptr(fwup_resource_iter) iter = NULL;
2018-04-17 10:10:43 +01:00
Mario Limonciello
937299d72b uefi: Check that EFI system partition is mounted (Fixes: #436)
If the ESP isn't mounted it's possible that the update may look
succesful on the Linux side, but certain to fail later.
2018-03-14 09:54:04 +00:00
Richard Hughes
d3cc2255e9 Delete any old fwupdate capsules and efivars when launching fwupd
Fixes https://github.com/hughsie/fwupd/issues/431
2018-03-09 13:44:45 +00:00
Richard Hughes
3b6397e08a trivial: Check for the ESRT supported status in setup() 2018-03-09 13:44:45 +00:00
Richard Hughes
54dcd29b3c trivial: Use the new fwup_get_esp_mountpoint() call to log the defined ESP 2018-03-09 13:44:45 +00:00
Richard Hughes
d421da0597 trivial: Set the fwupdate esp mountpoint in setup() 2018-03-09 13:44:45 +00:00
Richard Hughes
afd05b88bd trivial: Load the custom ESP mountpoint from _setup() 2018-03-09 13:44:45 +00:00
Richard Hughes
00a5f2cb30 trivial: Code style fixup 2018-03-02 14:52:42 +00:00
Mario Limonciello
963dc4245c
uefi: Allow overriding ESP mount point via conf file (Fixes: #421) (#422)
* uefi: Allow overriding ESP mount point via conf file (Fixes: #421)
2018-02-27 14:26:58 -06:00
Mario Limonciello
02c469052f uefi: Report if UX capsule was supported in the report metadata 2018-02-19 15:06:29 -06:00
Mario Limonciello
a076c81a07 uefi: Log the efivar library version too into the report 2018-02-13 19:19:11 +00:00
Mario Limonciello
b27639ae9f uefi: Save SecureBoot status into debug log and LVFS report 2018-02-13 09:18:30 -06:00
Mario Limonciello
65a61c7b6f uefi: Record the fwupdate library version in metadata
When creating a regex for https://github.com/hughsie/lvfs-website/issues/43
it would be useful to have this
2018-02-06 19:29:28 +00:00
Mario Limonciello
a50f985edc uefi: Add a device name for locked devices (#364)
These are devices that UEFI capsule support is turned off in BIOS
setup.  Unlocking them can turn UEFI capsule support
2018-01-15 19:32:18 +00:00
Mario Limonciello
a66ad15855 Fix UX capsule reference to the one in efivar
The work for this landed in what will turn into efivar 33.

Later down the road when efivar 33 is in most the major distros
this can be removed and a requirement set for efivar 33.
2018-01-12 09:08:18 +00:00
Richard Hughes
80b79bb9aa trivial: Allow plugins to add metadata to the uploaded reports 2018-01-11 21:28:22 +00:00
Richard Hughes
4a036018f7 Set the progress and state on the FuDevice, not the FuPlugin
This makes more sense; we're updating the device, not the plugin itself.

This also means we don't need to funnel everything through callbacks like
GFileProgressCallback and we can also update the state without adding an
explicit callback to each derived device type.
2017-11-30 20:51:52 +00:00
Richard Hughes
74a80ccc50 dell: Use the new quirk infrastructure for version numbers 2017-11-02 19:08:51 +00:00
Richard Hughes
5cc168fa79 uefi: Do not use system-specific infomation for PCI devices
We should not use system quirks for version formatting or use the SMBIOS name
as a prefix for non-integral devices.
2017-09-26 19:50:37 +01:00
Richard Hughes
2fac59f64a trivial: Refactor the UEFI resource coldplug into a new helper
No functional changes.
2017-09-26 19:50:37 +01:00
Richard Hughes
9b4a66c8f8 uefi: Support uploading the firmware splash image 2017-09-26 19:50:37 +01:00
Richard Hughes
d8790e19a9 trivial: Factor out the call to fwup_set_up_update_with_buf() for future use 2017-09-26 19:50:37 +01:00
Richard Hughes
08a37992f9 Allow plugins to depend on each other
The only things that plugins can declare is that they should be run before,
after or never with regard to another plugin.
2017-09-21 17:09:06 +01:00
Richard Hughes
c8d028207f uefi: Do not set the release version
Instead, put the failing version number in the error message where it belongs.
2017-09-13 14:05:50 +01:00
Richard Hughes
c1c2fec6f5 Add optional icons to each device
This allows us to show the devices in a GUI with a nice icon. Some of the icon
mappings are not perfect and I'll be asking the GNOME designers for some
additions to the icon specification.

Custom vendor icons can also be specified, and /usr/share/fwupd/icons would be
a good place to put them. If vendor icons are used they should show a physical
device with the branding, rather than just the vendor logo.
2017-09-11 17:27:35 +01:00