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

  • Use your favorite package manager frontend (zypper / yast / etc.) to install needed packages.
zypper in kernel-source kernel-syms kernel-xen gcc binutils make wget

OpenSuse 11.1

This solution was tested with the last stable NVIDIA driver 180.22

# cd ~ && mkdir nvidia && wget -c -O ~/nvidia/NVIDIA-Linux-x86-180.22-pkg1.run \
http://us.download.nvidia.com/XFree86/Linux-x86/180.22/NVIDIA-Linux-x86-180.22-pkg1.run

You should download NVIDIA-Linux-x86_64-180.22-pkg2.run for the x86_64 version of openSUSE.

  • Logout from your DE/WM to stop applications correctly and disable graphics.
# rcxdm stop
  • Set enviroment varibles
# export IGNORE_XEN_PRESENCE=1
# export SYSSRC=/lib/modules/$(uname -r)/source
# export SYSOUT=/lib/modules/$(uname -r)/build
  • Set NVIDIA installer runable & run it
# cd ~/nvidia
# chmod u+x NVIDIA-Linux-x86-180.22-pkg1.run
# ./NVIDIA-Linux-x86-180.22-pkg1.run
  • Configure X settings & run graphics
# sax2 -r -m 0=nvidia
# rcxdm start

Old Versions

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 (manually); we will be putting this in the “extra” directory where supplemental kernel modules go
mkdir -p /lib/modules/$(uname -r)/extra
cp nvidia.ko /lib/modules/$(uname -r)/extra/
  • Rebuild the module dependencies:
depmod -a

Test it out

Restart X with:

init 5

You should now have a working Nvidia driver.

See also

External links