Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I am using Ubuntu 12.04. I wrote a simple hello world kernel module (hello.c). I wrote the folllowing makefile for it:

KDIR:= /usr/src/linux-headers-3.2.0-24-generic-pae
     $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
     rm -rf *.o *.ko *.mod.* *.symvers *.order 

But this error cropped up when I did make from kernel:

make[1]: Entering directory `/usr/src/linux-headers-3.2.0-24-generic-pae'
make[2]: *** No rule to make target `arch/x86/tools/relocs.c', needed
by `arch/x86/tools/relocs'.  Stop.

hello.c and makefile are in /Documents/module_prog. I ran make from that directory.

What is causing this error and how can I fix it?

share|improve this question

1 Answer 1

In the make file, just change SUBDIRS=$(PWD) into M=$(shell pwd)...

Works like charm

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.