I was somewhat surprised to find that this is non-trivial.

The xensource hg repository contains a directory called unmodified_drivers. To be polite, the instructions for building these are woefully incomplete. Also, pulling down the entire xen source code to build a couple of drivers is a pain in the backside.

In essence, what you need to do is as follows:

  • Grab a recent kernel source from kernel.org. I used 2.6.32.11.
  • Find a set of patches to xenify it (I used Andrew Lyon’s Gentoo patches).
  • Configure the kernel in non-Xen mode (i.e. a normal kernel, with the options you would want for full HVM).
  • Build the kernel.
  • Build the PV drivers.

I have simplified this process as follows:

  • I wrote a little script to patch the kernel (more accurately, I adopted and adapted a perfectly useful script from Boris Derzhavets).
  • I pulled the unmodified_drivers directory out of the rest of the Xen source tree, fixed a bug in a Makefile, wrote a build script, and put it in its own .tgz.

So now what you need to do is as follows (I’m building on Ubuntu Lucid, but it doesn’t much matter):

And that should be it. In case you are wondering where pvdrivers-0.01.tgz came from, here’s roughly how you make it:

You’ll then need to add the two shell scripts I wrote (or your own equivalent). The main surprises here are:

  • The XL environment variable needs to point to a kernel source tree with a configured and built xenified kernel in, but one which has not been configured for Xen.
  • The XEN environment variable does not need to point to a Xen source tree. Instead it needs to point to include/xen within the Linux tree.

The 3.3-testing PV drivers do not build (though it’s an easy fix, one of the hypervisor includes has moved). However, PV drivers built using this package (from 4.0-testing) seem to work just fine with older versions of Xen, so there’s not a lot of point in bothering.

Leave a Reply

Discover more from Alex Bligh's blog

Subscribe now to keep reading and get access to the full archive.

Continue reading