Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-25-2007, 11:25 AM   #1
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
DevModInit (void)
    printk ("hello\n");
    return 0;
DevModDeInit (void)
    printk ("world\n");

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


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

All times are GMT -5. The time now is 11:55 AM.

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
Open Source Consulting | Domain Registration