How to get legacy nvidia 340.108 in kernel 5.15?

Hi @DAC324. unfortunately I was unlucky I bought it (used) without checking driver support. Nvidia Gforce 9800 GT. I can compile it now, this is already quite an advance, I am very grateful, I decided to use Manjaro in November of last year and I was suffering from the Nouveau.

After compiling/applying pactch I restarted Manjaro I entered the terminal dropped lightdm and install from src/NVIDIA-Linux-x86_64-340.108-no-compat32/nvidia-installer

in the middle of the installation I got a warning:

WARMING: nvidia-installer was forced to guess the X library
path ´/usr/lib´ adn X moodule path ´/usr/lib/xorg/modules´:
these paths were not queryable from the system. If X fails
to find the NVIDIA X driver module, please install the `pkg-config`
utility and the X.Org SDK/development package from your
distribuition and reinstall the driver.

After installing the driver, desktop resolutions are not detected, errors in glxgears.

lspci -k | grep -EA3 'VGA|3D|Display'
01:00.0 VGA compatible controller: NVIDIA Corporation G92 [GeForce 9800 GT] (rev a2)
	Subsystem: NVIDIA Corporation Device 0719
	Kernel driver in use: nvidia
	Kernel modules: nouveau, nvidia
glxgears
Xlib:  extension "GLX" missing on display ":0".
Error: couldn't get an RGB, Double-buffered visual

[UPDATE]

Ok, I understand a lot, but I don’t understand this patch what should I do with it. this is all commented?

[UPDATE TWO]
Right now that I’m writing this update I tried to compile again, and I noticed that path 5.15 is not executed, it appears like an error:

Patching for 5.15
(Stripping trailing CRs from patch; use --binary to disable.)
patching file kernel/nv-drm.c
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 606 with fuzz 1 (offset 77 lines).