Re: error in loading the module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,
Thanks a lot for your kind guidance .
I was not aware of the change in the build system in kernel-2.5.x series
onwards.
The same code worked with 2.4 series kernel.

Regards,
Pankaj
On Thu, 2004-04-08 at 09:32, Praveen Nair wrote:
> Hi,
>  i don't think that there is any problem with your code
> check the arguments you have passed for gcc, bcoz i don't think
> the .o file is getting generated. Remove the -o2 option and
> i think it will work. bcoz it did at my place.
> 
> -praveen.
> 
> ----- Original Message ----- 
> From: "Pankaj" <pankajd@myrealbox.com>
> To: "kernelnewbies" <kernelnewbies@nl.linux.org>
> Sent: Wednesday, April 07, 2004 6:48 PM
> 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>
> > file://#define MODULE
> > file://#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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux