LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-24-2007, 09:40 AM   #1
sharad
Member
 
Registered: Dec 2005
Posts: 48

Rep: Reputation: 15
how to insert a module in kernel through a user defined service


Hi everybody,

I have created a c program which will insert a module in kernel. I converted this program into a service so that when I start it, it should insert the module in kernel & vice versa.

By default the service takes this module from root( / ) for insertion. But when I put this module in my home directory(say /home/sharad), the service is unable to find the module (It will search it in / only).

So how to load the module in kernel from my home directory using a service?

I would appreciate if u could answer my query.

Thanks & regards,

sharad.
 
Old 03-24-2007, 02:32 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
When you say that the program is a "service", do you mean it's running as a daemon? How does the user communicate with the daemon? Whatever communication method you use, why don't you just allow the user to specify the full path to whatever module that they want to load?
 
Old 03-24-2007, 11:21 PM   #3
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
btmiller

While we're on the topic, issuing command: depmod -a, will that only apply to the /lib/modules directory or modules system wide, as modules with udev have .ko extension.
 
Old 03-25-2007, 11:34 PM   #4
sharad
Member
 
Registered: Dec 2005
Posts: 48

Original Poster
Rep: Reputation: 15
Can not insert a module through a service running as a daemon

Quote:
Originally Posted by btmiller
When you say that the program is a "service", do you mean it's running as a daemon? How does the user communicate with the daemon? Whatever communication method you use, why don't you just allow the user to specify the full path to whatever module that they want to load?

Yes, the service is running as a daemon. From the C code I am invoking a system() function as follows.

e.g,
system("insmod module.ko");

Also I tried with the absolute path, but it is not working.

Please help me if you have any solution for it.

Thanks & Regards,

Sharad.
 
Old 03-25-2007, 11:40 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Junior Hacker: According to the man page for depmod on my system it only looks at modules in /lib/modules`uname -r` but you can give it other directories with the -b option.

sharad: I've used insmod with the full path before with no problem, and AFAIK it should work. Are you sure you passed it the correct path? Maybe there was some other problem inserting the module -- e.g. a missing symbol or somesuch (just guessing here). Can you post the exact error message you're getting?
 
Old 03-25-2007, 11:46 PM   #6
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Well
I feel kind of like a fool here, that was a question for both of us but I ended up forcing you to read up on it. But we both gained some knowledge I guess.

Sorry...and Thanks.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert a loadable module into the kernel.? moog Linux - Newbie 2 01-08-2007 08:37 AM
user defined service Tonatiuh Linux - General 2 03-22-2006 01:44 PM
insert module into non-running kernel... howto? euph0rix Linux - Newbie 2 01-25-2005 06:29 PM
failled tp insert module into kernel actteoh Linux - Hardware 2 05-07-2004 10:18 AM
Can't insert module into kernel swamysk Linux - Newbie 14 08-22-2003 05:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:59 AM.

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
Open Source Consulting | Domain Registration