Commit Graph

134 Commits

Author SHA1 Message Date
Richard Hughes
0415db6f67 Revert "trivial: Use files() rather than current_source_dir()"
This reverts commit b581fa5670 as it breaks
`ninja dist` with `-Dgresource_quirks=enabled`.
2022-09-25 10:31:14 +01:00
Richard Hughes
b581fa5670 trivial: Use files() rather than current_source_dir() 2022-09-24 09:12:14 -05:00
Sean Rhodes
a4a1be569b
plugins/{superio,flashrom}: Add LabTop Mk III HwId (#4920)
Add the HwId for the Star LabTop Mk III when using coreboot firmware,
as this differs to AMI.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-08-12 14:00:50 +00:00
Sean Rhodes
639493259d
plugins/flashrom: Skip BC check for coreboot devices (#4892)
Set BcrAddr to 0x0 for all coreboot devices, so that the check of
BIOS Control is skipped as coreboot won't forcibly set this.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-08-02 10:11:55 -05:00
Richard Hughes
47efacfe5d Remove the firmware builder functionality
We used the firmware builder functionality to either build or modify
firmware images on the end-user system, e.g. copying the MAC address
from the old system image to the new system image.

Unfortunately running fwupd on the command line (e.g. ./src/fwupd)
leaves the tty connected and thus bubblewrap doesn't protect us from
installing malicious signed firmware. The firmware would have to have
been uploaded to the LVFS by a trusted vendor and signed before being
installed, which further decreases the severity of this problem.

As there was only one vendor who asked for this functionality (who have
yet to upload a single firmware to the LVFS...) just rip out this
functionality to reduce our attack surface and completely fix the bug,
and any like it.

Many thanks to Aaron Janse <aaron@ajanse.me> for discovering and
disclosing this issue to us.
2022-07-29 16:52:38 +01:00
Richard Hughes
829258401e Allow plugins and backends to print debugging information to the console
This is really useful for debugging.
2022-07-28 16:10:06 +01:00
Richard Hughes
a61bb37881 Build the quirk files into the daemon as a GResource
Interestingly, this increases the `fwupd` binary size by ~30kb but
reduces the installed size of /usr/share/fwupd/quirks.d by ~330kb.
2022-06-30 18:52:24 +01:00
Richard Hughes
b8be6daf1f trivial: Use 'priv' for plugin private data to be consistent 2022-06-26 13:57:53 -05:00
Gaël PORTAY
299b42fe96 trivial: Make meson.build indentation consistent 2022-06-21 03:27:38 -04:00
Richard Hughes
faa7871b08 Remove duplicate ->probe() calls to speed up startup by 150ms
Now incorporate is fixed to copy across the properties we need in the
superclass, we don't need to do the subclass ->probe().

Note, we still need to do the subclassed ->probe() when using
FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT or when looking at properties
on the parent device.

This also removes the spurious 'already set GType to FuVliUsbhubDevice,
ignoring FuVliUsbhubDevice' messages when running the daemon.
2022-06-14 21:01:57 +01:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
067d7d8088 Split out the path helpers to a new source file 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
0d1ba6667f trivial: Remove a few ctags headers that snuck in 2022-06-14 17:57:38 +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
2870426958 trivial: Fix a critical warning when no flashrom devices are found 2022-05-10 10:39:04 +01:00
Richard Hughes
9f584a234a flashrom: Allow dumping firmware using fwupdtool 2022-05-04 14:10:18 +01:00
Richard Hughes
c0bdb8dd7a flashrom: Only set the BIOS size if not already quirked 2022-05-04 11:11:23 +01:00
Richard Hughes
5ac8594d92 flashrom: Use more ideomatic GLib style 2022-05-04 11:11:23 +01:00
Sergii Dmytruk
e9f765dc47 plugins/flashrom/fu-flashrom-device.c: create layout on open
This avoids possible reading IFD multiple times and fixes a memory leak
of layout on errors and an unconditional leak in
fu_flashrom_device_prepare(), which didn't call
flashrom_layout_release().

Notice that flashrom_layout_set() call does NOT transfer ownership.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
e1d708a4ff plugins/flashrom: manage flashrom context at plugin level
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
ddf4e10d7b plugins/flashrom: enable for 2 Tuxedo laptops
Their ME region in flash can be unlocked manually, give user
instructions on how to do it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
e65cb98cc8 plugins/flashrom: add flashrom-specific GUIDs
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
2bac03eee1 plugins/flashrom: create separate device for ME region
Created only if intel_spi plugin indicates that the region exists by
creating its own device for it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
523ed0d7b4 plugins/flashrom: make region we're flashing a property
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-19 10:47:41 +01:00
Richard Hughes
2d5186622c Add FuProgress to ->prepare and ->cleanup
Some plugins were creating local versions (which were not attached to
the daemon progress in any way) as a workaround as they needed to do
actions that took a long time to complete.
2022-04-15 16:50:06 +01:00
Richard Hughes
18301f92cf flashrom: Fix a harmless warning when adding an instance ID 2022-04-05 11:38:30 +01:00
Richard Hughes
3390d7f9a5 flashrom: Allow quirking the flashrom flash size
We were using an 'undocumented' local copy of the flash size, when
FuDevice was setting the [ignored] standard device property.
2022-04-05 11:38:30 +01:00
Michał Kopeć
d3ce827f96 plugins/flashrom/flashrom.quirk: update NovaCustom GUIDs
Add NS5x GUID and missing NV4x guids for devices running older firmware versions.

Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2022-04-01 12:43:18 +01:00
Sean Rhodes
0ac171c452
plugins/flashrom: Move MaxSize quirk to GUID (#4468)
Move the quirk from HwID to GUID to the apply correctly.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-31 20:38:38 +01:00
Sean Rhodes
d8b6f5f0b3
plugin/flashrom: Change the default format from triplet to pair (#4395)
Flashrom is primarily used with coreboot, which has a pair version number
currently 4.16. As such, chance the default to pair so that fewer quirks
are required.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-17 07:58:25 +00:00
Sean Rhodes
57862d844e
plugin/flashrom: Add GUIDs for StarLite's (#4392)
* HwId for StarLite Mk IV
* coreboot GUID for StarLite Mk IV
* HwId for StarLite Mk II (under coreboot)
* coreboot GUID for StarLite Mk II

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-16 10:18:20 +00:00
Richard Hughes
8b62bf6b64 Set the context in the right place more often 2022-03-16 09:18:29 +00:00
Richard Hughes
6fdae41ae0 flashrom: Simplify the plugin to remove the indirection
For a while we flirted with the idea of updating non-internal
libflashrom-derived devices but the impedance mismatch was just too
great.

We removed the extra unused subclasses of FuFlashromDevice, but never
removed the indirection we added for the writing.
Remove the unused code now that we agree on the longer term plan.
2022-03-09 08:13:13 +00:00
Sean Rhodes
f98acc89b3
plugin/flashrom: Add MaxSize quirk for Lite II and III (#4362)
Add FirmwareSizeMax = 0x800000 for StarLite Mk II and Mk III to allow
switching from AMI to coreboot firmware.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-07 14:26:36 +00:00
Mario Limonciello
661990ed98 Convert build system to use meson tristate features
tristate features will automatically disable if dependencies marked
as required are missing.

Packagers can manually override using `auto_features`.

Link: https://mesonbuild.com/Build-options.html#features
2022-02-28 08:34:48 -06:00
Richard Hughes
f3a13f89dd Allow specifing the DeviceIntegrity flag from metadata 2022-02-22 19:12:06 +00:00
Sean Rhodes
f1f938dfd8 plugins/flashrom: Add Star Lite Mk III coreboot GUID
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-02-15 21:46:48 -06:00
Michał Kopeć
ab06e034c3 plugins/flashrom: add quirk for NovaCustom NV4x
Add a quirk for NovaCustom NV4x devices.
These laptops are running coreboot and are updatable using flashrom.

The HwId GUID matches to both previous Insyde firmware and the current
Dasharo firmware. The Dasharo GUID matches to the devices running
Dasharo firmware. This way the device can be switched from Insyde
to Dasharo using `fwupdmgr switch-branch`.

Homepage: https://configurelaptop.eu/nv40-series/

Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2022-02-01 14:15:45 +00:00
Richard Hughes
ca43733a8c Show why devices are not marked as updatable
At the moment a lot of the failures are only visible when running the
daemon in verbose mode, and the inhibit functionalit provides us a way
to unset FWUPD_DEVICE_FLAG_UPDATABLE from multiple places, as well as
setting the update error for the user to see why.
2022-01-13 12:40:56 +00:00
Sean Rhodes
19c7ee2423 plugins/flashrom: Change StarLabs devices from number to plain
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-12-17 16:44:16 +00:00
Richard Hughes
58d36dcbe5 Check the value range when parsing the quirk keys
At the moment there isn't an error if you enter something like

    CfiDeviceCmdReadId = 0×12
2021-12-09 13:09:43 +00:00
Richard Hughes
e87fc05ab9 Speed up the daemon startup by ~2% by doing dlsym much less
We were calling g_module_symbol() 2703 times, which is actually more
expensive than you'd think.

It also means the plugins are actually what we tell people they are:
A set of vfuncs that get run. The reality before that they were dlsym'd
functions that get called at pretty random times.
2021-11-09 12:02:07 +00:00
Richard Hughes
bc43adf020 Fix build error when sys/io.h is not available 2021-10-06 20:38:43 +01:00
Sean Rhodes
2bd8e80d03
plugins/flashrom: Always shutdown after flashing (#3831)
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-10-05 08:57:20 +01:00
Sean Rhodes
71b52abb66
plugins/flashrom: Reset CMOS aftering writing region (#3814)
Resetting the CMOS before a write when switching branch will cause a lock on\
reboot which requires hard power off.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-10-01 14:32:19 +01:00
Sean Rhodes
49c08f436f
plugins/uefi-capsule: Disable ux-capsule for all StarLabs laptops (#3815)
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-09-30 08:52:02 +01:00