Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 10-10-2008, 02:39 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
Getting errors while compiling kernel module in fedora 9-pls help

I am using fedora 9 installed using VMware and just tried to compile below written module using the gcc compiler.

The sample code is not compliing and the error reported are
[pols@localhost module1]$ gcc -O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -I /lib/modules/$(shell uname -r)/build $(shell pwd) -c -o hello-1.o hello-1.c

bash: shell: command not found
bash: shell: command not found
hello-1.c:8:55: error: linux/module.h: No such file or directory
hello-1.c:17: warning: no previous prototype for ‘init_module’
hello-1.c: In function ‘init_module’:
hello-1.c:19: warning: implicit declaration of function ‘printk’
hello-1.c: At top level:
hello-1.c:24: warning: no previous prototype for ‘cleanup_module’
hello-1.c: In function ‘cleanup_module’:
hello-1.c:26: error: ‘KERN_ALERT’ undeclared (first use in this function)
hello-1.c:26: error: (Each undeclared identifier is reported only once
hello-1.c:26: error: for each function it appears in.)
hello-1.c: At top level:
hello-1.c:30: error: expected declaration specifiers or ‘...’ before string constant
hello-1.c:30: warning: data definition has no type or storage class
hello-1.c:30: warning: type defaults to ‘int’ in declaration of ‘MODULE_LICENSE’
hello-1.c:30: warning: function declaration isn’t a prototype

The program is :

#define MODULE
#define LINUX
#define __KERNEL__

#include <linux/module.h> /*Nedded for all modules */

#include <linux/modversions.h>

#include <linux/kernel.h> /* Needed for KERN_ALERT*/

int init_module(void)
printk("<1> Hello world 1 \n");

return 0;

void cleanup_module(void)
printk(KERN_ALERT,"Goodbye world 1 \n");


I saw in the /usr/include/linux and did not find the file "module.h"
but i found module.h in the below path

[pols@localhost ~]$ cd /usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.noarch/include/linux/module.h

Please help me in this. Am very much interested in learning kernel programming but i hanged here..


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling kernel help needed pls. kernel99 Linux - Newbie 4 09-17-2008 12:34 AM
Received Warnings and errors while compiling the Fedora Linux kernel ahm_irf Linux - General 0 03-06-2007 06:26 AM
Errors when compiling vmware-server module hondo Linux - Software 5 02-02-2007 04:04 PM
errors while compiling a module sanddune008 Linux - Kernel 3 12-06-2006 10:28 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration