LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-11-2012, 04:10 AM   #1
chinabenjamin66
Member
 
Registered: Mar 2012
Location: Shenzhen Chian
Posts: 73

Rep: Reputation: Disabled
How to add kernel module automatically after booting up


Hello friends,

It is inconvenient for add kernel modules manually. can anyone teach me how to add kernel module automatically after booting up?
My linux distribution is Ubuntu.

let's take an example:
Code:
root@gpl-vm:/GPL/yaffs2# ls yaffs2multi.ko 
yaffs2multi.ko
root@gpl-vm:/GPL/yaffs2# pwd
/GPL/yaffs2
root@gpl-vm:/GPL/yaffs2#
yaffs2multi.ko located in /GPL/yaffs2, I can use 'insmod /GPL/yaffs2/yaffs2multi.ko' to insert this module to kernel, but after reboot my Ubuntu, this module was removed, it is very inconvenient.

I know /etc/modules, for this example, how do I add something in this file to make it add to kernel automatically after booting up?

Any reply will be appreciated.
 
Old 11-11-2012, 04:22 AM   #2
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 635

Rep: Reputation: 186Reputation: 186
If you have an /etc/rc.local file, you can then add
Code:
insmod /GPL/yaffs2/yaffs2multi.ko
to it in order to automatically load that module at boot-time.
If there's no /etc/rc.local file on your system, then you should write your own script file inside the /etc/init.d directory.
 
1 members found this post helpful.
Old 11-11-2012, 05:17 AM   #3
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 222

Rep: Reputation: 62
you can also use '/etc/modules' to load your module on system startup. before loading it in '/etc/modules' you need to create a symlink or copy it to your modules directory '/lib/modules/$(uname -r)' so modprobe will know about it

for example:

Code:
# ln -s /GPL/yaffs2/yaffs2multi.ko /lib/modules/$(uname -r)/
then probe the modules using

Code:
# depmod -a
and finally try to load the module via

Code:
# modprobe yaffs2multi
if it was loaded then adding it in '/etc/modules' will work just fine

HTH
 
1 members found this post helpful.
Old 11-11-2012, 06:40 AM   #4
chinabenjamin66
Member
 
Registered: Mar 2012
Location: Shenzhen Chian
Posts: 73

Original Poster
Rep: Reputation: Disabled
Hi All,


Thank you very much, I have tried your methods, both of them work fine.
 
  


Reply


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
Compile and load kernel module automatically after boot? (Intel NIC module) touser Linux - Newbie 3 08-29-2009 08:45 PM
RH ES4: SCTP kernel module not automatically loaded cpillonel Linux - Software 0 01-14-2008 01:24 AM
Add Kernel Module Toods Slackware 2 02-15-2006 10:40 AM
After migrating to Kernel 2.6 my sound-module is not automatically started Frederik Linux - Newbie 2 03-19-2004 05:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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