Recompile Xen domU Kernel Inside the domU

If you install Xen from source, you already know how to build a domU kernel from within the dom0. But how would one recompile a domU kernel while inside the domU? Copying over the linux- source directory by itself will not do the trick.

Before I explain how to do it, let me answer *why* you’d want to do it. Well, you may have a kernel module installed in the domU that was compiled with gcc 3.4 and it complains that the kernel you are running was compiled with gcc 3.3, and so it won’t load. This happened to me when I tried to run TrixBox on Xen. If I didn’t compile *everything*, including the kernel, in the domU, the Zaptel drivers would complain about gcc version discrepancies. Frustrating, I know.

So, to build your domU kernel within the domU, you need to copy the following directories found in your Xen source tree to your domU, in /usr/src (preferably):


Now you can do:

cd /usr/src/linux-
make menuconfig
make && make modules_install

and all the rest of that jazz…

Copy the resulting ‘/usr/src/linux-’ to your dom0 and assign it to the kernel line of your domU config. Now your domU will run with the kernel built inside its own environment.

Pretty easy.