PDA

View Full Version : How to compile kernel modules


matta
02-22-2005, 07:07 PM
To compile kernel modules that can be dynamically inserted into the running kernel you need to ensure you use the same kernel source, config, and GCC version as was used to build the kernel.

Example of how to build modules is below. Please note your kernel version may be different and to substitute where needed.


wget http://www.unixshell.com/kernel-source/linux-2.6.10-xenU.tgz
tar xzfv linux-2.6.10-xenU.tgz
cd linux-2.6.10-xenU
gzip -dc /proc/config.gz >.config
make menuconfig ARCH=xen
<select modules to compile using the "M" key, not "Y">
make modules ARCH=xen
make modules_install ARCH=xen


After this has completed you may insert modules by running "modprobe module_name", substuting module_name for the name of the module you want to load.

If you receive an error loading the module run "dmesg" and check the error. If it complains about the GCC version you will need to make sure you install the same version of GCC as it states it missing.

matta
02-24-2005, 05:02 PM
Thanks... I had put in the wrong domain. As far as the source, it is stock 2.6.10 for the most part. It has changes under 'arch' to support Xen. This is why you need the modified source. For modules, you might actually not need it... but it's usually a good idea to use the same tree the kernel was compiled with.

brett
02-24-2005, 07:58 PM
To be certain I understand, at this point, only compiling modules for the running kernel is supported. That is, you cannot compile and install your own kernel completely. Is this correct?

matta
02-24-2005, 08:06 PM
Yes... only modules.