My nvidia module farm

For a number of years, I have been regularly updating kernels for about 80 machines. Among these (mostly Dell-branded machines), some have NVidia graphic cards and I chose to install the NVidia drivers. Since I have to update many machines, I install these drivers through the Debian packaging system.

I had to automate the task. Some will tell me that "there is module-assistant". True enough, but module-assistant does not automatically build for several kernel flavours. Moreover, there is sometimes a need to patch the sources, or even to patch the binaries, like since the mess of kernel 2.6.18-4 (and the paravirt_ops export problems of GPL/non-GPL symbols).

This is the reason why I built by module compilation farm. I have to give three parameters to the script: the kernel version for which I am about to compile, the nvidia source version and the nvidia-legacy source version. I launch my script and end up with modules NVidia and NVidia-legacy compiled for sub-architectures 686, 686-bigmem and k7 (the ones I am interested in).

I recently had to modify my script so that it can deal with bug 419943 (there are other bugs reported directly on nvidia-kernel-source, such as 420585). I corrected also 409204, not a big effort altogether.

Here is the script. First, copy prepare and cmdline-nvidia scripts in a place where they can be executed and install tje packages nvidia-kernel-source, nvidia-kernel-legacy-source and all desired nvidia-kernel-headers (for example linux-headers-2.6.21-1-686 if the 686 kernel flavour is wanted). Invoke first prepare then (after having modified the version numbers in the script) cmdline-nvidia and then again cmdline-nvidia -legacy. After a while, /var/cache/apt/archives contains the freshly baked packages.

If the kernel has to be patched, just use /usr/src/nvidia-patches. Mine is included in this post.

The technique to make the module work with paravirt_ops was inspired to me by this article. This implies to rebuild linux-kbuild while removing the following two lines (about line 1200):

if (!mod->gpl_compatible)
check_for_gpl_usage(exp->export, basename, exp->name);

All my recompiled packages are available on the partial mirror that I manage. Do not hesitate to recompile if you have any doubt!

None
A comma-separated list of terms describing this content. Example: funny, bungee jumping, "Company, Inc.".