Sunday, September 19, 2010
8:38 PM

Insmod explained

If you are interested in kernel programming for Linux or writing device drivers for linux  "insmod"  would be a command that you would use most often. 
insmod which can be expanded to insert module is a command that is used to insert modules into the linux kernel at runtime. 
A module can be defined any piece of code that is inserted into the kernel at runtime. 


What exactly happens when  "insmod" is used to insert a module into the kernel. 


Lets compare it with a real life scenario.  Assume your system is like a hotel and the memory like the rooms in the hotel,the kernel is the hotel manager and you are a module who wants a room in the hotel. 
The flow chart below gives the standard steps that would be followed if you ask for a room and relates it with what happens on executing the insmod command. 






Note : This is a very generic way of looking at insmod. There a lot of other things that also take place for eg the version dependency is matched, the module format is matched, the symbols used in the module should be available in the kernel. 









0 comments:

Post a Comment