Okay so I have posted a number of Linux kernel programming videos over at my YouTube channe , however I find that I need a place to post a sample code and the make file to build a module.   So here it is.  The Makefile     obj-m := solidusmodule.o   KERNEL_DIR = /lib/modules/3.2.0-25-generic/build PWD := $(shell pwd) all:  $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules  clean:  rm -rf *.o *.ko *.mod.* *.symvers *.order *~        #include  #include  #include       // file_operations structure- which of course allows use to open/close,read/write to device #include       //this is a char driver; makes cdev available #include  //used to access semaphores; sychronizatoin behaviors #include      //copy_to_user;copy_from_user   //(1) Create a structure for our fake device struct fake_device {  char data[100];  struct semaphore sem; } virtual_device;  //(2) To later register our device we need a cdev object and some other variables struct cdev *mcdev; //m stands 'my' int major_number;...
I blog to share what I know and have experienced with others.