LinuxQuestions.org
Register a domain and help support LQ
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
 
LinkBack Search this Thread
Old 12-04-2012, 06:46 AM   #1
ktnamus
LQ Newbie
 
Registered: Dec 2012
Posts: 10

Rep: Reputation: Disabled
module compilation problem


i am using ubuntu 12.04 with linux
3.2.0.23-generic.
i tried to compile mymodule.c
using make command.suggest me for the error occurred as below:

root@ubuntu:~# cd m
module/ mymodule.c
root@ubuntu:~# cp mymodule.c /root/module/
root@ubuntu:~# cd module/
root@ubuntu:~/module# ls
mymodule.c
root@ubuntu:~/module# gedit mymodule.c
root@ubuntu:~/module# gedit makefile
root@ubuntu:~/module# make
make -C /lib/modules/3.2.0-23-generic/build M=/root/module modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-23-generic'
scripts/Makefile.build:44: /root/module/Makefile: No such file or directory
make[2]: *** No rule to make target `/root/module/Makefile'. Stop.
make[1]: *** [_module_/root/module] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-23-generic'
make: *** [all] Error 2
 
Old 12-04-2012, 08:13 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2013.07, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,219

Rep: Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380
Welcome to LQ.

Looks like you have no Makefile.
The Makefile must be in the same folder as mymodule.c

A Makefile that works :
Code:
 
obj-m    := mymodule.o

KDIR    := /lib/modules/$(shell uname -r)/build
PWD    := $(shell pwd)

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

Last edited by knudfl; 12-04-2012 at 08:25 AM.
 
Old 12-05-2012, 09:38 PM   #3
ktnamus
LQ Newbie
 
Registered: Dec 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
i copied makefile as you given. it gives same error like this:-
$make
make -C /lib/modules/3.2.0-23-generic/build SUBDIRS= modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-23-generic'
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[2]: *** No rule to make target `kernel/bounds.c', needed by `kernel/bounds.s'. Stop.
make[1]: *** [prepare0] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-23-generic'
make: *** [default] Error 2

Last edited by ktnamus; 12-05-2012 at 09:41 PM.
 
Old 12-06-2012, 03:21 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2013.07, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,219

Rep: Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380
# 3 . Suggest : Install the package 'linux-source-3.2.0'.

Instead of setting up the source to build against,
you could try with a copy of bounds.c from
/usr/src/linux-source-3.2.0/linux-source-3.2.0.tar.bz2 :

sudo cp bounds.c /usr/src/linux-headers-3.2.0-23-generic/kernels/
 
Old 12-07-2012, 11:45 PM   #5
ktnamus
LQ Newbie
 
Registered: Dec 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
thanks.
but it is not for only bound.c, it is also showing this msg for other files.
and so, what is the difference remains between source and header files?

Last edited by ktnamus; 12-07-2012 at 11:47 PM.
 
Old 12-08-2012, 04:19 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2013.07, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,219

Rep: Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380
# 5 : The package 'linux-headers-* ' : Provides files.h only.

And 'linux-source-3.2.0' : The full kernel source code,
i.e. files.h, files.c .
 
Old 12-09-2012, 04:53 AM   #7
posix04
Member
 
Registered: Dec 2012
Posts: 32

Rep: Reputation: Disabled
Install the build-essential metapackage too.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fglrx module compilation problem w1k0 Slackware 13 02-07-2009 03:30 AM
Kernel module compilation problem marcintom Programming 0 01-28-2009 06:50 PM
Problem with module compilation: RT61_Linux_STA_Drv1.0.4.0 EnigmaX Linux - Wireless Networking 0 11-10-2006 06:17 PM
Apache module compilation problem the-chains Linux - Software 1 07-22-2004 11:20 AM
NICdriver/module compilation problem pPcG5 Linux - Networking 0 09-11-2003 05:10 AM


All times are GMT -5. The time now is 08:18 AM.

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