Change the name of module without changing the name of source file

Suppose, you have a simple module file with name 'hello.c', you will write a Makefile without the following:

obj-m := hello.o

And it will create a hello.ko for you on running "make" command. What if you want the name as 'linux.ko' and don't want to rename the 'hello.c' to 'linux.c'.

You need to update the Makefile using 'filename'-objs, for example to get 'linux.ko' from 'hello.c' file, the Makefile should be :


Output:



Comments

Popular posts from this blog

Appending and Prepending in Yocto - +=, =+ vs .=, =.

ARM interview questions

Linux driver example for Per CPU Variable