The beginning
I recently got into kernel module programming along with my friend Rohit. We were following the tutorial here and we stumbled upon an error.
The Error
When running sudo make
, we got :
This is the Makefile we were using as given on the tutorial :
The Reason
At last we had to look the output ourselves.
You can notice that M is getting no value. (See M= in the first output line of make.)
That means M=$(PWD)
in the Makefile is wrong. It would have worked if PWD had been defined in the shell beforehand. But this is not so, we need to replace it with something that returns the present working directory (PWD).
The Solution
That can be done perfectly with $(shell pwd)
. So just replace M=$(PWD)
with M=$(shell pwd)
in the Makefile
.
Worked perfectly for me. Hope it saves some time for you.
Thanks for reading. Do comment.