LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-20-2006, 07:31 AM   #1
sanddune008
LQ Newbie
 
Registered: Nov 2006
Posts: 13

Rep: Reputation: 0
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...
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");
}
 
Old 11-20-2006, 08:44 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
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?
 
Old 11-23-2006, 10:27 PM   #3
sanddune008
LQ Newbie
 
Registered: Nov 2006
Posts: 13

Original Poster
Rep: Reputation: 0
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...
 
Old 11-24-2006, 03:38 AM   #4
sanddune008
LQ Newbie
 
Registered: Nov 2006
Posts: 13

Original Poster
Rep: Reputation: 0
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:erroreach 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
 
  


Reply


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
Problem installing module in Fedora Core 2 (2.6 kernel vs 2.4 problem?) Arodef Linux - Kernel 3 11-30-2007 02:55 PM
Problem compiling nmap 3.93 on Fedora Core 4 jekist Linux - Software 2 12-02-2005 12:22 PM
Compiling C in Fedora Core 2 mparsons Linux - Software 7 11-13-2005 11:16 PM
Fedora Core 2---simple question skeyeman Linux - Newbie 3 06-13-2005 11:50 AM
problem with compiling a simple module pele21 Linux - Software 2 04-28-2005 02:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:20 PM.

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