Fedora 12 下安装 Nvidia 官方驱动

Fedora 12 引入了 Nouveau 的 KMS 支持,系统启动在视觉上平滑很多,不再有闪屏或者黑白字符的出现。遗憾的是 Nouveau 目前不支持 3D 加速,想使用 Compiz 或者玩 3D 游戏的朋友只能求助于 Nvidia 的官方驱动。

目前 Fedora 12 尚处于 Beta 阶段, rpmfusion 里 rpm 格式的 nvidia 驱动尚未就绪,本文介绍以目前 Nvidia 最新的 190.42 驱动在 Fedora 12 Beta 32 位下的安装为例。该版本驱动经过修正,不需要打补丁即可在 Fedora 12 Beta 下使用。

首次安装

1.nvnews 上下载 190.42 版驱动。得到一个以 run 结尾的安装文件,赋予它可执行权限。

chmod +x NVIDIA-Linux-x86-190.42-pkg0.run

2.重新启动,由于显卡驱动的安装无法 X 服务运行时进行,所以需要进入运行级别 3 。在品牌 Logo 出现后按 ESC 键进入 GRUB 界面,在选择内核,按 e 键进行编辑,在 kernel 行未添加 3 这个参数。

比如我的 kernel 行就是从

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet

修改成

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet 3

完成后按 Enter 退出编辑模式,按 b 键引导。

3.在字符终端下登录,进入放置安装文件的目录,使用以下命令启动安装文件。

su -c './NVIDIA-Linux-x86-190.42-pkg0.run'

按照提示一步步进行。

4.编辑 /etc/modprobe.d/blacklist.conf 文件,以阻止 nouveau 模块的加载。

su -c 'vi /etc/modprobe.d/blacklist.conf'

在文件末尾添加

blacklist nouveau

保存退出。

5.编辑 /etc/grub.conf 文件,禁止 nouveau KMS 的使用。

su -c 'vi /etc/grub.conf'

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet

修改成

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0

保存退出。

6.如果看见 Nvidia 的 Logo 表明 Nvidia 运行正常。

至此 Nvidia 官方驱动安装完成。

启用 Plymouth 图形化引导

Nvidia 官方驱动本身是不支持 KMS 的,所以只能在引导时指定使用 MESA 的驱动来达到图形化 Plymouth 的效果。

1.在品牌 Logo 出现后按 ESC 键进入 GRUB 界面,在选择内核,按 e 键进行编辑,在 kernel 行未添加 vga=ask 这个参数。

比如我的 kernel 行就是从

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0

修改成

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 vga=ask

完成后按 Enter 退出编辑模式,按 b 键引导。

2. 此时会屏幕上会提示按 ENTER 查看可选显示模式,敲击 ENTER 进入。

此时会显示一个表格,显示的是代码和分辨率色深的对应值,从中找到适合自己屏幕分辨率和色深的值。比如我的本本分辨率色深是 128080032,在表上查到对应值是 361。此时输入 361,然后敲击 ENTER,就可以看到图形化的 Plymouth 引导界面了。

3.下来需要将这个值做为每次引导的参数。编辑 /etc/grub.conf 文件,添加 vga=?????,将 ?????替换成刚才得到的值。注意刚才得到的值其实是个16进制数,要在前面添加 0x 才行,比如我的 361 此时就变成 0x361。

su -c 'vi /etc/grub.conf'

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0

修改成

kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 vga=0x361

这样,每次都会使用 0x361 对应的分辨率去启用 Plymouth 了。

内核升级后编译内核模块

使用官方驱动的一大缺陷就是每次更新内核时都要重新编译内核模块。简单的讲就是执行上文首次安装的第2和3步,只是在第3步时将运行驱动文件的方式有些差异。

su -c './NVIDIA-Linux-x86-190.42-pkg0.run -K'

在运行时添加 -K 参数代表只编译内核模块,而不再进行驱动程序文件的安装。执行完后,重新启动即可。

Read More:

