Being an user of ancient hardware, too, I’d first check what kind of graphics card you have. Perhaps, it is still supported by the 390 driver. For that one, we have the linux515-nvidia-390xx
and nvidia-390xx-utils
packages available in the Manjaro repository.
If you need the 340 driver nevertheless, the best you can do is at first completely following the tutorial for getting that driver for kernel 5.10 at [HowTo] get legacy 340xx NVIDIA drivers back
Once you have verified that you are able to build the driver according to the tutorial, it is time to try to apply the patches from AUR (AUR (en) - nvidia-340xx-dkms).
Then, download all the kernel patches from AUR to your nvidia-340xx-dkms
directory. Also, patch PKGBUILD
there like below:
--- PKGBUILD.manjaro 2019-06-05 13:23:56.000000000 +0200
+++ PKGBUILD 2022-01-03 16:50:18.795748418 +0100
@@ -4,44 +4,97 @@
# Maintainer: Philip Müller <philm@manjaro.org>
# Maintainer: Roland Singer <roland@manjaro.org>
-_linuxprefix=linux50
-_extramodules=extramodules-5.0-MANJARO
+_linuxprefix=linux515
+_extramodules=extramodules-5.15-MANJARO
pkgname=$_linuxprefix-nvidia-340xx
_pkgname=nvidia
-pkgver=340.107
-pkgrel=20
+pkgver=340.108
+pkgrel=28
provides=("$_pkgname=$pkgver")
groups=("$_linuxprefix-extramodules")
pkgdesc="NVIDIA drivers for linux."
arch=('i686' 'x86_64')
url="http://www.nvidia.com/"
-depends=("$_linuxprefix" "nvidia-340xx-utils=${pkgver}")
+depends=(
+ "$_linuxprefix"
+ "nvidia-340xx-utils=${pkgver}"
+ )
makedepends=("$_linuxprefix-headers")
conflicts=('nvidia-96xx' 'nvidia-183xx' "$_linuxprefix-nvidia" "$_linuxprefix-nvidia-304xx")
license=('custom')
install=nvidia.install
options=(!strip !ccache)
-source=('kernel-4.11.patch' 'kernel-5.0.patch')
+source=(
+ 'kernel-4.11.patch'
+ 'kernel-5.0.patch'
+ '0001-kernel-5.7.patch'
+ '0002-kernel-5.8.patch'
+ '0003-kernel-5.9.patch'
+ '0004-kernel-5.10.patch'
+ '0005-kernel-5.11.patch'
+ '0006-kernel-5.14.patch'
+ '0007-kernel-5.15.patch'
+ )
source_i686=("https://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run")
source_x86_64=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run")
-md5sums=('cf31ff666e3789cde5307b6ad50cb9fd'
- '36c93000ffa31a6226579a014b3b810f')
+md5sums=('4b0a323032957a17d42fc821a5ecc451'
+ '4960a2ad45d3b1c9e80f9dc8f416e390'
+ '4be5a196c4a0b095771179e820f5cc88'
+ 'e868ff40e412fae26b6a01929debdf04'
+ '400ad257dcc26c607eb8c8c273693a01'
+ 'e4893414b629caaa0b3a31317ab484f2'
+ '4d1a74da2f65db16066c26c7a9f7b4ab'
+ '17f59396f6989283c1bd75aad57e48fd'
+ 'cada0ea2d9c0336d23308dd64364d5e2'
+ )
md5sums_i686=('9a4b382ef545d836033630224735d5dd')
-md5sums_x86_64=('ffca1879d77dfc491dfb0276ceb56cc1')
+md5sums_x86_64=('e783e383bd4344d590ad429eb0883717')
[[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}"
[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
prepare() {
+ # Remove previous builds
+ [ -d "$_pkg" ] && rm -rf "$_pkg"
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
# patches here
# Fix compile problem with 4.11
- (cd kernel; patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-4.11.patch)
+ echo "Patching for 4.11"
+ #(patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-4.11.patch)
# Fix compile problem with 5.0
- (cd kernel; patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.0.patch)
+ echo "Patching for 5.0"
+ #(patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.0.patch)
+
+ # Fix compile problem with 5.7
+ echo "Patching for 5.7"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0001-kernel-5.7.patch)
+
+ # Fix compile problem with 5.8
+ echo "Patching for 5.8"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0002-kernel-5.8.patch)
+
+ # Fix compile problem with 5.9
+ echo "Patching for 5.9"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0003-kernel-5.9.patch)
+
+ # Fix compile problem with 5.10
+ echo "Patching for 5.10"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0004-kernel-5.10.patch)
+
+ # Fix compile problem with 5.11
+ echo "Patching for 5.11"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0005-kernel-5.11.patch)
+
+ # Fix compile problem with 5.14
+ echo "Patching for 5.14"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0006-kernel-5.14.patch)
+
+ # Fix compile problem with 5.15
+ echo "Patching for 5.15"
+ (patch -p1 --no-backup-if-mismatch -i "$srcdir"/0007-kernel-5.15.patch) # code to be patched is not present
export DISTCC_DISABLE=1
export CCACHE_DISABLE=1
Afterwards, run makepkg
again. At least, I was able to get the driver compiled that way.
UPDATE
As the driver 340.108 also works on my GeForce GTX 560, I have tested it with kernel 5.15 and got it working after the usual ABI workaround for Xorg (create a file /etc/X11/xorg.conf.d/nvidia.conf
with the following contents):
Section "ServerFlags"
Option "IgnoreABI" "true"
EndSection
With the following patch
--- 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
I was also able to compile 340.108 against the kernel 5.16 headers.