Problem in compiling a kernel module

Prashant Shah pshah.mumbai at gmail.com
Sun Jul 10 01:33:38 EDT 2011


Hi,

On Sun, Jul 10, 2011 at 10:07 AM, Ponkumaran Annadurai
<aspkumaran at gmail.com> wrote:
>  I am trying to compile a sample hello world module, but when issue make
> command, it says that "make: Nothing to be done for `all'.".  Also I tried

This is the sample Makefile that I use :

You need to replace the first line with the corresponding name of your
module file. My module file is testmod.c

Also just type "make" and that should do the job.

------------------- Makefile --------------------------
obj-m += testmod.o

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

default:
	        $(MAKE) -C $(KERNELDIR) M=$(PWD)

clean:
	        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

depend .depend dep:
	        $(CC) $(CFLAGS) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))
	include .depend
endif

------------------------------------------------------------------



More information about the Kernelnewbies mailing list