When I ran into the problem where when I called make, I would see the following error:
make: *** No rule to make target `kernel/bounds.c', needed by `kernel/bounds.
I chased around the interwebs for a bit. I found out that it looks like $(PWD) wasn't returning the present directory, so I updated it to shell pwd per this site: Labjack Forums
Here is my makefile (note that in front of commands are TABS, if you replace them with spaces your makefile won't work, you've been warned)
obj-m += hello_world.o
KERNELDIR=/lib/modules/$(shell uname -r)/build
make -C $(KERNELDIR) M=$(shell pwd) modules
make -C $(KERNELDIR) M=$(shell pwd) clean
And finally here is my hello world (keep in mind it's pulled from the above tutorial)
* hello_world.c - The simplest kernel module.
/* Needed by all modules */
/* Needed for KERN_INFO */
printk("<1>Hello world 1.\n");
* A non 0 return means init_module failed; module can't be loaded.
printk(KERN_ALERT "Goodbye world 1.\n");
Check it out. and give it a try. hopefully it works for you!
calling make all at the command line should compile it all,
and then a simple sudo insmod hello_world.ko
check out if your module was loaded via lsmod, look for it.
Now check your /var/log/messages file for your alert!
Finally do a sudo rmmod hello_world.ko to remove it from the kernel.
Thank you Caleb for the help various commands and the makefile!