Hi, Please check out this: http://lwn.net/Articles/21823/ I think you are probably missing KBUILD_BASENAME macro in the compilation. Hope that helps, Regards, KK. On Wednesday 07 April 2004 18:48, Pankaj wrote: > 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/ -- HomePage: http://puggy.symonds.net/~krishnakumar -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/