Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 06-01-2007, 01:59 AM   #1
LQ Newbie
Registered: May 2007
Posts: 9

Rep: Reputation: 0
Question [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???
Old 06-01-2007, 05:04 AM   #2
Registered: Jul 2006
Location: Shanghai
Distribution: Fedora, OpenSUSE
Posts: 31

Rep: Reputation: 16
Smile 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,

Old 06-01-2007, 06:25 AM   #3
LQ Newbie
Registered: May 2007
Posts: 9

Original Poster
Rep: Reputation: 0

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.


driver, kernel, module

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
undefined reference to `__this_module' when trying to link module to kernel Rostfrei Linux - General 1 04-02-2014 02:43 AM
kernel module for D-Link DFE-530TX NIC Gaz_za Linux - Newbie 2 06-01-2007 06:22 AM
[gcc] how to statically link my program? G00fy Programming 5 04-16-2006 04:35 PM
g++ statically link stdc++ problem berty Programming 1 05-16-2005 06:00 PM
statically link a network card driver into kernel stonux Linux - Hardware 0 04-07-2005 02:57 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration