On all modern Linux operating systems, a modular kernel model is employed, allowing for additional functionality to be added when needed. This is the opposite of the monolithic kernel model, which requires all functionality to be compiled into the kernel prior to loading the operating system. A monolithic kernel is more efficient with regards the amount of memory it consumes, however most kernel modules consume very little memory in relation to modern computing standards where gigabytes of memory are normally available. Being able to dynamically load kernel modules when required far outweighs any disadvantages of using slightly more memory.
So what is a kernel module? Well, it is very similar to a Windows device driver Modules often provide hardware specific software functionality. For example:
- DVD players
- delivering access to hard drives
- serial devices
- video adapters
The most basic commands for loading and unloading modules are the "insmod" and "rmmod". The insmod command inserts a module in the kernel, the rmmod command removes a module from your kernel. There are a variety of other commands which can be necessary to know when dealing with kernel modules. They're:
- depmod - ascertain any dependencies a module has
- lsmod - lists all actively loaded modules
- modinfo - displays the .modinfo section of the module object file (i.e. a file with a .ko or .o file)
- modprobe - intelligently inserts or removes a Linux kernel module and any dependencies.
Linux kernel modules are typically located under /lib/modules/[kernel-version] where by [kernel-version] is the kernel version number you are interested in. It is likely that you will see many different kernel versions in this directory and you should make sure that any modules you compile are placed in the directory corresponding to the kernel version you are working on.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.