In order to compile the driver, it is necessary to have the Linux Kernel source tree.
Assuming the sources are at /lib/modules/<kernel-version>, the following Makefile will compile the file driver.c into the driver.ko Kernel Object
obj-m := driver.o
KDIR := /lib/modules/$(shell uname -r)/bu...