Hello World Device Driver
hello_world.c: #include<linux/module.h> #include<linux/init.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("EMBEDDED GURUJI"); static int hello_init(void) { printk("Hello World\n"); return 0; } static void hello_exit(void) { printk("Bye World\n"); } module_init(hello_init); module_exit(hello_exit); Makefile: obj-m := hello_world.o KERNELDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) all : $(MAKE) -C $(KERNEL) M=$(PWD) modules clean: $(MAKE) -C $(KERNEL) M=$(PWD) clean Now we will understand the code line by line #include<linux/module.h> #include<linux/init.h> These header files contains the definition of the module_init() and module_exit() functions. MODULE_LICENSE("GPL"); MODULE_LICENSE() informs the kernel the license used by the source code,which will affect the functions it can access from the kernel.MO...