How to patch nvidia drivers?

This was my first attempt at patching an nvidia driver before building. I got the patch here:

http://cvs.rpmfusion.org/viewvc/rpms/nvidia-kmod/devel/nvidia_3.13_kernel.patch?revision=1.2&root=nonfree&view=markup

I tried to apply the patch to the 331.38 and got an error message saying the patch failed at line 3 and the two lines leading up to it were:

|— a/kernel/nv-acpi.c
|+++ b/kernel/nv-acpi.c

These are the very first lines of the patch. Anyone know what is wrong here?

And how did you actually try to apply the patch?

You should do something like this:

sh NVIDIA-Linux-x86-331.38.run --extract-only
cd NVIDIA-Linux-x86-331.38
patch -p1 < /path/to/nvidia-3.13.patch
./nvidia-installer

The instructions I found just said to run the installer with --apply-patch <path to patch> added to the end.

I’ll try your way and see what happens.

I tried the --extract-only method and got this error when I applied the patch:

patch: **** strip count 1 is not a number
Segmentation fault

You typed in the digit 1 I hope, not the letter l or I? (in “patch -p1”)

Ah, wait. Is this really how your patch file looks like?

Then you did something wrong when downloading it.
Hint: Copy and paste won’t work most of the time for patches.

You have to right-click on the Link “Download File” at the top-right corner of that page and choose “Save Link as…” to get the unmangled patch file.

Oops. I use ‘el’ instead of 1. Back to the command line.

It worked! Thanks for the help.

If I have to reinstall this driver again, do I just cd into the new NVIDIA directory and run the installer, or do I have to patch it again?

If you keep that directory, the files in there are already patched, so you don’t have to patch them again.

If you downloaded a new .run file, you would have to patch it again of course.
But maybe the next version would already work with kernel 3.13 without patch, who knows? :wink:

thanks all you guys for following this up… just by reading your thread did I manage to get the 331.38 driver installed on kernel 3.13 :slight_smile: