Commit Graph

170 Commits

Author SHA1 Message Date
Richard Hughes
16b463334e Export the generic Intel Thunderbolt firmware format
This is being used for other products, e.g. USB4 docks.

If non-Intel firmware is being used (e.g. ASMedia) then the explicit
calls to `fu_intel_thunderbolt_nvm_new()` can be changed to something
like `fu_firmware_new_from_gtypes()` with all the formats listed.
2022-08-30 14:20:14 +01:00
Mario Limonciello
b7b0ce533d trivial: Unify ambiguity between bios-attrs and bios-settings
These are currently used interchangeably since there was indecisiveness
which to use as the feature was being developed.

As outward facing it will be named with "settings", change all uses
in the code to match this.
2022-08-24 07:20:01 -05:00
Mario Limonciello
7ddbe5e0b3 trivial: don't let people try to turn off UEFI secure boot
The firmware from both Dell and Lenovo actually blocks this, but the
error message is pretty confusing.

```
$ sudo fwupdtool set-bios-setting SecureBoot Disable
17:39:40:0249 FuBiosAttrs          KERNEL BUG: thinklmi doesn't export a 'type' attribute
Loading…                 [-                                      ]
failed to write 7 bytes to 17: Invalid argument
```
2022-08-10 11:09:31 -05:00
Mario Limonciello
7660222240 Add a unique identifier to all BIOSAttr objects
This identifier can be used by plugins or the daemon to disambiguate
behavior between two different drivers.

Set it up so that plugins don't NEED to use it, but optionally can
find attributes by either name or ID
2022-07-29 11:31:50 -05:00
Mario Limonciello
5ded4f44fe Add support for reading and writing firmware attributes
This support is comprehensive:
 * Client library support
 * Daemon support
 * plugin support
 * Client tool support (with new commands)
2022-07-28 17:30:57 -05:00
Richard Hughes
221238b4c0 trivial: Allow each device to specify a different acquiesce delay
Different device classes may need different values, and these may need
modifying by quirks. Also use 50ms to flush out any pending events.
2022-07-21 15:27:04 +01:00
Richard Hughes
0c51630991 Check firmware magic in a more standard way
Some parsers are ignoring the magic when using _FLAG_IGNORE_CHECKSUM
(which is wrong; fuzzers have no problem with enforcing a static prefix)
and other either disregard the offset or check the magic in an unsafe
way. Also, use FWUPD_ERROR_INVALID_FILE consistently for magic failure.

