-   Linux - Newbie (
-   -   how can I load a kernel 2.6 module with the -f force option ? (

kerneluser 01-21-2010 03:56 PM

how can I load a kernel 2.6 module with the -f force option ?
I have a loadable module, simple enough I believe it should run on any 2.6 kernel. I want to force the load and test that assumption. How can I do it?

ismod does not seem to notice the -f in 2.7
modprobe has -f but cannot locate the module.

I tried: modprobe -f ./MYMODULE.ko

No go. So I read the manpage for modprobe which says: modprobe looks in the module directory /lib/modules/'uname -r'

So I copied MYMODULE.ko to /lib/modules/2.6.(the only directory in here) and type: modprobe -f MYMODULE.ko

Still can't locate MYMODULE.ko.

I notice there are no other .ko modules in that directory; so I go in deeper to kernel/drivers/char, guessing about the char directory, and copy MYMODULE.ko there.

modprobe -f MYMODULE.ko

Can't locate MYMODULE.ko

Why can't modprobe find the module?

If modprobe does find it, will modprobe -f work?

I don't have any dependencies. Is there any way to make insmod -f work?

neonsignal 01-22-2010 02:23 AM

After you build your module, you can copy it to /lib/modules:

cp MYMODULE.ko /lib/modules/$(uname -r)/kernel/drivers/MYDEVICE/
Ideally you should make your own directory under the drivers directory, but for testing, it can go pretty much anywhere in the /lib/modules/$(uname -r) hierarchy.

Then you need to run depmod so that modprobe can find the driver and its dependencies:

depmod -a
The '-a' flag makes it search /lib/modules and regenerate the modules database.

Then you should be ready to modprobe.

All times are GMT -5. The time now is 08:32 AM.