19 Comments

  1. 1 ruiuan Commented @ 2009-10-24 22:57Reply to this comment

    谢谢黑兄,但这不是我的驱动

  2. 2 32idea Commented @ 2009-10-25 0:05Reply to this comment

    190.42才出来,楼主就用上了,

  3. 3 hantsy Commented @ 2009-10-25 0:10Reply to this comment

    删除 nouveau 不就行了

  4. 4 黑日白月 Commented @ 2009-10-25 0:19Reply to this comment

    @hantsy:

    KMS 也需要禁用才行的~

  5. 5 kidfruit Commented @ 2009-10-25 1:16Reply to this comment

    一直都是下pkg1……不知道和pkg0有什么区别…………

    PS:下载好驱动文件以后不需要重启,我都是直接终端

    telinit 1

    来安装nvidia驱动,装好再

    telinit 3

    回到X

  6. 6 lh Commented @ 2009-10-25 11:48Reply to this comment

    nvidia驱动允许和开源驱动模块共存吗?

  7. 7 黑日白月 Commented @ 2009-10-25 18:01Reply to this comment

    @kidfruit:

    pkg1 包含部分预编译内核模块,pkg0 不含……

    不过我从来都是让它自己编译,所以选择 pkg0 体积要小……

    @lh:

    不允许,所以要禁用 nouveau 模块加载啊~

  8. 8 ebird Commented @ 2009-10-25 19:51Reply to this comment

    那是不是有一部分特性就看不到了???

  9. 9 liangsuilong Commented @ 2009-10-25 23:26Reply to this comment

    囧,此方法对i686有效,对x86_64没效... 貌似官方论坛上提到的办法,都要看RP的,俺RP不好..囧死了

  10. 10 liangsuilong Commented @ 2009-10-26 1:14Reply to this comment

    @黑日白月: 黑兄,刚刚查阅过wiki,nouveau的kms会在F12正式发行的时候会默认被关闭,情况应该跟F11的时候差不多吧,我想未来的一两个发行版都不会默认打开KMS,除非nouveau 3D驱动出来了。

  11. 11 黑日白月 Commented @ 2009-10-26 1:53Reply to this comment

    @liangsuilong:

    貌似根据说明都成功了啊……很多人都是在 x86_64 上成功的, 只要在引导内核时加 nouveau.modeset=0 就没问题……

    http://forums.fedoraforum.org/showthread.php?t=231340

  12. 12 waynef Commented @ 2009-10-26 12:28Reply to this comment

    liangsuilong说的对,我现在用的内核是2.6.31.5-96,nvidia官方驱动直接装就可以了。

  13. 13 liangsuilong Commented @ 2009-10-26 22:41Reply to this comment

    @waynef: 囧,为啥我的直接装不行呢??貌似2.6.31.5-96默认也是开启KMS的哦..

    我的就是打了patch都不行..唉..

  14. 14 hywei Commented @ 2009-10-28 16:21Reply to this comment

    大家好,我安装了190.42驱动后,startx总是有下面的错误:

    Failed to load /usr/lib/xorg/modules/extensions/libglx.so

    折腾了一天,快疯了

  15. 15 mayaguest Commented @ 2009-11-11 17:18Reply to this comment

    装了rc4: Unknown kernel option 'nouveau.modeset=0' ignore.. 结果进不去X了... ...

  16. 16 怀恋在子夜 Commented @ 2009-12-06 11:10Reply to this comment

    黑白兄,kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet nouveau.modeset=0 ask=0x361-------------》应该是vga=0x361吧

  17. 17 黑日白月 Commented @ 2009-12-11 22:42Reply to this comment

    @mayaguest:

    那个参数我每次也出现,只是没什么影响,3D 游戏照玩,更别提 X 了……

    @怀恋在子夜:

    感谢提醒,笔误笔误~

  18. 18 Wenal Commented @ 2009-12-22 21:11Reply to this comment

    Unable to load the kernel module 'nvidia.ko'. This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if a driver such as rivafb/nvidiafb is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA graphics device(s), or NVIDIA GPU installed in this system is not supported by this NVIDIA Linux graphics driver release. 求救高人,实在无解了....我内核是2.6.31.6-166.fc12.i686.PAE kernel是kernel-PAE-devel-2.6.31.6-166.fc12.i686

  19. 19 freepace Commented @ 2009-12-24 23:56Reply to this comment

    可以的,改一下操作顺序:145236