[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Howto override kernel versioning while using insmod?
Hi
I am a newbie to Linux kernel. I am reading
Alessandro Rubini's "Linux Device Drivers".
I have trouble executing a simple sample code
given in chapter 2 of the book:
/********hello.c***************/
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void) { printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void) { printk("<1>Goodbye cruel world\n"); }
/*********end*******************/
root# gcc -c hello.c
root# insmod ./hello.o
./hello.o: kernel-module version mismatch
./hello.o was compiled for kernel version 2.4.9-9
while this kernel is version 2.4.18-3.
I looked at the man page for insmod and found
that the -f switch can be used to override kernel versioning.So I did,
root# insmod -f ./hello.o
Warning: kernel-module version mismatch
./hello.o was compiled for kernel version 2.4.9-9
while this kernel is version 2.4.18-3
Warning: loading ./hello.o will taint the kernel: no license
Warning: loading ./hello.o will taint the kernel: forced load
root# rmmod -f hello
root#
I have a few naive questions:
1. Why does gcc compile hello.c for 2.4.9-9
while my kernel's version is 2.4.18-3 ?
2. Why was insmod's -f switch not effective ?
3. How to make this code work? !!
Thanks in advance,
Chakra.
Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com
Buy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in
Change the way you talk. Indiatimes presents Valufon, Your PC to Phone service with clear voice at rates far less than the normal ISD rates. Go to http://www.valufon.indiatimes.com. Choose your plan. BUY NOW.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/