Linux Kernel Driver Program: 1_Hello World
#include<linux/kernel.h>#include<linux/init.h>
#include<linux/module.h>
static int __init hello_world_init(void)
{
printk(KERN_INFO "This is the Simple Module\n");
printk(KERN_INFO "Kernel Module Inserted Successfully...\n");
return 0;
}
void __exit hello_world_exit(void)
{
printk(KERN_INFO "Kernel Module Removed Successfully...\n");
}
module_init(hello_world_init);
module_exit(hello_world_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Neelkanth Reddy <www.neelkanth.13@gmail.com>");
MODULE_DESCRIPTION("A simple hello world driver");
MODULE_VERSION("0:1.0");
neelkanth_surekha#cat Makefile
obj-m += hello_world_module.oKDIR = /lib/modules/$(shell uname -r)/build
all:
make -C $(KDIR) M=$(shell pwd) modules
clean:
make -C $(KDIR) M=$(shell pwd) clean