LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-04-2011, 09:49 AM   #1
Pouyaaa
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Rep: Reputation: Disabled
Cannot compile a simple driver module


I'm newbie at driver module programming.... I've written a very simple hello world module then I wanna compile it , I got this result :
Code:
make -C /lib/modules/2.6.38-8-generic/build M=/root/ker modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.38-8-generic'
make[1]: Makefile: No such file or directory
make[1]: *** No rule to make target `Makefile'.  Stop.
make[1]: Leaving directory `/usr/src/linux-headers-2.6.38-8-generic'
make: *** [all] Error 2
Also I've installed linux headers via following command
Code:
apt-get install linux-headers-2.6.38-8-generic
here is my Makefile file
Code:
obj-m += hello.o

all:
        make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules

clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
Also I gotta note that , the "build" is not exist at that folder

my source code :

Code:
#include <linux/module.h>
#include <linux/kernel.h>
 
int init_module(void)
{
        printk(KERN_INFO "init_module() called\n");
        return 0;
}
 
void cleanup_module(void)
{
        printk(KERN_INFO "cleanup_module() called\n");
}
thanks
 
Old 12-04-2011, 12:15 PM   #2
Pouyaaa
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
No one ? plz .... It's so important
 
  


Reply



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
[SOLVED] cannot compile a driver module anurupr Linux - Software 9 01-24-2011 07:35 AM
Can compile simple driver. sulacco Programming 2 01-26-2009 02:04 PM
Could not compile sample driver module in Suse 10.3 pranav_patil Linux - Kernel 4 06-20-2008 08:56 AM
creating a simple module(device driver) pessanimahi Linux - Software 1 09-16-2003 11:34 AM

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

All times are GMT -5. The time now is 11:45 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