LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-10-2010, 09:13 PM   #1
jkim74
LQ Newbie
 
Registered: Oct 2007
Posts: 12

Rep: Reputation: 0
Error while compiling Hello world device driver.


Hello.

I am newbie in linux driver programming and looking at http://www.faqs.org/docs/kernel/index.html
I have tried compiling hello world program on the site but met some errors.
Errors are due to compiler can't find header file.
First error is
--
/lib/modules/2.6.33.5-112.fc13.i686/build/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
--
I have looked into prefetch.h and find
--
#include <asm/processor.h>
--
I have found no folder named asm in the directory where prefetch.h is located but found 3 processor.h file under /usr/src/kernels directory.

I should say I am very newbie in linux driver programming though I have some experience in using unix or linux.
Haven't I done something that I should do?
I am working with Fedora 13

Please answer.
Thanks.

Last edited by jkim74; 06-10-2010 at 09:15 PM.
 
Old 06-11-2010, 07:50 AM   #2
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
First thing i don't get is why do you need asm/processor.h for a simple hello world program. \

If you want to learn module programming i think this might help

http://tldp.org/LDP/lkmpg/2.6/html/index.html
 
Old 06-15-2010, 02:37 PM   #3
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
How do you build your hello world code, using Makefile or something else?
The hello world's Linux loadable module only need two header files, module.h and kernel.h.

/*
* 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");

/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}

void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
 
Old 06-15-2010, 03:23 PM   #4
fruttenboel
Member
 
Registered: Jul 2008
Location: Tilburg NL
Distribution: Slackware 14.2 ciurrent, kernel 3.18.11
Posts: 270

Rep: Reputation: 48
Perhaps you first need to read a few books on programming in general? Here's a nice starting point: http://www.mindviewinc.com/Books/downloads.html
 
  


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
Compiling a device driver only and not the whole kernel... Is this possible? balteo Linux - Kernel 4 11-20-2009 01:25 AM
Problem in compiling a device driver program p.arun Linux - Kernel 4 01-23-2008 01:14 AM
Compiling Device Driver in Linux i_love_linux Linux - Kernel 13 09-04-2007 09:24 AM
compiling raw source code of device driver bishalpoudyal Linux - Hardware 1 04-08-2006 03:09 AM
compiling kernel error - could not open loopback device _invader Linux - Newbie 3 10-08-2004 10:01 AM

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

All times are GMT -5. The time now is 10:52 AM.

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