![]() |
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"); } |
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. |
Quote:
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: |
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 01:19 PM. |