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

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!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值