Question

The functions you write to provide procfs interfaces is just code that is part of your LKM source.

http://linux.die.net/lkmpg/x769.html has a simple example using procfs, reproduced here:

I copied the code from above link - You'll find a tutorial for building kernel modules at http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html. The summary of that is:

1) Ensure you have kernel source installed in /usr/src.

2) Create a makefile that looks like:

obj-m = procfs2.o
KVERSION = $(shell uname -r)
all:
        make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
        make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean

3) build the module with the command make 4) load the module into memory with the command insmod procfs2.ko (do this as the root user)

I copied the code and created the MAKEFILE and later if I give the make command from the console then it is showing as : make: nothing to be done for all. could someone please tell me what could be the error ??

Was it helpful?

Solution

Here is an example of a Makefile for a kernel module.

the important thing here to note is that the dots shown below must be replaced by a TAB, replacing them by spaces will cause Makefile to malfunction.

obj-m += hello.o

all:
.......make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
.......make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top