LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 09-30-2007, 08:58 AM   #1
SPo2
Member
 
Registered: Jun 2005
Posts: 88

Rep: Reputation: 15
Guide needed in device driver / module compilation.


Hi;

i am learning device driver / module coding for linux,
after browsing some web page, i get a test code below;

i faced an error while i try compile it in my
Mandriva 2006 KDE terminal using $ gcc <filename>


#include <linux/module.h>

int init_module(void)
{
printk("test test");
return 0;
}

void cleanup_module(void)
{
printk("------");
}


& i get these messages etc

In file included from /usr/include/linux/sched.h:11,
from /usr/include/linux/module.h:9,
from d.c:2:
/usr/include/linux/jiffies.h:84: error: syntax error before 'jiffies_64'
/usr/include/linux/jiffies.h:88: error: syntax error before 'get_jiffies_64'
/usr/include/linux/jiffies.h: In function 'timespec_to_jiffies':
/usr/include/linux/jiffies.h:320: error: called object 'u64' is not a function
/usr/include/linux/jiffies.h:320: error: called object 'u64' is not a function
/usr/include/linux/jiffies.h:320: error: 'NSEC_PER_SEC' undeclared (first use in
this function)
/usr/include/linux/jiffies.h:320: error: (Each undeclared identifier is reported
only once

blah blah.....



Is it that i have to place a kernel source in /usr/src/linux or the path where the package will auto unpack itself in?

If so, say if i'm using kernel 2.6.10, do i have to unpack a same kernel version or i can use a newer version?


Any Advise is helpful.
thanks
 
Old 09-30-2007, 12:18 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by SPo2 View Post
i faced an error while i try compile it in my
Mandriva 2006 KDE terminal using $ gcc <filename>
You canít just compile like that. My recommendation is to use a Makefile that utilizes the kernel build system (on which there are plenty previous posts).
 
  


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 in inserting a device driver module rajesh_b Programming 5 05-10-2007 12:20 AM
Device Driver Writing Guide SJD Linux - Hardware 1 04-11-2007 12:01 PM
How do you list the driver module used by a device? Timshel Linux - Hardware 3 02-13-2006 10:23 PM
Device Driver Compilation on 9.0 softcse Linux - Software 1 08-21-2004 12:03 PM
Installing a device driver as a Module lehumphr Linux - Newbie 1 04-27-2004 11:31 PM


All times are GMT -5. The time now is 01:44 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration