LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   make[1]: *** No rule to make target `modules'. Stop. (https://www.linuxquestions.org/questions/linux-newbie-8/make%5B1%5D-%2A%2A%2A-no-rule-to-make-target-%60modules-stop-900366/)

mswamy78 08-31-2011 02:44 AM

make[1]: *** No rule to make target `modules'. Stop.
 
I get following error when I compile my module...

make[1]: Entering directory `/usr/src/linux'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/usr/src/linux'
make: *** [default] Error 2

My Makefile

obj-m := uvcvideo.o
uvcvideo-objs := uvc_driver.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean


#uname -a
Linux lucid-desktop 2.6.35.3-744-g27fdf7b #1 PREEMPT Thu Jan 27 15:10:16 CST 2011 armv7l GNU/Linux

Also I found /lib/modules/'uname -r' is pointing to /usr/src/linux

But under /usr/src/linux, except include folder there is no other folder present...

Please suggest

knudfl 08-31-2011 03:23 AM

sudo apt-get install linux-image-`uname -r` linux-headers-`uname -r`

Or use Synaptic to find a package "linux-headers" with an exact match
of your current "linux-image".

"linux-headers" is the package, that provide /usr/src/linux/include/<headers>

If you also get a new linux-image : Reboot to use it.

.

mswamy78 08-31-2011 05:13 AM

Thanks for the reply.


I tried to download it...it is giving me error. My network is fine as I am able to download other things.

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package linux-image-2.6.35.3-744-g27fdf7b

I noticed that there are files under /usr/src/linux/include/
lucid@lucid-desktop:/usr/src/linux/include$ ls
asm asm-generic drm linux mtd rdma scsi sound video xen

In my Makefile the following line actually points to /usr/src/linux which is actually a link
KDIR := /lib/modules/$(shell uname -r)/build

even i tried to modify like this...KDIR := /usr/src/linux
Still no luck.

Please suggest

knudfl 08-31-2011 05:23 AM

linux-image-2.6.35.3-744-g27fdf7b : Is not a kernel supplied by Ubuntu.


If you created "2.6.35.3-744-g27fdf7b" yourself, then the source package
"linux-2.6.35.3-744-g27fdf7b/" can be used for the module build.

mswamy78 08-31-2011 05:45 AM

I am using the source package for the compilation now..I changed KDIR as following in Makefile

obj-m := uvcvideo.o
uvcvideo-objs := uvc_driver.o
KDIR := /usr/src/linux-2.6.35.3-744-g27fdf7b
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean

But I still get following error..Please let me know what to do?

make[1]: Entering directory `/usr/src/linux'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/usr/src/linux'
make: *** [default] Error 2

bsat 09-01-2011 10:26 AM

What is the name of your source file , if it is only one file you can just use
obj-m := "source_filename".o

mswamy78 09-02-2011 12:15 AM

Thanks for the reply. It is not a single file, i have multiple files to compile.

bsat 09-02-2011 11:50 PM

[Quote]
obj-m := uvcvideo.o
uvcvideo-objs := uvc_driver.o
[Quote]

But the above lines of code suggest you are trying to compile only uvc_driver.c, do you have a source file by the name uvc_driver.c ?


All times are GMT -5. The time now is 03:54 PM.