LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-25-2007, 12:25 PM   #1
vijeesh_ep
Member
 
Registered: Jul 2004
Location: India
Distribution: Redhat-8
Posts: 35

Rep: Reputation: 15
Red face 2.6 kernel compilaton issue with header files


Hi All

I have a simple kernel module
Code:
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/module.h>
int
DevModInit (void)
{
    printk ("hello\n");
    return 0;
}
void
DevModDeInit (void)
{
    printk ("world\n");
    return;
}

module_init (DevModInit);

module_exit (DevModDeInit);
Which I am able to compile properly using

cc test.c -c -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4.20-8smp/include/

But When I try to compile the same code using the 2.6 kernel using the above step, I am getting a lot of errors in the kernel header files like

/usr/src/linux-2.6.18/include/linux/jiffies.h: In function `jiffies_to_msecs':
/usr/src/linux-2.6.18/include/linux/jiffies.h:259: `CONFIG_HZ' undeclared (first use in this function)
/usr/src/linux-2.6.18/include/linux/jiffies.h:265:46: division by zero in #if


I have to write a Makefile which should be common for 2.4 and 2.6 kernel. My aim is to create a "module.o" in both the cases and convert it to "module.ko" in the case of 2.6. Is it possibe to do so?. Also please provide any pointers for the implementation(I am planning to use the kbuild functionality of 2.6 to convert "module.o" to "module.ko

Thanks for your help
Regards
Vijeesh
 
  


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
Kernel header files tristanlee85 Linux - Software 4 07-09-2006 05:42 PM
What!? Kernel header files too old? LinuxLuvr Linux From Scratch 2 06-20-2005 09:43 AM
DISCUSSION: Custom kernel compilaton on RedHat/Fedora Systems Thetargos LinuxAnswers Discussion 2 08-28-2004 06:11 PM
Kernel Header Files? kholdstayr Slackware 1 12-22-2003 05:45 PM
where are the kernel header files? vance Linux - Software 5 03-05-2002 02:51 AM


All times are GMT -5. The time now is 05:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration