Wednesday, September 2, 2009

Loading Kernel Modules in Linux

Loading Kernel Modules

Linux allows the Kernel to be configured at run time, to enable or disable different services as you see fit

Module Commands

There are a few commands that allow you to maniuplate the kernel. Each is quickly described below, for more information say `man [command]`.
• depmod - handle dependency descriptions for loadable kernel modules.
• insmod - install loadable kernel module.
• lsmod - list loaded modules.
• modinfo - display information about a kernel module.
• modprobe - high level handling of loadable modules.
• rmmod - unload loadable modules

Using Module Commands

Below the different kernel module commands are demonstrated

# Show the module dependencies.
depmod -n

# Install some module

insmod [modname]
modprobe -v modename

# This lists all currently loaded modules, lsmod takes no useful parameters

lsmod

# Display information about module eepro100

modinfo modname

# Removing a module (don't use the example)

rmmod modname
modprobe -r modname

Module Configuration Files

The kernel modules can use two different methods of automatic loading. The first method (modules.conf) is my preferred method

/etc/modules.conf or /etc/modprobe.conf
/etc/rc.local

No comments:

Post a Comment