[PLUG] Inserting module in 2.4.20-8

Yogesh Chaudhari yachaudhari at gmail.com
Thu Dec 6 22:38:54 PST 2007


Hi Jayesh,

I'm not sure, but this should work. I'd done it long before.*

Try this

insmod hello1.o
*
_____________________________________________________________________________________________

Yogesh Chaudhari


On Dec 7, 2007 11:19 AM, Jayesh Agrawal <jayeshleo at gmail.com> wrote:

> Hello !
>
>  I have written a hello.c program
> #define MODULE
> #define LINUX
> #define __KERNEL__
>
> #include<linux/init.h>
> #include<linux/module.h>
> #include<linux/kernel.h>
> #include<linux/config.h>
>
>
>
> int init_module(void)
> {
> printk("<1> Hello World 1.\n");
> return 0;
> }
>
> void cleanup_module(void)
> {
> printk("<1> Bye World");
> }
>
> I have also written a Makefile for it...
>
> TARGET := hello
> WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
> INCLUDE := -isystem /lib/modules/'uname -r'/build/include
> CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
> CC := gcc
>
> ${TARGET}.o: ${TARGET}.c
>
> .PHONY: clean
>
> clean:
> rm -rf ${TARGET}.o
>
> Can anybody please tell me the steps to insert the module in the
> kernel. so that if i do dmesg on terminal it should say "Hello
> World"..Tell me corrections if any in the above two programs... I was
> able to compile to make hello-1.o file.
>
> This is what i am getting
>
> [root at localhost root]# insmod ./hello-1.o
> ./hello-1.o: kernel-module version mismatch
>        ./hello-1.o was compiled for kernel version 2.4.20
>        while this kernel is version 2.4.20-8smp.
>
>
> Thanks.
>
> --
> ______________________________________________________________________
> Pune GNU/Linux Users Group Mailing List:      (plug-mail at plug.org.in)
> List Information:  http://plug.org.in/cgi-bin/mailman/listinfo/plug-mail
> Send 'help' to plug-mail-request at plug.org.in for mailing instructions.
>



-- 
__________________________________________________________________________________________________________
Whoever u be...
Whatever u achieve in life...
But u are always remembered for ur last performance....

Thinking is the hardest job. Maybe that's why so few people think

Yogesh Chaudhari
Cell : +91-93252-18837


More information about the plug-mail mailing list