Hello World Module not working
Hi all
I wrote a Hello World module . Does n't seem to work - compiles but i cant insmod the same. The program is #define MODULE #include <linux/version.h> #include <linux/init.h> #include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk("Hello World!"); return 0; } static void hello_exit(void) { printk("Good Bye"); } module_init(hello_init); module_exit(hello_exit); Now this is the way i compile it #gcc -c hello.c #insmod hello.o This isthe error i get hello.o : kernel - module version mismatch. hello.o was compiled for kernel version 2.4.20 while this kernel is version 2.4.22-1.2115.ntpl Another question , how to use KERN_ALERT in printk? What should the include file be? And finally , what is .ko for example xyz.ko . How is it different from xyz.o?? Please help |
Maybe this will help: http://www.linuxhq.com/lkprogram.html
|
All times are GMT -5. The time now is 02:08 AM. |