Thursday, October 07, 2010

nvidia driver for gentoo xen host

This is how to get the official nvidia driver working on a Xen host.

xen-4.0.0
gentoo xen-sources-2.6.34-r3 kernel
non-xen 2.6.34.1 vanilla kernel
nvidia-drivers-173.14.27

Thanks to this (original but outdated) article: http://legroom.net/2008/06/22/running-binary-nvidia-drivers-under-xen-host

You need a non-xen kernel to compile the drivers. I used vanilla 2.6.34.1

1. Boot into the xen kernel

uname -a
Linux motoko 2.6.34-xen-r3 #5 SMP Thu Oct 7 11:30:18 EDT 2010 x86_64 Intel(R) Xeon(R) CPU X5355 @ 2.66GHz GenuineIntel GNU/Linux

2. Have /usr/src/linux point to the non-xen kernel

ls -l /usr/src/linux
lrwxrwxrwx 1 root root 19 Oct  7 11:58 /usr/src/linux -> linux-2.6.34.1

3. Build the nvidia-drivers package

emerge =nvidia-drivers-173.14.27

NOTE: nvidia-drivers-195.36.31 does NOT WORK for me

4. Extract the content of the nvidia-drivers package

cd /usr/local/src

bash /usr/portage/distfiles/NVIDIA-Linux-x86_64-173.14.27-pkg2.run -a -x

5. Build the nvidia.ko kernel module

cd NVIDIA-Linux-x86_64-173.14.27-pkg2/usr/src/nv

IGNORE_XEN_PRESENCE=y make SYSSRC=/usr/src/linux module

insmod nvidia.ko

Here's what dmesg shows:

nvidia: module license 'NVIDIA' taints kernel.
Disabling lock debugging due to kernel taint
nvidia 0000:07:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
nvidia 0000:07:00.0: setting latency timer to 64
vgaarb: device changed decodes: PCI:0000:07:00.0,olddecodes=io+mem,decodes=none:owns=io+mem
NVRM: loading NVIDIA UNIX x86_64 Kernel Module  173.14.27  Wed Jul 14 13:01:46 PDT 2010

6. Change /usr/src/linux to point back to linux-2.6.34-xen-r3
ls -l /usr/src/linux
lrwxrwxrwx  1 root root       19 Oct  7 11:58 linux -> linux-2.6.34-xen-r3

7. startx

Please post comments if you get it to work with any other nvidia-drivers versions.

No comments: