LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 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: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 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: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 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



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
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

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

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