1) hello_driver.c program which conatins the init and exit functions /* This is my first driver module program */ #include<linux/init.h> #include<linux/module.h> #include<linux/kernel.h> static int __init hello_init(void) { printk(KERN_ALERT "Hello my first module \n"); return 0; } static void __exit hello_exit(void) { printk(KERN_ALERT "Good Bye \n"); } module_init(hello_init); module_exit(hello_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Hello world Module"); MODULE_AUTHOR("SURENDRA PATIL"); 2) Make file for the module ifneq ($(KERNELRELEASE),) obj-m := hello_driver.o else KDIR ?= /lib/modules/$(shell uname -r)/build PWD :=$(shell pwd) default: ...
Happy learning.