Here are some kernel modules I've written and eddited (The ones I've eddited are licensed for someone else which is mentioned in code comments) for Operating System Course. Manipulate Make files accordingly and use
$ sudo make
for compiling and use
$ sudo insmod "module_name"
for module registration in kernel.