Add a vfunc, and move all the clever code into one place.
2022-07-14 14:48:15 +01:00
Richard Hughes
7a224007f2 Add support for Flat Image Tree aka FIT firmware 2022-07-08 14:05:20 +01:00
Richard Hughes
f3755ef708 Add support for Flattened Devicetree aka FDT firmware 2022-07-08 14:05:20 +01:00
Richard Hughes
57a1270bad Add fu_firmware_get_parent() for future use
Some firmware stacks images hierarchically, and it's useful to be able
to get the parent when unrolling them out into a linear format.
2022-07-05 16:47:18 +01:00
Richard Hughes
e6fee15d3c
Skip uSWID self tests when compiled without cbor support (#4800)
Fixes https://github.com/fwupd/fwupd/issues/4791
2022-07-05 10:20:46 +00:00
Richard Hughes
de31992522 trivial: Fix a tiny memory leak in the self tests 2022-07-01 13:57:18 +01:00
Richard Hughes
91cb4e7274 trivial: Relax some timings a little to fix running valgrind 2022-07-01 13:57:18 +01:00
Richard Hughes
726d20e498 Ensure more firmware formats can round-trip to and from XML
This greatly improves the coverage stats too.
2022-07-01 13:57:18 +01:00
Richard Hughes
96b423e04f Add support for IFWI Intel Flash Program Tool (aka FPT) firmware 2022-06-28 10:09:58 +01:00
Richard Hughes
0a7eb03704 Add a linear firmware wrapper
This allows us to parse any concatenated firmware format where the
image size is stored in the image.
2022-06-28 10:09:58 +01:00
Richard Hughes
08c7172168 Add support for parsing OptionROM firmware 2022-06-28 10:09:58 +01:00
Richard Hughes
f1542c3f9f Add support for IFWI Intel Code Partition (aka CPD) firmware 2022-06-28 10:09:58 +01:00
Richard Hughes
cf9ebdb703 Add startup profiling functionality
Using `sudo FWUPD_PROFILE=10 ./src/fwupd --verbose` will print a
dump of startup times onto the console so that we can debug which
plugin is slowing down system startup. For example:

    ../src/fu-engine.c:5409:plugins-coldplug [108.55ms]:
        ../plugins/amt/fu-plugin-amt.c:437:amt [27.14ms]:
            :create-context [12.66ms]
            :get-version [8.44ms]
            :add-device [3.95ms]
2022-06-14 22:08:02 +01:00
Richard Hughes
30aab6f564 Copy the instance ID strings when incorporating
Also, add a test.
2022-06-14 21:01:57 +01:00
Richard Hughes
d4d0ba0faf Unexport fu_common_cab_build_silo()
There's no reason this needs to be in the shared library.
2022-06-14 14:36:52 -05:00
Richard Hughes
3eaa907534 Remove the now unnecessary fu_smbios_to_string() 2022-06-14 14:36:52 -05:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
4105768a01 Remove the 'common' prefix when parsing version numbers 2022-06-14 14:36:52 -05:00
Richard Hughes
3e0a4dc1c3 Be smarter and include less header files per source file 2022-06-14 14:36:52 -05:00
Richard Hughes
7f86ffab6f Split out the dump helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
72ca59653e Unexport fu_common_uri_get_scheme()
We don't want plugins to be using this.
2022-06-14 14:36:52 -05:00
Richard Hughes
2c5e4ff3ab Unexport fu_common_firmware_builder()
We don't want plugins to be using this.
2022-06-14 14:36:52 -05:00
Richard Hughes
3f77af3cd4 Split out the kernel helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
fd9b9db5b3 Unexport fu_common_instance_id_strsafe()
We want plugins to use the instance ID builder instead now.
2022-06-14 14:36:52 -05:00
Richard Hughes
25dccf09f7 Unexport fu_common_spawn_sync()
This isn't something we want plugins to use.
2022-06-14 14:36:52 -05:00
Richard Hughes
425fedcca1 trivial: Remove fu_byte_array_set_size_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
ed1b13da28 Split out the memory helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
4b1313b406 Split out the GByte helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
3fe9c0de34 Split out the CRC and sum functions to new source files 2022-06-14 14:36:52 -05:00
Richard Hughes
9b29d70f31 Add a progress flag to indicate for when the child returns early
Using `fu_progress_finished(fu_progress_get_child(progress))` is IMHO
a hacky workaround.
2022-06-14 14:31:19 +01:00
Richard Hughes
e6b487e762 Add FuProgress to ->startup() and ->coldplug()
This allows us to profile the daemon startup so we can find any plugins
taking an inordinate amount of time to start.
2022-06-04 20:21:50 +01:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
Richard Hughes
4ee6cce9b8 Remove some duplicated unsafe API 2022-06-03 13:47:11 -05:00
Richard Hughes
517dc88f4f trivial: Fix the win32 CI tests 2022-05-06 13:55:51 +01:00
Richard Hughes
beb49d7ac0 trivial: Add fu_common_read_uint24() helper for future code 2022-04-28 14:18:30 +01:00
Richard Hughes
855ece352d Check the alignment when reading in raw firmware 2022-04-28 14:15:49 +01:00
Richard Hughes
0b7af7d54b trivial: Ignore the return value of setenv() in most cases
This makes Coverity happy.
2022-04-13 15:08:12 +01:00
Mario Limonciello
3006d238d6 Automatically obsolete negative duplicate attributes
To a user there is no point to explicitly showing two failures for
encrypted RAM if the system supports SME and TSME both.

To show them a single failure, de-duplicate the attributes by appstream
ID during depsolve.

If the plugin didn't explicitly set obsoletes and two attributes are both
failures and both share the same appstream ID obsolete one of them.
2022-04-12 11:59:49 -05:00
Richard Hughes
dcd39d80a7 Add the CFI quirks in setup() so the device can be open 2022-03-31 12:47:13 +01:00
Richard Hughes
5817ef3b4f Emit 0% in FuProgress to show the child has started
This prevents showing the 'old' percentage until the first sub-task has
completed for some device firmware updates.
2022-03-29 20:04:26 +01:00
Richard Hughes
6b5d933e99 Do not show unconnected or unreachable devices in the client tools
Fixes https://github.com/fwupd/fwupd/issues/4378
2022-03-15 14:08:17 +00:00
Daniel Campello
61226b49f3 fwupdplugin-self-test: fix spawn tests for qemu
Wrap the spawned script with an explicit call to the /bin/sh
interpreter needed when running tests in a cross compiled enviroment.

Also increase the timeout for the spawned script to execute to give
enough time for the print to happen in the much slower virtualized
environment.

Change-Id: I71ed377e1bc8db4be4c522cdb9562c1662df7266
2022-03-09 17:32:40 -07:00
Richard Hughes
adfef91731 trivial: Strip leading and trailing spaces from the vendor name 2022-02-24 17:07:44 +00:00