LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-15-2009, 02:52 AM   #1
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Rep: Reputation: 15
Quick Question about modprobe


Hi,

Can anyone please tell, When we use modprobe, which path it looks in to find the .ko modules. Because i am using like this

modprobe ./a.ko

it is giving me following error:

FATAL: Module ./a.ko not found

The documentation says that it looks into /lib/modules, i have copied the necessary .ko file into the above mentioned directory but still i am getting the error

Module: ./a.ko not found

Can anybody tell which path the modprobe looks into or what should i do to run modprobe?

Regards,
dinky
 
Old 06-15-2009, 02:55 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
modprobe looks into /lib/modules/<kernel version> for modules to load
If you want to insert a module into the kernel from the current directory use
Code:
insmod a.ko
 
Old 06-15-2009, 03:11 AM   #3
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
Hi,

Yes that is true. I have put the .ko module into /lib/modules/'uname -r'
folder. But Still Modprobe is giving the same error. Am i missing some thing?

Regards,
dinky
 
Old 06-15-2009, 03:35 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Take a look at the dmesg output to see if you find what the problem is.
Also you can try the insmod command, or run before modprobe
Code:
depmod -a
to adjust module dependencies in modules.dep
 
Old 06-15-2009, 03:52 AM   #5
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
Hi,

I tried depmod -a
before running modprobe but still getting same problem. Do i need some special configuration in kernel config file?

The problem with insmod is as follows:

I have two modules a.ko and b.ko. b.ko is using the APIs of a.ko. I have exported the APIs from a.ko that i want to use in b.ko, But when i am doing insmod ./a.ko,

it is inserting it successfully but when i run

insmod ./b.ko

i am getting the following error:

insmod: error inserting 'b.ko': -1 unknown symbol in module and when i am using dmesg

i am getting the following info

b: Unknown symbol register_driver

SO here i am stuck. Any help will be appreciated. so thats why i tried using modprobe. What should i do to run it successfully?

Regards,
dinky
 
Old 06-15-2009, 04:25 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
I think that the correct place to put not standard kernel modules is /lib/modules/`uname -r`/misc
And you can run
Code:
depmod -aev|grep register_driver
to see if it helps

Last edited by bathory; 06-15-2009 at 04:27 AM.
 
Old 06-15-2009, 05:22 AM   #7
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
Hi,

I tried
depmod -aev|grep register_driver

its output is nothing.

But also in /lib/modules/'uname -r'

there is no 'misc' folder exists in above mentioned directory, shall i create this folder misc or what should i do? really got stuck..

Regards,
dinky
 
Old 06-15-2009, 05:41 AM   #8
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
and one question more why my module dependencies are not existing in modules.dep file??? any idea
 
Old 06-15-2009, 06:28 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Well, I don't think the misc directory is important, as depmod will find all the modules under /lib/modules/`uname -r` and build the necessary dependencies.
So I guess that the b.ko does not have any reference to symbols from the a.ko. You can see if that's the case grepping a.ko or b.ko in modules.dep:
Code:
grep b.ko /lib/modules/`uname -r`/modules.dep
If the dependencies exist you can unload a.ko and try to load b.ko directly to see if it loads also a.ko.
 
Old 06-15-2009, 06:54 AM   #10
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
Hi bathory,

First very-2 thanks for supporting me. Yeah I have put the a.ko and b.ko files in /lib/modules/'uname-r' and then run the depmod -a and i am able to see dependencies in modules.dep But when i tried

modprobe ./b.ko

it is giving me error

FATAL: Module ./b.ko not found

what should i change that this modprobe will work.

Regards,
dinky
 
Old 06-15-2009, 07:40 AM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
For what kernel version are you writing these modules. I'm not a programmer myself, but the output of
Code:
cat /proc/kallsyms |grep register_driver
for a 2.6.x kernel, does not return any plain "register_driver" symbol

Last edited by bathory; 06-15-2009 at 07:42 AM.
 
Old 06-15-2009, 07:51 AM   #12
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
Hi bathory,

when i executed this

/proc/kallsyms | grep register_driver

i got the following output

f8def9a0 r __ksymtab_register_driver [a.ko]
f8def9e7 r __kstrtab_register_driver [a.ko]
f8def9bc r __kcrctab_register_driver [a.ko]
de21cf89 a __crc_register_driver [a.ko]
f8def130 T register_driver [a.ko]

I am using the kernel version 2.6.27.18-custom.

I do not know why this modprobe is not working...

regards,
dinky
 
Old 06-15-2009, 08:25 AM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Doh, I don't know either, since the symbol is exported.
Run
Code:
modinfo b
and see if it knows it depends on a.ko.
As a last resort try to force load it and see what happens
Code:
modprobe -f b

Last edited by bathory; 06-15-2009 at 08:33 AM.
 
Old 06-16-2009, 03:57 AM   #14
dinkyverma279
LQ Newbie
 
Registered: Jun 2009
Posts: 29

Original Poster
Rep: Reputation: 15
Hi Bathory,

Thanks for your support. i checked the modinfo ./b.ko

it is giving the following module information:

filename: ./b.ko
license: GPL
author: dinky
depends:
vermagic: 2.6.27.18-custom SMP mod_unload modversions 386


But in depends row, it does not know anything. why in depends it is not showing that it depends on a.

regards,
dinky
 
Old 06-16-2009, 05:43 AM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
But in depends row, it does not know anything. why in depends it is not showing that it depends on a.
You should be able to answer to this, as you are the programmer
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
modprobe question greplinux Linux - Newbie 2 04-09-2009 01:00 AM
Need to un-modprobe question jbuckley2004 Linux - General 2 01-25-2006 03:01 PM
samba smb.config question (quick question) TheDOGG Linux - Networking 1 03-02-2004 07:19 AM
modprobe question littleking Slackware 8 12-04-2003 12:15 PM
Quick question about modprobe calimer Linux - Hardware 5 04-24-2003 12:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:42 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