LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Error while compiling Hello world device driver. (https://www.linuxquestions.org/questions/linux-kernel-70/error-while-compiling-hello-world-device-driver-813465/)

jkim74 06-10-2010 09:13 PM

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.

bsat 06-11-2010 07:50 AM

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

nini09 06-15-2010 02:37 PM

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");
}

fruttenboel 06-15-2010 03:23 PM

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


All times are GMT -5. The time now is 12:16 PM.