|< Day Day Up >|
Recipe 10.7. Adding a New Loadable Kernel Module
The steps are the same for 2.4 and 2.6 kernels. Change to the directory that contains the build tree (e.g., ~/src/linux-2.4.25). You'll need a good, up-to-date .config file. Copy it to the top level of your build tree, then run:
$ make oldconfig
As you go through the configuration, find the driver you need and select it as a module (for example, the tulip module, which is a common driver for many Ethernet cards). Then:
$ make dep $ make modules # make modules_install # depmod -av
Load the module with modprobe:
# modprobe tulip
This whole process doesn't need a reboot.
make menuconfig also works, if you can't use oldconfig. It just takes longer, and you have to be careful to not leave out anything important.
If you're installing a third-party module that is not in the kernel tree, you must rely on the vendor's installation instructions. The usual method is to download sources, build the module, then load it with modprobe. Some vendors, like nVidia, provide a script that does everything for you.
Most distributions probe hardware at bootup, and automatically load the correct modules. If this does not happen, you'll need to configure some startup files. On Red Hat and SuSE, add the module to /etc/modules.conf. On Debian, add it to /etc/modules. Slackware uses rc.modules.
Even easier is to enable kmod, the automatic module loader, in your kernel. Most distributions enable it by default. In the kernel configurator, look for "Automatic kernel module loading" (2.6 kernel) or "Kernel module loader" (2.4) under "Loadable module support."
10.7.4 See Also
|< Day Day Up >|