Re: kernel module compilation probs on RHL7.3.

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

 



Got the compilation problem fixed. Heartfelt thanks to all those
who responded to my post and helped me!

Atul.

On Thu, 18 Jul 2002 15:22 +0530, Atul Sowani wrote:

u> Bingo! I could compile the code successfully for the first time!
u> Thank you very much Bill!
u>
u> Another small query: I do get warnings "implicit declaration of
u> function `module_register_chrdev`" and for
u> `module_unregister_chrdev`. How do I avoid it?
u>
u> Again, thanks Bill for your help!
u>
u> Atul.
u>
u> On Thu, 18 Jul 2002 05:40 -0400, Bill Kerr wrote:
u>
u> u> You must have the 'include' directory in your -I switch path, e.g.,
u> u>
u> u>    gcc -Wall -O2 -c -I/usr/src/linux/include mymodule.c
u> u>
u> u> The -O2 switch is needed for compiling kernel modules as many kernel
u> u> functions are implemented as inline C functions.  With lower levels
u> u> of optimization, the compiler will generate *calls* to the (nonexistant)
u> u> external functions instead of generating the inline code.
u> u>
u> u> BTW, a convention I've established the first few lines of modules
u> u> compilied outside the kernel source tree is:
u> u>
u> u> #ifndef __KERNEL__
u> u> #define __KERNEL__
u> u> #endif
u> u>
u> u> #ifndef MODULE
u> u> #define MODULE
u> u> #endif
u> u>
u> u> /* determine whether to use checksummed versions of kernel symbols */
u> u> #include <linux/config.h>
u> u> #ifdef CONFIG_MODVERSIONS
u> u> #define MODVERSIONS
u> u> #include <linux/modversions.h>
u> u> #endif
u> u>
u> u> /* modversions.h redefines kernel symbols.  Now include other headers */
u> u> #include <linux/kernel.h>
u> u> #include <linux/module.h>
u> u> #include <linux/init.h>
u> u>
u> u>
u> u>
u> u>  -- bilker
u> u>
u> u>



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@redhat.com
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux