LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   [B]How we can link kernal module statically in kernel?? [/B] (https://www.linuxquestions.org/questions/linux-kernel-70/%5Bb%5Dhow-we-can-link-kernal-module-statically-in-kernel-%5B-b%5D-558202/)

htandel 06-01-2007 01:59 AM

[B]How we can link kernal module statically in kernel?? [/B]
 
Well,
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.

I WANT TO KNOW....

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,

cdcshu

htandel 06-01-2007 06:25 AM

Thanks
 
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 05:28 PM.