diff mbox series

[v1,1/1] package/nvidia-persistenced: new package

Message ID 20220626123604.13263-1-raphael.pavlidis@gmail.com
State Superseded
Headers show
Series [v1,1/1] package/nvidia-persistenced: new package | expand

Commit Message

Raphael Pavlidis June 26, 2022, 12:36 p.m. UTC
NVIDIA driver persistence daemon.

Signed-off-by: Raphael Pavlidis <raphael.pavlidis@gmail.com>
---
 package/Config.in                             |  1 +
 package/nvidia-persistenced/Config.in         | 13 +++++
 .../nvidia-persistenced.conf                  |  1 +
 .../nvidia-persistenced.hash                  |  3 ++
 .../nvidia-persistenced.mk                    | 49 +++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 package/nvidia-persistenced/Config.in
 create mode 100644 package/nvidia-persistenced/nvidia-persistenced.conf
 create mode 100644 package/nvidia-persistenced/nvidia-persistenced.hash
 create mode 100644 package/nvidia-persistenced/nvidia-persistenced.mk
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index f09da05be0..27fd39fd7e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -532,6 +532,7 @@  endmenu
 	source "package/neard/Config.in"
 	source "package/nvidia-driver/Config.in"
 	source "package/nvidia-modprobe/Config.in"
+	source "package/nvidia-persistenced/Config.in"
 	source "package/nvme/Config.in"
 	source "package/ofono/Config.in"
 	source "package/ola/Config.in"
diff --git a/package/nvidia-persistenced/Config.in b/package/nvidia-persistenced/Config.in
new file mode 100644
index 0000000000..c15f6b4e12
--- /dev/null
+++ b/package/nvidia-persistenced/Config.in
@@ -0,0 +1,13 @@ 
+config BR2_PACKAGE_NVIDIA_PERSISTENCED
+	bool "nvidia-modprobe"
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libtirpc
+	select BR2_PACKAGE_LIBTIRPC
+	help
+	  NVIDIA driver persistence daemon.
+
+	  https://github.com/NVIDIA/nvidia-persistenced
+
+comment "nvidia-persistenced needs a toolchain w/ threads"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/nvidia-persistenced/nvidia-persistenced.conf b/package/nvidia-persistenced/nvidia-persistenced.conf
new file mode 100644
index 0000000000..48f24cfb1d
--- /dev/null
+++ b/package/nvidia-persistenced/nvidia-persistenced.conf
@@ -0,0 +1 @@ 
+u nvidia-persistenced - 'NVIDIA Persistence Daemon'
diff --git a/package/nvidia-persistenced/nvidia-persistenced.hash b/package/nvidia-persistenced/nvidia-persistenced.hash
new file mode 100644
index 0000000000..06c71b35f5
--- /dev/null
+++ b/package/nvidia-persistenced/nvidia-persistenced.hash
@@ -0,0 +1,3 @@ 
+# Locally computed:
+sha256  b84fb8eb86127a725d0134a2c64a64e7844e125dece137e7fe8adf8a33cbe817  nvidia-persistenced-515.48.07.tar.gz
+sha256  279d814320adc07ca5a4ee101a0b428ddf22a6f3513b8c051f9eb7be47b2e797  COPYING
diff --git a/package/nvidia-persistenced/nvidia-persistenced.mk b/package/nvidia-persistenced/nvidia-persistenced.mk
new file mode 100644
index 0000000000..2a34d3608d
--- /dev/null
+++ b/package/nvidia-persistenced/nvidia-persistenced.mk
@@ -0,0 +1,49 @@ 
+################################################################################
+#
+# nvidia-persistenced
+#
+################################################################################
+
+NVIDIA_PERSISTENCED_VERSION = 515.48.07
+NVIDIA_PERSISTENCED_SITE = $(call github,NVIDIA,nvidia-persistenced,$(NVIDIA_PERSISTENCED_VERSION))
+NVIDIA_PERSISTENCED_LICENSE = MIT
+NVIDIA_PERSISTENCED_LICENSE_FILES = COPYING
+
+NVIDIA_PERSISTENCED_DEPENDENCIES = host-pkgconf libtirpc
+
+define NVIDIA_PERSISTENCED_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
+		OUTPUTDIR=. ./nvidia-persistenced
+endef
+
+define NVIDIA_PERSISTENCED_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/nvidia-persistenced \
+		$(TARGET_DIR)/usr/bin/nvidia-persistenced
+endef
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+ifeq ($(BR2_PACKAGE_SYSTEMD_SYSUSERS),y)
+define NVIDIA_PERSISTENCED_POST_INSTALL_TARGET_SYSTEMD_SYSUSERS
+	$(INSTALL) -D -m 0644 $(NVIDIA_PERSISTENCED_PKGDIR)/nvidia-persistenced.conf \
+		$(TARGET_DIR)/usr/lib/sysusers.d/nvidia-persistenced.conf
+endef
+NVIDIA_PERSISTENCED_POST_INSTALL_TARGET_HOOKS += NVIDIA_PERSISTENCED_POST_INSTALL_TARGET_SYSTEMD_SYSUSERS
+else
+NVIDIA_PERSISTENCED_SYSTEMD_USERS = \
+	nvidia-persistenced -1 nvidia-persistenced -1 * - - - NVIDIA Persistence Daemon
+endif
+
+define NVIDIA_PERSISTENCED_POST_INSTALL_TARGET_SYSTEMD_SERVICE
+	$(INSTALL) -D -m 0644 $(@D)/init/systemd/nvidia-persistenced.service.template \
+		$(TARGET_DIR)/usr/lib/systemd/system/nvidia-persistenced.service
+	$(SED) 's/__USER__/nvidia-persistenced/g' \
+		$(TARGET_DIR)/usr/lib/systemd/system/nvidia-persistenced.service
+endef
+NVIDIA_PERSISTENCED_POST_INSTALL_TARGET_HOOKS += NVIDIA_PERSISTENCED_POST_INSTALL_TARGET_SYSTEMD_SERVICE
+endif # BR2_PACKAGE_SYSTEMD
+
+define NVIDIA_PERSISTENCED_USERS
+	$(NVIDIA_PERSISTENCED_SYSTEMD_USERS)
+endef
+
+$(eval $(generic-package))