linux里面编译安装显卡驱动失败求高手帮助

我在Ubuntu里面和SUSE里面编译安装显卡驱动,NVIDIA的,失败了,
提示如下:
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 system, for exzmple ,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.
于是我就尝试使用yum以及apt-get 和dpkg以及rpm来安装相应的包,但是都失败了,
谁遇到过这个问题,希望回复一下,
谢谢,
声明,当这个问题发生的时候,我用的是自己编译的Linux 3.19的32bit的内核,但是apt-get 那个时候最新的是3.18的内核,
当我apt-get install成功之后,我用uname 来查看版本,依然是3.19的版本,
这个应该如何处理,
不知道有多少人遇到这个问题,
据说大部分的人都是编译成功的。
再次对于提供帮助的朋友表示感谢!!!

源码包的位置不正确,你可以在./config 的时候指定内核源码包位置。一般linux将内核源码装在了/usr/src/linux下,如果你所用的内核版本与源码包的版本不一致,则你要更新源码包,并重新生成生成version.h文件:

make include/linux/version.h 
make include/asm
ls -l /lib/modules/3.x.x.x

其中3.x.x.x是你的源码包内核版本号。


然后,你再编译一次驱动,应该就能编译成功了。

追问

话说我编译的时候,我用的是make-kpkg这个方法,
我可以成功的生成kernel-image和kernel-headers但是无法生成modules,这个您知道怎么回事吗?
编译modules的时候是失败的。

追答

编译内核前,在config时, 选m 的驱动模块才会被编译为module

追问

感谢您的帮助,我从来不make config,压根就用make menuconfig,眼下我执行您的第一条代码之后的返回如下:
/linux-3.19# make include/linux/version.h
make: *** No rule to make target 'include/linux/version.h'。 停止。
您看看这个是怎么回事?

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答