Posted by TristanSchmelcher on Fri 26 Jan 2007 at 09:28
I recently set up Xen 3.0.3 on Debian etch using the great guide here from this site. However, if (like me) you use the binary Nvidia X.org driver rebooting into your new XenLinux kernel your X.org server will fail to start. If you read its error output, you will see that this is because it cannot find the nvidia kernel module. Here we'll show how to fix things.
The simple solution is to switch from the proprietary nvidia X.org driver to the nv driver. However, if (like me) you have become emotionally attached to the proprietary nvidia driver, then it is possible to make it work on a Xen kernel. Essentially, what we'll do is build the nvidia kernel module from source, with a patch, and target it to your new XenLinux kernel.
First, on your Xen kernel, as root, do:
apt-get install module-assistant nvidia-kernel-source \ gcc linux-headers-$(uname -r)
Also, download this patch. Save it in a temporary directory somewhere. I'll call it "tmp". (Replace it with whatever directory you actually use.)
Note: if you don't yet have networking working on your Xen kernel, you can instead do the above under your normal kernel and then switch, but make sure that you substitute "$(uname -r)" with the result that you'd get on your Xen kernel. (e.g., if your normal kernel would say 2.6.18-3-amd64, then your Xen kernel would say 2.6.18-3-xen-amd64.)
After the apt-get, you will have a new file called /usr/src/nvidia-kernel-source.tar.gz. Extract it to tmp:
cd tmp && tar xzf /usr/src/nvidia-kernel-source.tar.gz
This will create a directory called "modules". Within it will be a directory called "nvidia-kernel", and within that will be two, one of them called "nv". Go there:
Now use the patch that you downloaded, as follows:
patch -p1 < tmp/patch-nv-1.0-9625-xenrt.txt
You may see some errors about hunks failing. I hope you know how the "patch" command works, because you're going to need to do a bit of manual work. The problem is just due to the fact that the patch file was meant for a different version of the nvidia kernel module. To fix the problem, look at the rejected hunks in the .rej file to see what change the patch command was unable to make. Then look at the file(s) it tried to change, locate the parts that look most similar to the text that the patch command was looking for, and do the change manually yourself. For the version of the nvidia kernel module that etch was using at the time I wrote this (8776), one hunk fails in os-interface.c, but it is fairly easy to locate the spot to change (it's at line 564).
After you're done that, it's time to make the module:
MODULE_LOC=tmp/modules module-assistant --unpack-once build nvidia
And now install it:
module-assistant install nvidia
Now just reboot, and X.org should work with the nvidia driver on your XenLinux kernel.
Note: for the original thread about the patch used here, see this link.