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 Sep 17, 2024
1 parent 14584fc commit e709d84
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/libqmi/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ choice

config LIBQMI_COLLECTION_MINIMAL
depends on !MODEMMANAGER_WITH_QMI
depends on !FWUPD_PLUGIN_MODEMMANAGER
bool "minimal"

config LIBQMI_COLLECTION_BASIC
depends on !FWUPD_PLUGIN_MODEMMANAGER
bool "basic (default)"

config LIBQMI_COLLECTION_FULL
Expand Down
5 changes: 5 additions & 0 deletions libs/libqmi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ PKG_BUILD_FLAGS:=gc-sections
PKG_MAINTAINER:=Nicholas Smith <[email protected]>
PKG_CPE_ID:=cpe:/a:libqmi_project:libqmi

PKG_CONFIG_DEPENDS:= \
CONFIG_LIBQMI_COLLECTION_FULL \
CONFIG_LIBQMI_COLLECTION_BASIC \
CONFIG_LIBQMI_COLLECTION_MINIMAL

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/meson.mk
Expand Down
65 changes: 65 additions & 0 deletions utils/fwupd/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
menu "Select fwupd options"
depends on PACKAGE_fwupd-libs

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_GUDEV
bool "GUdev"
default n
help
Compile fwupd with GUdev support

config FWUPD_PLUGIN_MODEMMANAGER
bool "ModemManager plugin"
default y
select FWUPD_GUDEV
help
Compile fwupd with ModemManager plugin

endmenu
233 changes: 233 additions & 0 deletions utils/fwupd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
#
# 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_CPE_ID:=cpe:/a:fwupd:fwupd

PKG_BUILD_DEPENDS:= \
glib2/host \
python3/host \
python-packaging/host \
python-jinja2/host

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/meson.mk
include ../../lang/python/python3-host.mk

define Package/fwupd/Default
SECTION:=utils
CATEGORY:=Utilities
TITLE:=fwupd
URL:=https://fwupd.org
DEPENDS:= \
+glib2 \
+dbus \
+libxmlb \
+libjcat \
+libprotobuf-c \
+FWUPD_LIBARCHIVE:libarchive \
+FWUPD_CBOR:libcbor \
+FWUPD_LZMA:liblzma \
+FWUPD_CURL:libcurl \
+FWUPD_SQLITE:libsqlite3 \
+FWUPD_GUDEV:libgudev \
+FWUPD_PLUGIN_MODEMMANAGER:modemmanager \
+FWUPD_PLUGIN_MODEMMANAGER:libqmi \
+FWUPD_PLUGIN_MODEMMANAGER:libmbim
endef

define Package/fwupd/Default/description
A simple system daemon to allow session software to easily update firmware on
your local machine.
endef

define Package/fwupd-libs
$(call Package/fwupd/Default)
TITLE:=fwupd-libs
endef

define Package/fwupd-libs/description
$(call Package/fwupd/Default/description)
This package contains the fwupd libraries.
endef

define Package/fwupd-libs/config
source "$(SOURCE)/Config.in"
endef

define Package/fwupd-tools
$(call Package/fwupd/Default)
DEPENDS:=+fwupd-libs
TITLE:=fwupd-tools
endef

define Package/fwupd-tools/description
$(call Package/fwupd/Default/description)
This package contains the fwupd cli tools.
endef

define Package/fwupd-daemon
$(call Package/fwupd/Default)
DEPENDS:=+fwupd-libs
TITLE:=fwupd-daemon
endef

define Package/fwupd-daemon/description
$(call Package/fwupd/Default/description)
This package contains the fwupd daemon.
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 \
-Dplugin_fastboot=disabled \
-Dgusb=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_GUDEV),enabled,disabled) \
-Dplugin_modem_manager=$(if $(CONFIG_FWUPD_PLUGIN_MODEMMANAGER),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_INSTALL_DIR)/usr/share/dbus-1/interfaces/*.xml $(1)/usr/share/dbus-1/interfaces
endef

define Package/fwupd-libs/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

$(if $(CONFIG_FWUPD_GUDEV), \
$(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/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)
endef

define Package/fwupd-tools/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fwupdtool $(1)/usr/bin
endef

define Package/fwupd-daemon/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fwupdmgr $(1)/usr/bin

$(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-libs))
$(eval $(call BuildPackage,fwupd-tools))
$(eval $(call BuildPackage,fwupd-daemon))
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 e709d84

Please sign in to comment.