Skip to content

Commit

Permalink
fwupd: add package
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Voegl <[email protected]>
  • Loading branch information
lvoegl committed Aug 23, 2024
1 parent 1223587 commit 7a6b2d1
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 0 deletions.
59 changes: 59 additions & 0 deletions utils/fwupd/Config.in
Original file line number Diff line number Diff line change
@@ -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
193 changes: 193 additions & 0 deletions utils/fwupd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
#
# Copyright (C) 2024 TDT AG <[email protected]>
#
# 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 <[email protected]>
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))
15 changes: 15 additions & 0 deletions utils/fwupd/files/etc/init.d/fwupd
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 3 additions & 0 deletions utils/fwupd/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

fwupdtool --version 2>&1 | grep "runtime\s*org.freedesktop.fwupd\s*$2"

0 comments on commit 7a6b2d1

Please sign in to comment.