unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* [HELP] Packaging open source NVIDIA kernel driver
@ 2022-05-12  7:51 phodina via
  0 siblings, 0 replies; only message in thread
From: phodina via @ 2022-05-12  7:51 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

Hi,

NVIDIA has released open source kernel driver though the firmware for the GPU is still closed source. [1]

I'm currently trying to package it but there are 2 issues I ran into.

First if I don't override the build phase it fails to find the utils.mk file as it does not run the make command from the root of the repo.

That links to second issue where the linux kernel version of the driver fails:

make -C kernel-open modules
make[1]: Entering directory '/tmp/guix-build-nvidia-gpu-linux-module-515.43.04.drv-0/source/kernel-open'
make[2]: Entering directory '/gnu/store/gcwhb3632xh588ihsddi2ss3y3v45zlz-nvidia-gpu-linux-module-515.43.04/lib/modules/5.17.5/build'make[2]: *** No rule to make target 'modules'. Stop.

Any ideas how to fix this?

[1] https://www.phoronix.com/scan.php?page=article&item=nvidia-open-kernel&num=1

----
Petr

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-nvidia-gpu-linux-module.patch --]
[-- Type: text/x-patch; name=0001-gnu-Add-nvidia-gpu-linux-module.patch, Size: 2973 bytes --]

From d800feb8a3d9ba1663b99ccfb2de1d620ce23f8b Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Thu, 12 May 2022 09:45:35 +0200
Subject: [PATCH] gnu: Add nvidia-gpu-linux-module.

* gnu/packages/linux.scm (nvidia-gpu-linux-module): New variable.

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9bb2314ebd..ebeb59dcea 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1345,6 +1345,56 @@ (define-public librem-ec-acpi-linux-module
 and the notification, WiFi, and Bluetooth LED.")
     (license license:gpl2)))
 
+(define-public nvidia-gpu-linux-module
+  (package
+    (name "nvidia-gpu-linux-module")
+    (version "515.43.04")
+    (home-page "https://github.com/NVIDIA/open-gpu-kernel-modules")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url home-page)
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1byk8rah79h0diwvdx4nggc71f7y6fhjadjavpc3kqlrspjjpc6m"))))
+    (build-system linux-module-build-system)
+    (arguments
+     (list #:tests?
+           #f ;no tests
+           #:make-flags
+           #~(list (string-append "CC="
+                                  #$(cc-for-target)))
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'fix-modules-prefix
+                 (lambda* _
+                   (substitute* "kernel-open/Makefile"
+                     (("\\$\\(shell uname -r\\)") #$(package-version
+                                                     linux-libre))
+                     (("/lib/modules/") (string-append #$output
+                                                       "/lib/modules/")))))
+               (replace 'build
+                 (lambda* (#:key (make-flags '())
+                           (parallel-build? #t) #:allow-other-keys)
+                   (mkdir-p "build")
+                   (mkdir-p (string-append #$output "/lib/modules/"
+                                           #$(package-version linux-libre)
+                                           "/build"))
+                   (apply invoke "make"
+                          (string-append "-C"
+                                         (getenv "PWD") "/source")
+                          `(,@(if parallel-build?
+                                  `("-j" ,(number->string (parallel-job-count)))
+                                  '()) ,@make-flags)))))))
+    (native-inputs (list inetutils)) ;hostname
+    (synopsis "Linux kernel module for NVIDIA GPU")
+    (description
+     "This package provides Linux kernel module for NVIDIA GPUs based on Turing
+and newer models.")
+    (license (list license:gpl2+ license:expat))))
+
 (define-public rtl8821ce-linux-module
   (let ((commit "dce62b9bbb7c76339b514153fcebb3a19bafdcc7")
         (revision "5"))
-- 
2.34.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-12  7:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  7:51 [HELP] Packaging open source NVIDIA kernel driver phodina via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).