Modular Kernel
The modern day Linux kernel uses a modular model allowing users to add additional functionality to the core of the operating system as and when required. In other operating systems a monolithic kernel model is used, requiring all functionality to be compiled into the kernel prior to this system being booted. In the past a monolithic kernel was preferred, as it is more efficient with regards the usage of memory resources, however nowadays most computers have multiple gigabytes of RAM available, so this is less of an issue. Being able to dynamically load kernel modules when required far outweighs any disadvantages of using slightly more memory.So what is a kernel module? A kernel module is similar to a windows driver. A module will more often than not, provide software to handle a specific hardware device or type of device. Examples include:
- video adapters
- providing access to hard drives
- DVD players
- serial devices
Linux Kernel Tools
It is normal for kernel modules to be loaded at boot time, however due to their dynamic nature they can also be loaded at any time. A number of commands are available to the administrator for loading, unloading and finding out further information about a module.The simplest commands for loading and unloading modules consist of "insmod" and "rmmod". The insmod command inserts a module in to the kernel, the rmmod command removes a module from your kernel. You will find a number of other commands which can be useful to understand when dealing with kernel modules. These are:
- lsmod - lists all currently loaded modules
- depmod - determine any dependencies a module has
- 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 all dependencies.
Linux kernel modules are typically found under /lib/modules/[kernel-version] where by [kernel-version] is the kernel version number you are looking at. It is likely that you will see many different kernel versions in this directory and you should ensure that any modules you compile are placed in the directory matching to the kernel version you are doing work on.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.