philmmanjaro / nvidia-340xx-dkms

NVIDIA driver sources for linux, 340xx legacy branch
11 stars 5 forks source link

Package is usable with kernels up to 5.16 (confirmed here). #1

Open DAC324 opened 2 years ago

DAC324 commented 2 years ago

Prerequisite: Patches up to 5.15 from AUR (https://aur.archlinux.org/packages/nvidia-340xx-dkms/). These have to be included in the PKGBUILD the usual way, by amending the source() and bsums() arrays as well as the patch section. The patch for kernel 5.15 from AUR, unfortunately, has DOS instead of Unix line breaks which causes patch to spit out a warning

(Stripping trailing CRs from patch; use --binary to disable.)
patching file kernel/nv-drm.c
patch unexpectedly ends in middle of line

It appears to be merely cosmetically but can be removed by converting the line breaks

echo "$(tr -d '\r' < 0007-kernel-5.15.patch)" > 0007-kernel-5.15.patch

For kernel 5.16, it looks like there is not a lot to be done in addition:

--- a/kernel/nv.h   2022-01-03 17:06:46.101301755 +0100
+++ b/kernel/nv.h   2022-01-03 17:06:57.357726949 +0100
@@ -13,7 +13,7 @@
 #define _NV_H_

 #include <nvtypes.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>

 #if !defined(NV_MIN)
 #define NV_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
--- a/kernel/os-interface.h 2022-01-03 17:04:38.890696020 +0100
+++ b/os-interface.h    2022-01-03 17:04:54.263699866 +0100
@@ -24,7 +24,7 @@
 *                                                                           *
 \***************************************************************************/

-#include <stdarg.h>
+#include <linux/stdarg.h>

 /*
  * Define away Microsoft compiler extensions when possible

Finally, we need the usual ABI check workaround:

Section "ServerFlags"
    Option "IgnoreABI" "true"
EndSection

And that's already all I had to do to get that driver working with kernel 5.16 :)

MeowIce commented 2 years ago

Hi! You can try my patch to see if it works: https://github.com/MeowIce/nvidia-legacy