LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-14-2013, 12:02 PM   #1
Amit Rakshe
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Rep: Reputation: Disabled
Makefile


Hii,
I am new at this forum & i want to develope device driver & i am referring book linux device driver by Jonathan Corbet, Alessandro
Rubini, and Greg Kroah-Hartman

i read 1st module of it of hello world in that i still didnt get how exactly makefile works & i get the error:
make -C /usr/src/linux-headers-3.8.0.29-generic SUBDIRS-/home/amit/modules modules
make: *** /usr/src/linux-headers-3.8.0.29-generic: No such file or directory. Stop.
make: *** [all] Error 2
Please help me!!
thanks.
 
Old 10-14-2013, 12:17 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
and /usr/src/linux-headers-3.8.0.29-generic exists?
 
1 members found this post helpful.
Old 10-14-2013, 12:17 PM   #3
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 88
It appears to be telling you that it can't find (a particular version of) the kernel headers. I'm assuming 3.8.0.29-generic is your running version (uname -r). And what do you see if you type ls /usr/src?

If you're on Debain or Ubuntu, you can install the headers for your current kernel with sudo apt-get install linux-headers-$(uname -r).
 
Old 10-14-2013, 12:26 PM   #4
Amit Rakshe
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for reply,
when i typed ls/usr/src it shows:
linux-headers-3.8.0-29 linux-headers-3.8.0-29-generic
& my running distribution is ubuntu 12.04

Last edited by Amit Rakshe; 10-14-2013 at 12:30 PM.
 
Old 10-14-2013, 12:32 PM   #5
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 88
Quote:
Originally Posted by Amit Rakshe View Post
linux-headers-3.8.0-29-generic
It looks like it's a typo in the options being passed to make. The ls command is showing that the directories in /usr/src have a hypen between 0 and 29, while the error message shows a dot.
 
Old 10-14-2013, 12:40 PM   #6
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by Robhogg View Post
It looks like it's a typo in the options being passed to make. The ls command is showing that the directories in /usr/src have a hypen between 0 and 29, while the error message shows a dot.
Ha. Such an Ubuntu thing to do. Can't believe that I missed that.
 
Old 10-15-2013, 09:48 AM   #7
Amit Rakshe
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for reply,
I got little bit idea, still can u furnish what exact makefile does when we build our module & how it is related to code for example:
obj += hello.o
 
Old 10-15-2013, 10:32 AM   #8
Amit Rakshe
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
hi friends,
now i tried something different, creted folder naming modules in home directory after that copy pasted code from book of hello.c & created Makefile as follows:

obj-m += hello.o

KDIR := /lib/modules/3.8.0-31-generic/build
PWD := /home/amit/

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules


also typed command as follows:

1.root@amit-Inspiron-1464:/home/amit/modules# pwd
/home/amit/modules

2.root@amit-Inspiron-1464:/home/amit/modules# uname -r
3.8.0-31-generic

3.root@amit-Inspiron-1464:/home/amit/modules# make
make -C /lib/modules/3.8.0-31-generic/build SUBDIRS=/home/amit/ modules
make[1]: Entering directory `/usr/src/linux-headers-3.8.0-31-generic'
scripts/Makefile.build:44: /home/amit/Makefile: No such file or directory
make[2]: *** No rule to make target `/home/amit/Makefile'. Stop.
make[1]: *** [_module_/home/amit] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-31-generic'
make: *** [default] Error 2

please someone help m, i m waiting !!!!!!!!
 
Old 10-15-2013, 11:54 AM   #9
Amit Rakshe
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
finally i got the solution!!!!!
 
  


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
[SOLVED] [makefile] How to apply bash env to Makefile? poplinux Programming 2 06-19-2012 02:55 AM
[SOLVED] need of makefile info ? how the linux make file is different from simple c makefile ? rpittala Linux - Newbie 2 05-07-2012 09:04 PM
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp narender.d Linux - Kernel 3 05-29-2009 07:26 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 04:57 AM


All times are GMT -5. The time now is 01:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration