-   Linux - Kernel (
-   -   [B]How we can link kernal module statically in kernel?? [/B] (

htandel 06-01-2007 01:59 AM

[B]How we can link kernal module statically in kernel?? [/B]
when we artite a kernel module , we can load it into kernel with the use of "insmod" command and after using mknod we can create a node and from application we can use it.
But this is called dynamic linking of kernal module. Once you shutdown the PC this module will not be available in the kernal, you need to load it again in the kernel with insmod command.


How can we load the module statically, I mean after shuting down the PC also that modue should remain in the kernel and we(user/application) must be able to access it wihtout loading it again.

kernel module can be anything, a char or block driver or any other kernal functionality.

But how can we link that into our kernal statically?????

Do we need to change some makefile?? if yes then which?
Do we need to compile the kernel?? then what's the procedure we need to follow before compiling??

Is there anybody???who can help me???

cdcshu 06-01-2007 05:04 AM

Insmod it in the very begining?
Well, I think the easy way to make it is to add a line in your startup script /etc/rc.d/init.d/rcS like

insmod /lib/modules/.../xxx.ko

This way, system will load it for you after startup.

Another way is to re-compile kernel and build the module to kernel statically. So once your PC start running with the new kernel, the module has been there always.

Hope this helps,


htandel 06-01-2007 06:25 AM

I got some idea of what I should do... and I thank you for that.

But can anyone give me some more details, in detail. thank for the help.

All times are GMT -5. The time now is 01:41 PM.