I use a custom linux kernel and use the --add-this-kernel option of the installer to create an installer that includes the kernel module for this particular kernel.
Everything works fine when I build the custom installer on a machine that runs the same kernel as the destination machine:
bash NVIDIA-Linux-x86_64-331.20.run -s --add-this-kernel --kernel-source-path=/path/to/kernel/source/tree
If I want to add a kernel that is not currently running, the README file in the installer package suggests how to do it:
This will unpack ‘NVIDIA-Linux-x86_64-331.67.run’, compile a kernel
interface layer for the currently running kernel (use the --kernel-source-path
and --kernel-output-path options to specify a target kernel other than the
currently running one), and create a new installer package with the kernel
interface layer added.
If I don’t use a separate output directory for the kernel build, the kernel output path coincides with the kernel source path, and the NVIDIA installer knows this (help for --kernel-output-path says: When not specified, the installer will assume that no separate output directory was used).
So, the above execution line for the NVIDIA installer should also work if the kernel is not running. As a matter of fact, it’s not – the error message when I try to install the *-custom.run package on a machine running the kernel given by --kernel-source-path is the usual
[i]ERROR: Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the ‘kernel-source’ or ‘kernel-devel’ RPM installed. If you know the correct kernel source files are installed, you may specify the kernel source path with the ‘–kernel-source-path’ command line option.
ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.[/i]
When I extract the -custom.run installer created by above command using -x, the file ./kernel/precompiled/nvidia-precompiled-331.20. contains the name of the running kernel (instead of the kernel I specified using --kernel-source-path) in the first 100 (or so) characters.
I create a custom installer using --add-this-kernel and --kernel-source-path
If the kernel sources are for a different kernel than the running kernel, I can’t install the package on a machine running the kernel given by the kernel sources.