Only supports AMD (amdgpu), Intel (i915), and Adreno (msm) GPUs for now.
NVIDIA support would require libnvml.

Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
 rules/nvtop.in   | 34 ++++++++++++++++++++++++++
 rules/nvtop.make | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 rules/nvtop.in
 create mode 100644 rules/nvtop.make

diff --git a/rules/nvtop.in b/rules/nvtop.in
new file mode 100644
index 000000000000..af42874156aa
--- /dev/null
+++ b/rules/nvtop.in
@@ -0,0 +1,34 @@
+## SECTION=shell_and_console
+
+menuconfig NVTOP
+       bool
+       prompt "nvtop"
+       select HOST_CMAKE
+       select NCURSES
+       select LIBDRM           if NVTOP_AMDGPU || NVTOP_MSM
+       select LIBDRM_AMDGPU    if NVTOP_AMDGPU
+       select SYSTEMD          if NVTOP_AMDGPU || NVTOP_INTEL
+       help
+         Interactive GPU process monitor
+
+if NVTOP
+
+config NVTOP_NVIDIA
+       bool
+       # needs libnvml
+       depends on BROKEN
+       prompt "build support for NVIDIA GPUs"
+
+config NVTOP_AMDGPU
+       bool
+       prompt "build support for AMD GPUs using the amdgpu driver"
+
+config NVTOP_INTEL
+       bool
+       prompt "build support for Intel GPUs using the i915 driver"
+
+config NVTOP_MSM
+       bool
+       prompt "build support for Adreno GPUs using the msm driver"
+
+endif
diff --git a/rules/nvtop.make b/rules/nvtop.make
new file mode 100644
index 000000000000..738b7a013032
--- /dev/null
+++ b/rules/nvtop.make
@@ -0,0 +1,62 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2023 by Philipp Zabel <p.za...@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_NVTOP) += nvtop
+
+#
+# Paths and names
+#
+NVTOP_VERSION  := 3.0.2
+NVTOP_MD5      := fdf9bc33c2240ba99cee0d726d267427
+NVTOP          := nvtop-$(NVTOP_VERSION)
+NVTOP_SUFFIX   := tar.gz
+NVTOP_URL      := 
https://github.com/Syllo/nvtop/archive/refs/tags/$(NVTOP_VERSION).$(NVTOP_SUFFIX)
+NVTOP_SOURCE   := $(SRCDIR)/$(NVTOP).$(NVTOP_SUFFIX)
+NVTOP_DIR      := $(BUILDDIR)/$(NVTOP)
+NVTOP_LICENSE  := GPL-3.0-or-later
+NVTOP_LICENSE_FILES := \
+       file://COPYING;md5=d32239bcb673463ab874e80d47fae504
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+#
+# cmake
+#
+NVTOP_CONF_TOOL        := cmake
+NVTOP_CONF_OPT := \
+       $(CROSS_CMAKE_USR) \
+       -DNVIDIA_SUPPORT=$(call ptx/onoff, PTXCONF_NVTOP_NVIDIA) \
+       -DAMDGPU_SUPPORT=$(call ptx/onoff, PTXCONF_NVTOP_AMDGPU) \
+       -DINTEL_SUPPORT=$(call ptx/onoff, PTXCONF_NVTOP_INTEL) \
+       -DMSM_SUPPORT=$(call ptx/onoff, PTXCONF_NVTOP_MSM)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/nvtop.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init, nvtop)
+       @$(call install_fixup, nvtop, PRIORITY, optional)
+       @$(call install_fixup, nvtop, SECTION, base)
+       @$(call install_fixup, nvtop, AUTHOR, "Philipp Zabel 
<p.za...@pengutronix.de>")
+       @$(call install_fixup, nvtop, DESCRIPTION, missing)
+
+       @$(call install_copy, nvtop, 0, 0, 0755, -, /usr/bin/nvtop)
+
+       @$(call install_finish, nvtop)
+
+       @$(call touch)
+
+# vim: syntax=make
-- 
2.39.2


Reply via email to