Tuesday, July 30, 2013

Gentoo, Linux 3.10 and Nvidia drivers (also Linux 3.11)

Update: Check the end for Linux 3.11

Looks like binary Nvidia drivers aren't compatible with Linux kernel 3.10 for some reason. There's a patch (found it in Nvidia forum DevZone) but for some reason Gentoo maintainers won't include it in gentoo-sources even as an use flag. Portage only tells me:

* Gentoo supports kernels which are supported by NVIDIA
* which are limited to the following kernels:
* <sys-kernel/gentoo-sources-3.10
* <sys-kernel/vanilla-sources-3.10

* You are free to utilize epatch_user to provide whatever
* support you feel is appropriate, but will not receive
* support as a result of those changes.

* Do not file a bug report about this.

I haven't heard about epatch_user before but it seems perfeclty reasonable for Gentoo to have something like this. Basically it is a way for user to easily patch sources to be built without editing ebuilds.

I started to look for info about how to use this epatch_user. Gentoo handbook was the first place to look but I didn't get it to work with that info. After looking at other pages I found out what was wrong. I think the handbook should say
/etc/portage/patches/<category>/<package>/<name>[-<version>[-<revision>]]
instead of
/etc/portage/patches/<category>/<package>[-<version>[-<revision>]]
where <name> is an arbitrary name for the patch. Anyways I wrote a (very) short howto for those with the same problem.

A short howto

Run all the commands as root:
mkdir -p /etc/portage/patches/x11-drivers/nvidia-drivers
wget http://pastie.org/pastes/8123499/download -O /etc/portage/patches/x11-drivers/nvidia-drivers/nvidia-drivers-325.08-lnx311-rc0.patch
emerge nvidia-drivers

Quite easy. Of course this assumes you have gentoo-sources-3.10.x configured and compiled and nvidia-drivers-325.08 unmasked.

Linux 3.11

Seems like something different for Linux 3.11. That's solved by a patch from https://bugs.gentoo.org/show_bug.cgi?id=482168. Put that file in /etc/portage/patches/x11-drivers/nvidia-drivers-325.15/ and Nvidia 325.15 should compile for Linux 3.11.