Commit Graph

81 Commits

Author SHA1 Message Date
Richard Hughes
504e8db1a0 uefi-capsule: Add the apply method to the uploaded report
We want to be able to differenciate failures for a specific update
method, e.g. finding if should be enabling CoD by default or not.
2021-09-03 13:11:17 -05:00
Ilias Apalodimas
4eca8be63d uefi-capsule: Update documentation for CoD
Capsule update on-disk was added a while ago.
Document the config file changes and limitations on firmwares that's
doesn't support RT->SetVariable

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-09-02 17:54:34 +01:00
Mario Limonciello
92c8f0e727 trivial: fix the grub configuration from 684bc03
fixes #3685
2021-09-01 09:40:24 -05:00
Richard Hughes
d8af914072 trivial: Remove some unused variables 2021-08-28 10:17:56 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Mario Limonciello
684bc03813 trivial: fix various shellcheck warnings 2021-08-18 07:58:17 -05:00
Mario Limonciello
747aeb5f8a trivial: uefi-capsule: remove an always true condition
found by codacity
2021-08-18 07:58:17 -05:00
Richard Hughes
a5a978b3f6 Rename some confusing API
More than one person has asked about 'why call fu_plugin_update() for a
reinstall or downgrade' and I didn't have a very good answer.

The plugin API is not officially stable, and we should fix things to be
less confusing. Use the same verbs as the FuDevice vfuncs instead.
2021-08-06 19:49:53 +01:00
Richard Hughes
6c2535a71f uefi-capsule: Disable all UX capsules for Lenovo hardware
Applying updates to my new P1G3:

 * schedule the update in fwupd
 * boot into the BootNext
 * apply the capsule with RT->UpdateCapsule
 * reboot with RT->ResetSystem

Except the firmware updater EFI binary then wasn't running. The ESRT
last_attempt_status comes back as Success on the reboot.

Disabling the UX capsule made the update apply correctly each and every
time. Until we can work out what models are affected, use a per-vendor
quirk to avoid delaying the release.
2021-08-02 14:26:45 +01:00
Mario Limonciello
b87c6dab95 uefi-capsule: Add support for installing UEFI updates from GRUB
Shim has had a hard time with loading updates from arguments in the
most recent release and this isn't the first time that happened.

Give distros and users an escape hatch that will allow using GRUB
instead.
2021-07-28 17:11:39 +01:00
Richard Hughes
3747e245e5 uefi-capsule: Add support for CapsuleOnDisk
Based on a patch by Ilias Apalodimas <ilias.apalodimas@linaro.org>,
many thanks.

Fixes https://github.com/fwupd/fwupd/issues/2900
2021-07-28 17:11:39 +01:00
Richard Hughes
f2fd6b0717 trivial: Do not save the self test quirk silo to disk
This also speeds up the tests as the amount of pointless i/o is reduced.

Fixes https://github.com/fwupd/fwupd/issues/3522
2021-07-22 12:51:47 +01:00
Richard Hughes
9f808bdbc0 uefi-capsule: Convert two metadata booleans to private flags 2021-07-22 12:47:54 +01:00
Richard Hughes
305e69f73b uefi-capsule: Rename the plugin flag to match the device flag 2021-07-22 12:47:54 +01:00
Richard Hughes
7b40c111c7 uefi-capsule: Move the results capsule to the FuDevice subclass
This allows us to create subclasses of FuUefiDevice that use different
ways to report update success.
2021-07-22 12:47:54 +01:00
Richard Hughes
d562c007a3 update-capsule: Move FuUefiDevice to a derivable for future use 2021-07-22 12:47:54 +01:00
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00
Richard Hughes
a564e458d2 trivial: Fix Python linting issue spotted by Codacy 2021-07-14 15:20:57 +01:00
Richard Hughes
5eabab90f4 trivial: Don't set a device ID if setting a physical ID
This isn't actually doing anything as setting a physical ID invalides
the manually-set ID.
2021-07-09 14:08:12 +01:00
Richard Hughes
d4bd5cca5a Standardize some of the device summary text
This is supposed to be 'Sentence case' with no trailing fullstop.
2021-07-09 07:07:07 +01:00
Mario Limonciello
1d44dce78a trivial: remove some unused variables 2021-06-23 08:29:56 -05:00
Richard Hughes
aaa77c6f51 Allow adding and removing custom flags on devices
The CustomFlags feature is a bit of a hack where we just join the flags
and store in the device metadata section as a string. This makes it
inefficient to check if just one flag exists as we have to split the
string to a temporary array each time.

Rather than adding to the hack by splitting, appending (if not exists)
then joining again, store the flags in the plugin privdata directly.

This allows us to support negating custom properties (e.g. ~hint) and
also allows quirks to append custom values without duplicating them on
each GUID match, e.g.

[USB\VID_17EF&PID_307F]
Plugin = customflag1
[USB\VID_17EF&PID_307F&HUB_0002]
Flags = customflag2

