175.1. fwupd-2.1.7
Daemon and client for updating device firmware
| Version | 2.1.7, release 2 |
| Shelf | boot — Everything before userspace: the kernel, microcode, firmware for the host, bootloader and EFI tooling |
| Phase | 42_graphics (Graphics Stack), 63 of 189 in build order |
| Licence | LGPL-2.1-or-later |
| Homepage | https://fwupd.org |
| Build time | 1.5 SBU |
| Installed size | 9.6 MiB in 103 files |
| Recipe | ports/core/boot/fwupd/kpkgbuild |
About
fwupd is the daemon and the fwupdmgr client that update device firmware from the LVFS, the Linux Vendor Firmware Service: SSDs, docks, USB peripherals, and system firmware shipped as a UEFI capsule. On KDOS the system bus starts the daemon on first use; nothing supervises it. How a person uses it, and where the capsule goes on the ESP, is in Thunderbolt, phones, smart cards and firmware updates.
Why it is in KDOS
The comment above fwupd and fwupd-snapshot in script/phases/42_graphics/packages.d/boot.txt:
Firmware updates: UEFI, SSDs, docks, peripherals. fwupd-efi is the capsule loader the UEFI plugin boots into, and gnu-efi is what it is linked against.
Sources
fwupd-2.1.7.tar.xz(4.8 MiB)
sha256472e9426f7a1b18fa9d199666c15482d4ee51ea35e916ca53bb3ca25919edb10
upstream: https://github.com/fwupd/fwupd/releases/download/2.1.7/fwupd-2.1.7.tar.xz
archive copy: sources-1/boot--fwupd-2.1.7.tar.xz
Dependencies
Depends on: meson, ninja, pkgconf, python3, python3-jinja2, gettext, glib, libxmlb, libusb, sqlite, curl, zlib, xz, gnutls, polkit, dbus, util-linux, libdrm, libmnl, readline, bash-completion, tpm2-tss, hwdata, modemmanager, libqmi, libmbim, fwupd-efi, elogind.
Required by (3): discover, fwupd-snapshot, kinfocenter.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-Dopenssl=disabled, line 32: openssl
Patches
build.sh applies these; kpkg applies nothing by itself.
esp-mount-path.patch— Lets the daemon find the EFI system partition without udisks. Upstream first asks udisks for ESP and then for BDP partitions; when that gives no FAT ESP and no internal FAT BDP, whether because udisks is not running or because it knows of none, the patch readsEspLocationfromfwupd.confand, if set, describes the filesystem mounted there itself, before upstream’s last udisks call, the block-device check that turns “nothing found” into an error: it must be a mount point (its device differs from its parent’s), a FAT filesystem, and on a partition; the partition number, start and size are read from/sys/dev/block/<major>:<minor>, the device node from itsuevent, and the partition UUID and type from the udev database under/run/udev/data. A partition the udev database does not describe still gives a volume with no UUID, usable for capsule-on-disk and not for a boot entry. The patch addsfu_volume_new_esp_from_mount_path()and, when there is no udisks proxy, makes the volume’s size, offset and number return the probed values and its block size come from the probed device node.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install fwupd'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/boot/fwupd.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/boot/fwupd
echo '472e9426f7a1b18fa9d199666c15482d4ee51ea35e916ca53bb3ca25919edb10 fwupd-2.1.7.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/fwupd
SRC=$SRC_ROOT/fwupd-2.1.7
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf fwupd-2.1.7.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/esp-mount-path.patch"
meson setup build --prefix=/usr --sysconfdir=/etc --libdir=lib --localstatedir=/var \
--buildtype=release \
--wrap-mode=nodownload \
-Dtests=false \
-Ddocs=disabled \
-Dman=true \
-Dintrospection=disabled \
-Dsystemd=disabled \
-Dlogind=enabled \
-Defi_binary=true \
-Defi_os_dir=kdos \
-Dplugin_uefi_capsule_splash=false \
-Dplugin_modem_manager=enabled \
-Dpassim=disabled \
-Dp2p_policy=none \
-Dumockdev_tests=disabled \
-Dvalgrind=disabled \
-Dgnutls=enabled \
-Dopenssl=disabled \
-Dpolkit=enabled \
-Dblkid=enabled \
-Dlibdrm=enabled \
-Dlibmnl=enabled \
-Dreadline=enabled \
-Dbluez=enabled \
-Dhsi=enabled \
-Dbash_completion=true \
-Dfish_completion=false \
-Dsupported_build=enabled \
-Dlvfs=disabled \
-Dvendor_ids_dir=/usr/share/hwdata
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
rm -rf "$PKG/etc/grub.d"
cat > "$PKG/etc/fwupd/fwupd.conf" <<'EOF'
[fwupd]
# use `man 5 fwupd.conf` for documentation
EspLocation=/boot/efi
EOF
chmod 640 "$PKG/etc/fwupd/fwupd.conf"
The switches, and why each is set:
--wrap-mode=nodownload— The tree’s usual meson switch, with a reason specific to this source: the tarball ships git wraps for libxmlb, fwupd-efi, Passim and gi-docgen undersubprojects/, and thexmlbandfwupd-efidependencies name theirs as fallbacks, so a build root without libxmlb or fwupd-efi would make meson clone and build a private copy. With the switch a missing one is a configure error, and fwupd links the libxmlb the rest of the image links.-Dsystemd=disabled— Build without systemd’s unit files and libsystemd (No systemd).-Dlogind=enabled— Build thelogindplugin, which meson finds throughsystemdor, here, elogind’slibelogind, and which speaks toorg.freedesktop.login1over D-Bus. While a device is being flashed the daemon holds a shutdown and sleep inhibitor, so a power-off or suspend requested in the middle of an update waits for it, andfwupdmgrcan reboot or power off the machine itself when an update needs it. Without it, a shutdown cuts a flash short andfwupdmgranswers “No way to perform the operation”.-Dintrospection=disabled— Generate no GObject Introspection data forlibfwupd, so no language binding can load it through GI. Turning it on needs gobject-introspection and glib-introspection independs: the typelib is generated against glib’s own GIRs.-Dman=true— Build the manual pages,fwupdmgr(1),fwupd.conf(5)and the rest. It is upstream’s default; the line states it beside-Ddocs=disabled, which turns off only the developer documentation.-Defi_binary=true— Make the UEFI capsule plugin require thefwupd-efidependency at configure time; with--wrap-mode=nodownloadits wrap cannot stand in, so a build root without it stops the configure. fwupd-efi is independs: it installs the loader,fwupdx64.efi, under/usr/libexec/fwupd/efi, which the machine boots once to hand a capsule to the firmware, and where the daemon looks for it at run time.-Defi_os_dir=kdos— Compile in the name of the OS directory on the ESP, so the plugin writes capsules and the loader underEFI/kdos/, the directory that already holds KDOS’s boot state and slot kernels. Without it the plugin probesEFI/systemd, thenEFI/<ID>andEFI/<ID_LIKE>from/etc/os-release, and createsEFI/<ID>when none exists.-Dplugin_uefi_capsule_splash=false— Build without the “Installing firmware update…” splash images the capsule loader can show. Making them runsmake-images.py, which needs thegiPython module with the Pango, PangoCairo and cairo typelibs, and thecairoPython module;po/test-depschecks for them at configure time and stops the configure when one is missing. python3-gobject is not independs.-Dplugin_modem_manager=enabled— Build the plugin that updates the firmware of mobile broadband modems through ModemManager. modemmanager, libqmi and libmbim are independs.-Dpassim=disabled,-Dp2p_policy=none— Build without Passim, a local caching service that shares downloaded metadata and firmware with other machines on the network, and compile in a defaultP2pPolicythat publishes nothing. The tree carries no Passim.-Dumockdev_tests=disabled,-Dvalgrind=disabled— Build no tests that run under umockdev or valgrind; with-Dtests=falseno test is built at all.-Dgnutls=enabled,-Dopenssl=disabled— Verify signatures and checksums with GnuTLS, and only with it. fwupd probes GnuTLS first and falls back to OpenSSL’s libcrypto when GnuTLS is not found; the embedded jcat verifier uses whichever it finds, so OpenSSL would be a second crypto library nothing calls.-Dpolkit=enabled— Ask polkit before a client may install firmware or change the daemon’s settings. polkit is independs; how KDOS answers polkit is in the security model.-Dblkid=enabled,-Dlibdrm=enabled,-Dlibmnl=enabled,-Dreadline=enabled— Require libblkid (block device probing), libdrm (display and GPU devices, and thelibdrm_amdgpudevice information), libmnl (the netlink library thedevlinkplugin is built on, for network adapters’ firmware) and readline (line editing at the prompts offwupdmgrandfwupdtool). Each is a port independs;enabledturns a missing one into a configure error instead of a plugin silently left out.-Dbluez=enabled— Build the plugins for Bluetooth devices. fwupd reaches BlueZ over D-Bus; the switch only compiles the support in, and no BlueZ library is linked.-Dhsi=enabled— Build Host Security ID support,fwupdmgr security, which grades the platform’s firmware protections. meson allows it only on Linux on x86.-Dbash_completion=true,-Dfish_completion=false— Install the bash completion, which bash-completion loads, and not the fish one.-Dsupported_build=enabled— Build as a supported distribution package, which meson’sautochooses only in a git checkout at a release tag; from a release tarball it builds unsupported. The client then prints no “This package has not been validated, it may not work properly.” warning, which Info Center’s Firmware Security page would otherwise show in red above every report, and reports sent to the LVFS carryFwupdSupported=true. The install rules are stricter: a release for a device matched by a generic GUID is refused unless it carries a CHID, child, parent or sibling requirement, and--ignore-requirementsdoes not override that; a release with no version is refused on every device but an emulated one. Theci.quirkfiles of themtdandfastbootplugins, quirks for upstream’s test hardware (themtdramtest device and a Pixel 3a), are not installed. Most developer warnings, an HSI attribute with an unknown result among them, become debug messages; an invalid device version is a warning instead of a critical; and a plugin or command that fails without setting an error is reported as one.-Dlvfs=disabled— Install the LVFS remote,/etc/fwupd/remotes.d/lvfs.conf, switched off. Discover’s firmware backend refreshes every enabled download remote each time Discover starts and after every transaction, so an enabled LVFS remote is a download at every start of the software centre. Firmware is listed instead from thekdos-snapshotlocal remote, the LVFS metadata a release carries (fwupd-snapshot);fwupdmgr enable-remote lvfsturns live metadata on, after which Discover refreshes it at each start andfwupdmgr refreshfetches it by hand.-Dvendor_ids_dir=/usr/share/hwdata— Where fwupd readsusb.ids,pci.idsandpnp.idsto name vendors. hwdata installs them there. Left empty, meson probes a list of fixed paths at configure time forusb.idsand stops with “could not auto-detect -Dvendor_ids_dir=” when none holds one.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/fwupd, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf fwupd-2.1.7-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/fwupd, and runs the triggers its paths call for.
Contents
Installed programs: dbxtool, fwupdmgr, fwupdtool.
Installed libraries: libfwupd.so.
Installed directories: /etc/fwupd, /etc/pki, /usr/include/fwupd-3, /usr/lib/fwupd-2.1.7, /usr/share/fwupd/__pycache__, /usr/share/fwupd/metainfo, /usr/share/fwupd/quirks.d, /usr/share/fwupd/remotes.d/vendor, /usr/share/licenses/fwupd.
Short descriptions
dbxtool |
modify the dbx revocation list |
fwupdmgr |
firmware update manager client utility |
fwupdtool |
standalone firmware update utility |
fwupd.pc |
fwupd is a system daemon for installing device firmware |
Notes
EspLocationand the patch go together.build.shwrites/etc/fwupd/fwupd.confwithEspLocation=/boot/efi, the mount point the installer’sfstabgives the ESP, and the patch is what reads it when udisks reports no ESP. udisks2 is installed later, in43_toolkits, for gvfs; withEspLocationset and mounted, fwupd does not need it. The live image mounts no ESP, and the patch refuses a path that is not a FAT mount point, so there fwupd reports no ESP rather than a wrong one. The file keeps mode0640, the mode upstream installs it with, becausefwupd.confmay hold a remote’s credentials.- Who may update. The daemon is started as root by
dbus-daemon-launch-helperon the first client call and exits when idle; there is no init script. polkit answers each request from the caller’s elogind session: fwupd’s own rule, installed under/usr/share/polkit-1/rules.d, letswheeldo everything, and/etc/polkit-1/rules.d/50-kdos.rules, read first, holdsorg.freedesktop.fwupd.update-internal, the system firmware flash, at an administrator’s password even for the person at the machine. Plasma’s polkit agent asks for it in Discover and infwupdmgralike. - No timer refreshes the metadata. Upstream’s
fwupd-refresh.timeris a systemd unit and is not installed, and KDOS ships no timer in its place, because nothing the system ships reaches the network on its own.fwupdmgr get-updatesand Discover answer from thekdos-snapshotlocal remote, the signed LVFS metadata of the release (fwupd-snapshot), installed under/usr/share/fwupd/remotes.d/, so firmware is listed offline and is as fresh as the release. A person who wants firmware published since the release turns on the LVFS remote (fwupdmgr enable-remote lvfs) and runsfwupdmgr refresh. See Offline by construction. - No GRUB snippet. The capsule plugin installs
/etc/grub.d/35_fwupd, a GRUB menu entry for the loader;build.shremoves it, because KDOS boots with Limine and carries no GRUB.