[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: error in loading the module
thts not all the build system for kernel modules has changed in 2.6
Check Some articles on the net as to how to build modules for the kernel
one place i can suggest is www.lwn.net
-SIGTERM
amit
-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx
[mailto:kernelnewbies-bounce@xxxxxxxxxxxx]On Behalf Of Anandraj
Sent: Wednesday, April 07, 2004 7:19 PM
To: 'Pankaj'; 'kernelnewbies'
Subject: RE: error in loading the module
Hi,
Well in 2.6 kernels the kernel module files will have the extension .ko not
a .o file
So try doin a insmod hello.ko
HTH
Anand
> -----Original Message-----
> From: kernelnewbies-bounce@xxxxxxxxxxxx
> [mailto:kernelnewbies-bounce@nl.
> linux.org]On Behalf Of Pankaj
> Sent: Wednesday, April 07, 2004 6:49 PM
> To: kernelnewbies
> Subject: error in loading the module
>
>
> hi,
> I have just started to learn Kernel Module Programming from
> Linux kernel
> Module Programming Guide.But I am facing a problem in loading
> the module
> in the kernel.
> The code is as follows:
>
> /* hello.c */
> #include<linux/module.h>
> #include<linux/kernel.h>
> #include<linux/init.h>
> //#define MODULE
> //#define __KERNEL__
> static int hello_init(void){
> printk(KERN_ALERT "loaded in the kernel\n");
> return 0 ;
> }
>
> static void hello_exit(void){
> printk(KERN_ALERT "successfully unloaded\n");
> }
> module_init(hello_init);
> module_exit(hello_exit);
>
>
> The source file is hello.c
> The kernel version against which it is compiled is : 2.6.4
> The kernel against which it is loaded is : 2.6.4
> The command and command line options used for compiling are
> as follows:
>
> gcc -o2 -c hello.c -Wall -DMODULE -D__KERNEL__
> -isystem/lib/modules/`uname -r`/build/include
>
> But when i try to load the module in the kernel it gives the following
> error :
>
> No module found in object
> insmod : error inserting 'hello.o ' : -1 invalid module format
>
> Am I missing something ?
>
> Thanks in advance.
>
> Regards,
> Pankaj
>
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/