...would result in customflag1,customflag2 which is the same as you'd
get from an enumerated device flag doing the same thing.
2021-06-23 07:59:15 +01:00
Mario Limonciello
78b78d8edd trivial: update python black style to 21.6b0 2021-06-16 06:41:46 -05:00
Sergii Dmytruk
c0d0ce4e1a Switch from sysctl to ioctl for ESRT on FreeBSD
Initial version of the patch was rejected and rewritten.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-15 17:25:16 +01:00
Sergii Dmytruk
9c21e4e135 Depend on libefivar in uefi-capsule
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-15 17:25:16 +01:00
Mario Limonciello
73cdf067ed trivial: fixup includes for a variety of plugins 2021-06-14 10:12:45 +01:00
Richard Hughes
694e774c2a uefi-capsule: Make less Linux-specific
Based on patches by Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-07 19:54:12 +01:00
Sergii Dmytruk
4558e5f317 Fix two off-by-one errors in uefi-capsule plugin
Data is accessed at offset 0x13, so the code must abort if size is
0x13 when you can access only offsets 0x00 through 0x12.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-07 11:18:57 +01:00
Sergii Dmytruk
cac4f98420 Improve error message in fu-uefi-backend-freebsd
"not supported" doesn't explain much.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-07 11:18:41 +01:00
Richard Hughes
03726227b7 uefi-capsule: Add FreeBSD ESRT support
Based on a patch by Sergii Dmytruk <sergii.dmytruk@3mdeb.com>, many thanks.
2021-05-25 17:17:45 +01:00
Richard Hughes
6c07675558 uefi-capsule: Split out the Linux specific ESRT enumeration
This allows us to add the same functionality for FreeBSD and Windows.
2021-05-25 17:17:45 +01:00
Richard Hughes
1113a7aa11 trivial: Allow setting FuUefiDevice properties at construction 2021-05-25 17:17:45 +01:00
Sergii Dmytruk
1a328fd3ad Branch explicitly per OS type
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-05-18 06:49:47 +01:00
Sergii Dmytruk
3d0e624ed3 Include <efivar-dp.h> explicitly
On FreeBSD <efivar.h> doesn't include <efivar-dp.h>.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-05-18 06:49:47 +01:00
Sergii Dmytruk
113a91985b Handle missing defaults in fu-uefi-devpath.c
FreeBSD's libefivar native implementation doesn't provide these defines.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-05-18 06:49:47 +01:00
Richard Hughes
769cbbf8af Add support for the PHAT table
On Alterlake and newer hardware the Platform Health Assessment Record
data can be used by the IHV to debug why a specific capsule update
failed. Any custom firmware loaded by the OEM can be identified and
used to further debug the root cause.
2021-05-12 12:02:33 +01:00
Richard Hughes
1ac05ef3bd trivial: Codespell fixes 2021-04-26 10:29:39 +01:00
Mario Limonciello
99832622e1 uefi-capsule: Move EFI binary into a subproject
This will allow distributions to package and distribute the unsigned
EFI binary separately, similar to what has been done for GRUB.
2021-04-23 13:59:10 -05:00
bubbleguuum
751edfab65 Fix /etc/os-release ID_LIKE field parsing
Parse ID_LIKE according to 'man os-release':
"A space-separated list of operating system identifiers in the same
syntax as the ID= setting"
2021-04-19 14:46:54 +01:00
Ross Burton
57961cddac Add option to disable the UEFI capsule splash screen generation
The dependencies to generate the "updating..." splash screen are non-trivial, and
pointless in headless systems.  Add an option to disable the generation entirely.
2021-04-13 12:31:17 +01:00
Richard Hughes
c4bc709359 Do not use help2man to build manual pages
This prevents problems when cross compiling. Using help2man is now also of
limited use; if we can just tell the user to use --help we do not need to keep
the manual in sync.

It also allows us to drop the several other supporting files that we use when
the help2man output isn't actually that useful.

Fixes https://github.com/fwupd/fwupd/issues/3025
2021-04-11 13:42:04 +01:00
Mario Limonciello
1f9c035788 trivial: fix some trailing whitespace problems across the project 2021-04-09 16:02:20 +01:00
Richard Hughes
13524af202 Write BMP data directly without using PIL
This allows us to drop a build-time dep.
2021-04-09 15:59:51 +01:00
Mario Limonciello
6d1afc3e87 trivial: reformat all python code with black 2021-04-08 10:43:29 -05:00
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
Javier Martinez Canillas
011db8e467 uefi-capsule: Sync linker scripts with latest used by shim
The linker scripts used in the project were copied from the shim project,
but there were a few fixes made after this original copy.

Until binutils have proper pei-aarch64 support, the linker scripts should
be kept in sync to make sure that the PE32+ binaries are built correctly.

The fixes included in this change are the following:

 * Include missing .text sections in PE/COFF binary (Chris Coulson)
 * Put .sbat after _edata (Peter Jones)
 * Fix some PE headers for arm and aarch64 (Peter Jones)
 * Include the aligned part in SizeOfRawData of sbat for arm and aarch64 (Gary Lin)
 * Swizzle some sections to make old sbsign happier for arm and aarch64 (Peter Jones)
 * Put .rel* and .dyn* in .rodata for arm and aarch64 (Peter Jones)
2021-04-07 13:46:58 +01:00
Richard Hughes
b333e0045c Split out a shared system context
There is a lot of code in fwupd that just assigns a shared object type to
a FuPlugin, and then for each device on that plugin assigns that same shared
object to each FuDevice.

Rather than proxy several kinds of information stores over two different levels
of abstraction create a 'context' which contains the shared *system* state
between the daemon, the plugins and the daemon.

This will allow us to hold other per-machine state in the future, for instance
the system battery level or AC state.
2021-04-01 21:11:29 +01:00
Richard Hughes
b9ac0bc029 Add fu_device_inhibit() to mark the device as non-updatable
We already have two things managing the UPDATABLE_HIDDEN->UPDATABLE transition,
and we're about to add a third.

Add a 'stackable' inhibit-style API so we do not accidentally mark a device as
updatable when it should remain hidden.
2021-03-31 19:19:46 +01:00
Steve McIntyre
50348e1104 Tweak the SBAT output for a vendor string
The format is meant to be "<project>.<vendor>" with a period as a
separator.

Signed-off-by: Steve McIntyre <93sam@debian.org>
2021-03-26 15:21:15 +00:00
Richard Hughes
a5966f7085 trivial: Codespell fixes 2021-03-19 16:42:33 +00:00