LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   problem in compiling a simple module in fedora core 4 (http://www.linuxquestions.org/questions/linux-kernel-70/problem-in-compiling-a-simple-module-in-fedora-core-4-a-503252/)

sanddune008 11-20-2006 07:31 AM

problem in compiling a simple module in fedora core 4
 
hello guys,
i tried compiling a simple module using the following command:
gcc -I/usr/src/kernels/2.6.11-1.1369_FC4-i686/include -o hello.cwithout any sucess...
given below was my program...it would be greatful if u can help me with this...:newbie:
thanxs in advance

* hello-1.c - The simplest kernel module.
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */

int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}

weibullguy 11-20-2006 08:44 AM

Maybe you could post the errors you received? I do see that you passed hello.c to gcc. The first line of the code you posted says,
Code:

hello-1.c - The simplest kernel module.
Is your source filed also called hello-1.c by chance?

sanddune008 11-23-2006 10:27 PM

Quote:

Originally Posted by Arow
Maybe you could post the errors you received? I do see that you passed hello.c to gcc. The first line of the code you posted says,
Code:

hello-1.c - The simplest kernel module.
Is your source filed also called hello-1.c by chance?



well did name the module as hello.c.....the error it reported was regaring KERN not declared ......is it bcos i haven't installed the kernel libraries..if it is so then i would be a great help in finding the correct path to the kernel lib...
Thanxs in advance...:newbie:

sanddune008 11-24-2006 03:38 AM

I guess it dosen't have to do anything with the naming of the file..
these r the errors

hello.c:infunction 'init_module'
hello.c:5:error: 'KERN_INFO' undeclared (first use in this function)
hello.c:5:error:(each undeclared indentifier is repoted only once .
hello.c:5:error:for eac function it appears in)
hello.c:5:error:syntax error before string constant
hello.c:infunction 'cleanup_module'
hello.c:5:error: 'KERN_INFO' undeclared (first use in this function)

this time i tried compiling the module with the command gcc -c hello.c

it would be helpful if i can compile them without using makefile....
i had tried this module with 2.4.18 it did work .....

i did the check under /usr/include for modules.h i never found them is it bcos of this ......

thanxs in advance


All times are GMT -5. The time now is 04:19 PM.