Use Nvidia driver with Xen

From openSUSE

The Nvidia driver needs to be patched before using it in Xen.

This is a step by step guide to doing this and works with openSUSE 10.2 GM i586(32 bit) and x86_64. This needs to be done as root.

Contents

Get Nvidia working with a non-Xen kernel

  • Note: this solution doesn't work after the 12st of June 2007, see the discussion tab for an explanation and solution!

Install the packages

  • I have used smart to install the needed packages, but you could use YaST as well.
smart install kernel-source kernel-syms kernel-xen gcc wget

Download the patch and the driver

  • Download the patch
cd /root
wget  http://www.nvnews.net/vbulletin/attachment.php?attachmentid=20801&d=1159874953
mv attachment.php\?attachmentid\=20801 xen.patch
  • Download the driver
For i586 use:
  wget http://us.download.nvidia.com/XFree86/Linux-x86/1.0-9631/NVIDIA-Linux-x86-1.0-9631-pkg1.run

For x86_64, use
  wget http://us.download.nvidia.com/XFree86/Linux-x86_64/1.0-9631/NVIDIA-Linux-x86_64-1.0-9631-pkg2.run

Preparing for installation

At this stage, you need to:

  • Reboot into Xen. Do this by restarting your machine, and at the Grub menu, choose the kernel option which ends in '-xen'.
  • Login as root. Once your system has rebooted, press CTRL-ALT-F1 to get to the text console (if you're not there already) and login as root.
  • Drop to runlevel 3. This shuts down the X server and removes the current nv or nvidia module
telinit 3

Installing the new driver

  • Return to the /root directory and extract the code from the downloaded Nvidia driver
For i586:
  sh ./NVIDIA-Linux-x86-1.0-9631-pkg1.run --extract-only

For x86_64:
  sh ./NVIDIA-Linux-x86_64-1.0-9631-pkg2.run --extract-only
  • Apply the patch
cd NVIDIA*/usr/src/nv
patch -p1 < ../../../../xen.patch
  • Build the driver
CC="gcc -DNV_VMAP_4_PRESENT -DNV_SIGNAL_STRUCT_RLIM" make SYSSRC=/lib/modules/`uname -r`/source SYSOUT=/lib/modules/`uname -r`/build module
  • Install the driver
cp nvidia.ko /lib/modules/2.6.18.2-34-xen/kernel/drivers/video/
  • Rebuild the module dependencies:
depmod -a

Test it out

Restart X with:

telinit 5

You should now have a working Nvidia driver.

Troubleshooting

  • when you try to do
modprobe nvidia.ko  
insmod: error inserting 'nvidia.ko': -1 Invalid module format

You need to use correct kernel config template in /urs/src/linux :

cp arch/i386/defconfig.xen .config 

and redo

make olconfig && make script && make prepare 

and recompile the nvidia drivers

See also

External links