Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


TIP: Building Modules in Xen

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> General Discussion
Author Message
rjp



Joined: 15 Aug 2003
Posts: 102

Posted: Wed May 14, 2008 10:23 am    Post subject: TIP: Building Modules in Xen  

If you are going to build any modules on a Xen Linode, you will need BOTH the kernel sources AND an Ubuntu 6.06 distro on which to compile the modules. I found that when I tried to compile modules on my CentOS 4.4 system, I would get "Invalid module format" errors when trying to load them.

You'll need to deploy a 6.06 profile, log in, and then use:

apt-get update
apt-get upgrade
apt-get install build-essential

Then, go to /usr/src, grab the kernel source, and untar it:

wget http://linode.com/src/2.6.18.8-domU-linode7.tar.bz2
tar xvfj 2.6.18.8-domU-linode7.tar.bz2

Create a symbolic link:

ln -s 2.6.18.8-domU-linode7 linux

You should now be ready to compile and test your modules. Once you have done so, go back to the dashboard, change your normal boot profile to connect the Ubuntu image to a virtual device, and boot back into your original system. You can then mount that image somewhere (let's say /dapper for this example), and copy your Ubuntu /lib/modules/2.6.18.8-domU-linode7 tree to your original system.

cp -ax /dapper/lib/modules/2.6.18-domU-linode7 /lib/modules

If you want to rebuild modules, you can just use chroot to bring up a shell in the Ubuntu environment instead of rebooting:

chroot /dapper /bin/bash
Back to top  
mwalling



Joined: 10 Dec 2007
Posts: 134

Posted: Wed May 14, 2008 10:28 am    Post subject:  

The invalid module formats happen because the gcc that you used to build the modules was different then what Linode uses to build the kernels (2.6.18.8-domU-linode7 SMP mod_unload Xen PENTIUM4 REGPARM gcc-4.0). The --force options outlined in modprobe(8) will overcome that if you don't mind tainting your kernel.
Back to top  
 
       Linode.com Forum Forum Index -> General Discussion
Page 1 of 1