Sign in to follow this  

problem with insmod and modprobe

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am learing how to write driver modules in linux.. but for some reason i can't load the modules ( i have written ) with insmod or modprobe. I am using Mandrake 10 ( Kernel 2.6 ). The modules that come with the kernel are all stored in ".ko.gz" format.. for example the module rivafb would be stored as "rivafb.ko.gz" That's why i even tried to gzip my modules before trying insmod but it didn't work. Does anyone know where to go from here ?

Share this post


Link to post
Share on other sites
the error message i am getting is

"Error in inserting hello.o . -1 invalid object format"

And this is really getting quite frustrating for me. The book i am reading, the articles i am reading , all building their modules in the following manner

$ gcc -DMODULE -D__KERNEL__ -I/usr/src/linux/include -c hello.c
$ insmod ./hello.o

but IT'S not working in my system... (Mandrake 10 kernel 2.6)

as a matter of fact.. all the modules in /lib/modules/..../drivers

reside as ".ko.gz" format except for the "nvidia.ko" which is installed by the NVIDIA installer... and it works ! I did a lil of digging into the "Makefile" of NVIDIA installer and it didn't seem to have done anything special with the building process.. except for creating device entries in /dev

Please someone help me....
my hello.c , btw, doesn't contain anything more than a simple init_module and cleanup_module.

:(

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanx C-Junkie...
Finally i have been able to get the modules up and running :) in Kernel-2.6. Suh! they have changed quite a lot with the build process. Itz still not very clear to me yet though.. but that was a nice starting point :).

However, the damn "printk" is not working :(. I did include "" with the text :

printk(" Hello\n").

but still nothing's been displayed. Be sure that he init funtion has been properly called during insmod; i checked that in a different way ;); but just can't get the "printk" working :s.

Share this post


Link to post
Share on other sites
Thanx C-Junkie...
Finally i have been able to get the modules up and running :) in Kernel-2.6. Suh! they have changed quite a lot with the build process. Itz still not very clear to me yet though.. but that was a nice starting point :).

However, the damn "printk" is not working :(. I did include "(1)" with the text :

printk("(1)Hello\n").

but still nothing's been displayed. Be sure that he init funtion has been properly called during insmod; i checked that in a different way ;); but just can't get the "printk" working :s.

NOTE: the braces () above should actually be angle braces... sorry couldn't get the angle braces displayed on this page... itz considering the angle braces as HTML tags :s.

Share this post


Link to post
Share on other sites
Sign in to follow this