Hi All,
I am new to linux.
I have written a small kernel module, which is having only 'printk' in
init_module and cleanup_module.
Configuration: RHEL 3- Linux kernel 2.4.21-27.EL
snippet:
/*************************************/
#include <linux/kernel.h>
#include <linux/module.h>
int init_module()
{
printk("<1>Hello\n");
return 0;
}
void cleanup_module()
{
printk("<1>bye\n");
}
/**************************************/
Following is the screenshot of compilation process:
[root@localhost root]# gcc -Wall -O2 -D__KERNEL__ -DMODULE
-I/usr/src/linux-2.4.21-27.EL/include/ hello.c
/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18):
In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
[root@localhost root]#
/***************************************/
why this is referring to 'main' even though I have not written any
main() function in hello.c.
I could not figure out the problem.
I will be thankful for your valuable suggestions.
Thanks,
Panthini
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/