Saturday, 23 January 2010

Nouveau driver with KMS support on Hardened

I got annoyed recently with the nv driver and still not being able to use the proprietary nvidia driver I decided to try nouveau driver...and it worked! :) Additional bonus was - KMS - fast switching between X and console...finally!

Ok, here we go. A recent kernel will be needed, I'm using the 2.6.32 hardened sources, but anything >= 2.6.31 should do. xorg-server-1.7 will be required though. So before you try, make sure that you have it up and running and that everything works as it should - I had some non obvious dependencies to solve...anyway!

There's a installation guide provided which helps a lot ;]

Make sure that your kernel have debugfs support compiled (in "Kernel Hacking" enable "Debug Filesystem") and I also had to enable UVESA option ( "Device drivers" -> "Graphics support" -> "Support for framebuffer devices" -> "Userspace VESA VGA support"). Recompile and reboot to your new kernel.

Disable the proprietary module if you were using it (unlikely on hardened! ;P). As per guide switch opengl to X11:

# eselect opengl set xorg-x11
Switching to xorg-x11 OpenGL interface... done

Make sure you have USE="dri" and VIDEO_CARDS="nouveau" set in make.conf. Try emerging this (You'll probably need to keyword and unmask these ebuilds):

# emerge -va nouveau-drm libdrm xorg-server xf86-video-nouveau

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild N ] x11-drivers/nouveau-firmware-20091212 0 kB [1]
[ebuild N ] x11-libs/libdrm-9999 USE="-static-libs" 0 kB [1]
[ebuild N ] x11-base/nouveau-drm-99999999 0 kB [1]
[ebuild R ] x11-base/xorg-server-1.7.4 USE="hal ipv6 nptl sdl xorg -debug -dmx -kdrive -minimal -tslib" 0 kB [0]
[ebuild N ] x11-drivers/xf86-video-nouveau-9999 USE="-static-libs" 0 kB [1]

Total: 5 packages (4 new, 1 reinstall), Size of downloads: 0 kB
Portage tree and overlays:
[0] /usr/portage
[1] /usr/local/portage/layman/x11

Would you like to merge these packages? [Yes/No]

This should look similar to this above. Pay attention to packages that need to be pulled from the x11 overlay rather than portage tree.

Once everything is compiled, change the xorg.conf to use new driver - replace:

Driver "nv"

with:

Driver "nouveau"

Enable relevant modules to be loaded during boot. The /etc/conf.d/modules should something like this:

modules_2_6="dri nouveau"

Do not modprobe the nouveau driver from within X! It will kill it... ;] Stop X, modprobe and start X again...or simply reboot...end enjoy the new driver and KMS!