Commit Graph

76 Commits

Author SHA1 Message Date
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
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
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
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
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
62ba9a6f2f uefi: Check the flashes left before installing firmware 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
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
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