problem with insmod and modprobe

Started by
7 comments, last by browny 19 years, 7 months ago
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 ?
Z
Advertisement
What error message are you getting?
are you using the SUBDIR makefile method?

pretty much nothing else works for 2.6 external modules.
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.

:(
Z
you need to use the SUBDIR build method

[google]linux 2.6 subdir external module
Thanx C-Junkie... but could u please explain SUBDIR build a bit... a detail would be really helpful.
Z
http://linuxdevices.com/articles/AT4389927951.html

it's explained on that page.
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.
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.

Z

This topic is closed to new replies.

Advertisement