Compile Kernel Install Remove Kernel Driver Module


Purpose- Reason For Kernel Compilation
1) It is easy to Add New Features.
2) For new Hardware if it does not have proper
kernel Module, then we can rebuilt the kernel through Kernel compilation.

How To Compile Linux Kernel Source code.
1) Go to the Linux Kernel Directory/usr/src/kernels/2.6.9-5.EL-i686
Type #make menuconfig
2) Configure & compile the Kernel Source Code
For Example To Add Driver  for Key board Choose the Following Sub Menu from the #make menuconfig.
-make menuconfig - Device Drivers - Input Device Support - Keyboard - Choose the Keyboard,
3)#make menuconfig. It will build their Kernel Driver Modules Under /lib/module/`uname –r`

Linux Kernel Important Directories
1)/lib/modules/`uname -r` - Kernel Driver Modules
/lib/modules/2.6.9-5.EL/kernel/drivers/ - Contain the Linux Kernel Driver.
2) /usr/src/kernels/2.6.18-128.el5/ Contain the Linux Kernel Source.
3)/usr/include/linux - It contain the List of Header Files
/lib/modules/2.6.9-5.EL/kernel/drivers/net/ - Network Driver Modules
/lib/modules/2.6.9-5.EL/kernel/drivers/input – Keyboard, Mouse Driver Modules

How To Find Module Dependencies List Modules
lsmod  List Modules Get the Information From the /proc/modules.
depmod list the dependencies module.
depmod -v List Which module is depend on the other module.
For Example: via-velocity.ko it is Network Module located Under /lib/modules/version/kernel/drivers/net/filename.ko
/lib/modules/2.6.9-5.EL/kernel/drivers/net/via-velocity.ko needs "crc_ccitt": /lib/modules/2.6.9-5.EL/kernel/lib/crc-ccitt.ko
.ko it is kernel Modules

How To Install Or Remove The Module Loading / Unloading Module
modprobe - Install/remove the Module
insmod - Insert The Module
rmmod - Remove The Module
Compression Between modprobe And insmod/rmmod
1) For modprobe there is no need to mention any path. It is automatically install the module. But Insmod , rmmod we have to mention the Path.
#insmod kernel/drivers/net/wireless/airo.ko
2) Using Single Command we will Install & Remove Module for modprobe. We had separate command like insmod , rmmod.

Linux Module
– Binary code loaded & unloaded to the Linux OS kernel advantage is there is no need to rebuilt the entire the kernel to add the device.
Module +insmod=loaded into the kernel
Module + rmmod =unloaded from the kernel
Driver it should in the kernel space.
check out in the /sys directory. /sys/module

No comments:
Write comments