现在的位置: 首页 > 综合 > 正文

Gentoo Linux下安装NVIDIA显卡驱动(NVIDIA installer can’t find kernel source/build files)

2013年10月23日 ⁄ 综合 ⁄ 共 1592字 ⁄ 字号 评论关闭

Gentoo 11.2默认为3.0.6内核,如果安装官方二进制NVIDIA显卡驱动,提示如下错误

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.

这是由于显卡驱动不支持3.0内核,可以给显卡驱动打补丁来安装,点击下载补丁文件

--- 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!

然后执行

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

将驱动解压至当前目录,然后进入目录打上patch文件

cd NVIDIA-Linux-x86_64-270.41.19/kernel/
patch -p0 < kernel-3.066.patch

然后

cd ..
nvidia-install --kernel-source-path /usr/src/linux

安装成功OK!

抱歉!评论已关闭.