Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just compiled and installed the new 3.0-rc2 kernel from kernel.org on my Fedora 15 system. Everything seems to work fine and I can successfully boot into the system. However, this broke my previously installed NVIDIA driver, so I need to compile a new one. I downloaded the installer from nvidia.com, but I am having trouble with the installation.

To compile the kernel I unzipped the kernel archive to my home directory, then simply reused my Fedora config for the new kernel. Everything resides in ~/linux_build/linux-3.0-rc2.

After booting to runlevel 3 I get an error with the NVIDIA installer:

ERROR: If you are using a Linux 2.4 kernel, please make sure
   you either have configured kernel sources matching your
   kernel or the correct set of kernel headers installed
   on your system.

   If you are using a Linux 2.6 kernel, please make sure
   you have configured kernel sources matching your kernel
   installed on your system. If you specified a separate
   output directory using either the "KBUILD_OUTPUT" or
   the "O" KBUILD parameter, make sure to specify this
   directory with the SYSOUT environment variable or with
   the equivalent nvidia-installer command line option.

   Depending on where and how the kernel sources (or the
   kernel headers) were installed, you may need to specify
   their location with the SYSSRC environment variable or
   the equivalent nvidia-installer command line option.

I ran the installer like this:

bash NVIDIA-Linux-x86_64-270.41.19.run --kernel-source-path=/home/tja/linux_build/linux-3.0-rc2

Usually this was solved by installing the kernel headers from yum, but here I am using a new kernel with no RPM available.

How do I manually install the needed headers/source files for the NVIDIA installer?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Well, I wasn't going crazy. The NVIDIA installer needed to be patched. Kernel version 2.7.0 was hardcoded as the upper bound. That was bumped up to 3.1.0 from a simple patch.

Here is the patch file: nvidia-patch @ fedoraforum.org

--- conftest.sh.orig    2011-05-30 12:24:39.770031044 -0400
+++ conftest.sh 2011-05-30 12:25:49.059315428 -0400
@@ -76,7 +76,7 @@
 }

 build_cflags() {
-    BASE_CFLAGS="-D__KERNEL__ \
+    BASE_CFLAGS="-O2 -D__KERNEL__ \
 -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
 -nostdinc -isystem $ISYSTEM"

--- nv-linux.h.orig 2011-05-30 12:27:09.341819608 -0400
+++ nv-linux.h  2011-05-30 12:27:28.854951411 -0400
@@ -32,7 +32,7 @@
 #  define KERNEL_2_4
 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
 #  error This driver does not support 2.5 kernels!
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
 #  define KERNEL_2_6
 #else
 #  error This driver does not support development kernels!

Then you need to extract the files from the nvidia installer:

./NVIDIA-Linux-x86_64-270.41.19.run -x

Then, inside the 'kernel' directory are the files to be patched:

cd NVIDIA-Linux-x86_64-270.41.19/kernel/
patch -p0 kernel-3.0-rc1.patch.txt

Once that's done, simply supply the kernel sources as a parameter to the installer:

./nvidia-installer --kernel-source-path /home/tja/linux/linux-3.0-rc2

...and it builds fine!

Now I am up running Linux 3 with a proper Nvidia driver.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.