all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: phodina via <help-guix@gnu.org>
To: help-guix <help-guix@gnu.org>
Subject: [HELP] Packaging open source NVIDIA kernel driver
Date: Thu, 12 May 2022 07:51:20 +0000	[thread overview]
Message-ID: <879K-NvrYDvjI4hIcUuwiUZsdFJiWhxSj-hQndtLAVvMN-HtGx5VikQYoxDTYwIS0PN_KajeGU4LQrfR1ZQkTI8xBZ834NbAgF3yGRiGqHk=@protonmail.com> (raw)

[-- 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


                 reply	other threads:[~2022-05-12  7:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='879K-NvrYDvjI4hIcUuwiUZsdFJiWhxSj-hQndtLAVvMN-HtGx5VikQYoxDTYwIS0PN_KajeGU4LQrfR1ZQkTI8xBZ834NbAgF3yGRiGqHk=@protonmail.com' \
    --to=help-guix@gnu.org \
    --cc=phodina@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.