From 7a6b2d1a578752f9f17878d582812171f20b91f2 Mon Sep 17 00:00:00 2001 From: Lukas Voegl Date: Mon, 24 Jun 2024 16:28:42 +0200 Subject: [PATCH] fwupd: add package Signed-off-by: Lukas Voegl --- utils/fwupd/Config.in | 59 +++++++++ utils/fwupd/Makefile | 193 +++++++++++++++++++++++++++++ utils/fwupd/files/etc/init.d/fwupd | 15 +++ utils/fwupd/test.sh | 3 + 4 files changed, 270 insertions(+) create mode 100644 utils/fwupd/Config.in create mode 100644 utils/fwupd/Makefile create mode 100644 utils/fwupd/files/etc/init.d/fwupd create mode 100644 utils/fwupd/test.sh diff --git a/utils/fwupd/Config.in b/utils/fwupd/Config.in new file mode 100644 index 00000000000000..9a12f82bbf9977 --- /dev/null +++ b/utils/fwupd/Config.in @@ -0,0 +1,59 @@ +config FWUPD_FIRMWARE_PACKAGER + bool "firmware packager" + default n + help + Compile fwupd with firmware packager + +config FWUPD_HSI + bool "Host Security ID" + default n + help + Compile fwupd with HSI support + +config FWUPD_LVFS + bool "LVFS remote" + default y + help + Compile and install LVFS remote + +config FWUPD_CBOR + bool "CBOR" + default n + help + Compile fwupd with cbor protocol support + +config FWUPD_LZMA + bool "LZMA" + default n + help + Compile fwupd with LZMA support + +config FWUPD_CURL + bool "curl" + default n + help + Compile fwupd with curl support + +config FWUPD_SQLITE + bool "sqlite" + default n + help + Compile fwupd with sqlite support + +config FWUPD_LIBARCHIVE + bool "libarchive" + default y + help + Compile fwupd with libarchive support + +config FWUPD_PLUGIN_MODEMMANAGER + bool "ModemManager plugin" + default y + help + Compile fwupd with ModemManager plugin + +config FWUPD_PLUGIN_FASTBOOT + bool "fastboot plugin" + default y + help + Compile fwupd with fastboot plugin diff --git a/utils/fwupd/Makefile b/utils/fwupd/Makefile new file mode 100644 index 00000000000000..a3f685312ee260 --- /dev/null +++ b/utils/fwupd/Makefile @@ -0,0 +1,193 @@ +# +# Copyright (C) 2024 TDT AG +# +# This is free software, licensed under the GNU General Public License v2. +# See https://www.gnu.org/licenses/gpl-2.0.txt for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=fwupd +PKG_VERSION:=1.9.24 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://github.com/fwupd/fwupd/releases/download/$(PKG_VERSION) +PKG_HASH:=12f560b35dbed981fde8cf774c6d1f2e658a157d3a63d6c439bf418dbcc44b4c + +PKG_MAINTAINER:=Lukas Voegl +PKG_LICENSE:=LGPL-2.1-or-later +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DEPENDS:= \ + glib2/host \ + python3/host \ + python-packaging/host \ + python-jinja2/host +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include $(INCLUDE_DIR)/meson.mk +include ../../lang/python/python3-host.mk + +define Package/fwupd + SECTION:=utils + CATEGORY:=Utilities + TITLE:=fwupd + URL:=https://fwupd.org + DEPENDS:= \ + $(INTL_DEPENDS) \ + +glib2 \ + +dbus \ + +libxmlb \ + +libjcat \ + +libprotobuf-c \ + +FWUPD_LIBARCHIVE:libarchive \ + +FWUPD_CBOR:libcbor \ + +FWUPD_LZMA:liblzma \ + +FWUPD_CURL:libcurl \ + +FWUPD_SQLITE:libsqlite3 \ + +FWUPD_PLUGIN_FASTBOOT:libgusb \ + +FWUPD_PLUGIN_MODEMMANAGER:modemmanager \ + +FWUPD_PLUGIN_MODEMMANAGER:libqmi \ + +FWUPD_PLUGIN_MODEMMANAGER:libmbim \ + +FWUPD_PLUGIN_MODEMMANAGER:libgudev +endef + +define Package/fwupd/description + A simple system daemon to allow session software to easily update firmware on + your local machine. +endef + +define Package/fwupd/config + source "$(SOURCE)/Config.in" +endef + +MESON_ARGS += \ + -Db_lto=true \ + -Dbuild=all \ + -Dpython=$(HOST_PYTHON3_BIN) \ + -Dudevdir=/lib/udev \ + -Dsupported_build=enabled \ + -Dstatic_analysis=false \ + -Dtests=false \ + -Dmetainfo=false \ + -Dbash_completion=false \ + -Dfish_completion=false \ + -Dman=false \ + -Dthinklmi_compat=false \ + -Dconsolekit=disabled \ + -Ddocs=disabled \ + -Dintrospection=disabled \ + -Dbluez=disabled \ + -Dpolkit=disabled \ + -Dgnutls=disabled \ + -Dpassim=disabled \ + -Dplugin_acpi_phat=disabled \ + -Dplugin_amdgpu=disabled \ + -Dplugin_android_boot=disabled \ + -Dplugin_bcm57xx=disabled \ + -Dplugin_cfu=disabled \ + -Dplugin_cpu=disabled \ + -Dplugin_emmc=disabled \ + -Dplugin_ep963x=disabled \ + -Dplugin_gpio=disabled \ + -Dplugin_igsc=disabled \ + -Dplugin_kinetic_dp=disabled \ + -Dplugin_logitech_bulkcontroller=disabled \ + -Dplugin_logitech_scribe=disabled \ + -Dplugin_logitech_tap=disabled \ + -Dplugin_parade_lspcon=disabled \ + -Dplugin_pixart_rf=disabled \ + -Dplugin_realtek_mst=disabled \ + -Dplugin_synaptics_mst=disabled \ + -Dplugin_mediatek_scaler=disabled \ + -Dplugin_synaptics_rmi=disabled \ + -Dplugin_scsi=disabled \ + -Dplugin_tpm=disabled \ + -Dplugin_redfish=disabled \ + -Dplugin_uefi_capsule=disabled \ + -Dplugin_uefi_pk=disabled \ + -Dplugin_nitrokey=disabled \ + -Dplugin_nvme=disabled \ + -Dplugin_msr=disabled \ + -Dplugin_mtd=disabled \ + -Dplugin_flashrom=disabled \ + -Dplugin_intel_me=disabled \ + -Dplugin_uf2=disabled \ + -Dplugin_upower=disabled \ + -Dplugin_powerd=disabled \ + -Dsystemd=disabled \ + -Dlaunchd=disabled \ + -Delogind=disabled \ + -Dfirmware-packager=$(if $(CONFIG_FWUPD_FIRMWARE_PACKAGER),true,false) \ + -Dhsi=$(if $(CONFIG_FWUPD_HSI),enabled,disabled) \ + -Dlvfs=$(if $(CONFIG_FWUPD_LVFS),true,false) \ + -Dcbor=$(if $(CONFIG_FWUPD_CBOR),enabled,disabled) \ + -Dlzma=$(if $(CONFIG_FWUPD_LZMA),enabled,disabled) \ + -Dcurl=$(if $(CONFIG_FWUPD_CURL),enabled,disabled) \ + -Dsqlite=$(if $(CONFIG_FWUPD_SQLITE),enabled,disabled) \ + -Dlibarchive=$(if $(CONFIG_FWUPD_LIBARCHIVE),enabled,disabled) \ + -Dgudev=$(if $(CONFIG_FWUPD_PLUGIN_MODEMMANAGER),enabled,disabled) \ + -Dplugin_modem_manager=$(if $(CONFIG_FWUPD_PLUGIN_MODEMMANAGER),enabled,disabled) \ + -Dplugin_fastboot=$(if $(CONFIG_FWUPD_PLUGIN_FASTBOOT),enabled,disabled) + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/fwupd-1 + $(CP) $(PKG_INSTALL_DIR)/usr/include/fwupd-1/fwupd.h $(1)/usr/include/fwupd-1 + + $(INSTALL_DIR) $(1)/usr/include/fwupd-1/libfwupd + $(CP) $(PKG_INSTALL_DIR)/usr/include/fwupd-1/libfwupd/*.h $(1)/usr/include/fwupd-1/libfwupd + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfwupd.so* $(1)/usr/lib + + $(INSTALL_DIR) $(1)/usr/lib/fwupd-$(PKG_VERSION) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/fwupd-$(PKG_VERSION)/*.so* $(1)/usr/lib/fwupd-$(PKG_VERSION) + + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fwupd.pc $(1)/usr/lib/pkgconfig + + $(INSTALL_DIR) $(1)/usr/share/dbus-1/interfaces + $(CP) $(PKG_BUPKG_INSTALL_DIRILD_DIR)/usr/share/dbus-1/interfaces/*.xml $(1)/usr/share/dbus-1/interfaces +endef + +define Package/fwupd/install + $(INSTALL_DIR) $(1)/etc/fwupd + $(CP) $(PKG_INSTALL_DIR)/etc/fwupd/fwupd.conf $(1)/etc/fwupd + + $(INSTALL_DIR) $(1)/etc/fwupd/remotes.d + $(CP) $(PKG_INSTALL_DIR)/etc/fwupd/remotes.d/*.conf $(1)/etc/fwupd/remotes.d + + $(INSTALL_DIR) $(1)/etc/pki + $(CP) $(PKG_INSTALL_DIR)/etc/pki/fwupd $(1)/etc/pki + $(CP) $(PKG_INSTALL_DIR)/etc/pki/fwupd-metadata $(1)/etc/pki + + $(INSTALL_DIR) $(1)/lib/udev/rules.d + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/udev/rules.d/*.rules $(1)/lib/udev/rules.d + + $(INSTALL_DIR) $(1)/usr/share/dbus-1/system.d + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/system.d/org.freedesktop.fwupd.conf $(1)/usr/share/dbus-1/system.d + + $(INSTALL_DIR) $(1)/usr/share/fwupd + $(CP) $(PKG_INSTALL_DIR)/usr/share/fwupd/quirks.d $(1)/usr/share/fwupd + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fwupdmgr $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fwupdtool $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfwupd.so* $(1)/usr/lib + + $(INSTALL_DIR) $(1)/usr/lib/fwupd-$(PKG_VERSION) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/fwupd-$(PKG_VERSION)/*.so* $(1)/usr/lib/fwupd-$(PKG_VERSION) + + $(INSTALL_DIR) $(1)/usr/libexec/fwupd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/fwupd/fwupd $(1)/usr/libexec/fwupd + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/etc/init.d/fwupd $(1)/etc/init.d/fwupd +endef + +$(eval $(call BuildPackage,fwupd)) diff --git a/utils/fwupd/files/etc/init.d/fwupd b/utils/fwupd/files/etc/init.d/fwupd new file mode 100644 index 00000000000000..e48458baf2e0e0 --- /dev/null +++ b/utils/fwupd/files/etc/init.d/fwupd @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common + +USE_PROCD=1 +START=80 +VERBOSE=0 + +start_service() { + procd_open_instance + procd_set_param command /usr/libexec/fwupd/fwupd + [ "$VERBOSE" = 1 ] && procd_append_param command --verbose + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}" + procd_close_instance +} diff --git a/utils/fwupd/test.sh b/utils/fwupd/test.sh new file mode 100644 index 00000000000000..c8c91c8cb81c0e --- /dev/null +++ b/utils/fwupd/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +fwupdtool --version 2>&1 | grep "runtime\s*org.freedesktop.fwupd\s*$2"