Re: kernel module compilation probs on RHL7.3.

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

 



Bingo! I could compile the code successfully for the first time!
Thank you very much Bill!

Another small query: I do get warnings "implicit declaration of
function `module_register_chrdev`" and for
`module_unregister_chrdev`. How do I avoid it?

Again, thanks Bill for your help!

Atul.

On Thu, 18 Jul 2002 05:40 -0400, Bill Kerr wrote:

u> You must have the 'include' directory in your -I switch path, e.g.,
u>
u>    gcc -Wall -O2 -c -I/usr/src/linux/include mymodule.c
u>
u> The -O2 switch is needed for compiling kernel modules as many kernel
u> functions are implemented as inline C functions.  With lower levels
u> of optimization, the compiler will generate *calls* to the (nonexistant)
u> external functions instead of generating the inline code.
u>
u> BTW, a convention I've established the first few lines of modules
u> compilied outside the kernel source tree is:
u>
u> #ifndef __KERNEL__
u> #define __KERNEL__
u> #endif
u>
u> #ifndef MODULE
u> #define MODULE
u> #endif
u>
u> /* determine whether to use checksummed versions of kernel symbols */
u> #include <linux/config.h>
u> #ifdef CONFIG_MODVERSIONS
u> #define MODVERSIONS
u> #include <linux/modversions.h>
u> #endif
u>
u> /* modversions.h redefines kernel symbols.  Now include other headers */
u> #include <linux/kernel.h>
u> #include <linux/module.h>
u> #include <linux/init.h>
u>
u>
u>
u>  -- bilker
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