Thursday, 10 October 2013

Basic program to make the module in Kernel Space and add it into the process

Write the program with the file extension ".c" . After that, make the Makefile. Then execute the Makefile by writing make. after that insert the module in the Process by writing insmod <filename>.ko . Then check the Kernel module by writing the command dmesg|less. For removing the module from the Process write rmmod <filename>.ko.

//basic.c
#include<linux/init.h>
#include<linux/module.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("RAJ");

static int hello_init(void)
{
printk(KERN_ALERT "HELLO , THERE \n");
return 0;

}


static int hello_exit(void)
{
printk(KERN_ALERT "Goodbye everyone i m gonna find u and kill you \n");
return 0;
}

module_init(hello_init);
module_exit(hello_exit);


0 comments:

Post a Comment

Blogroll

Copyright © 2013 RAJ PRAJAPATI (raj@electronicsrj.com)

Comments

About Projects

We also Provide support in making Electronics Projects at different level at Cheapest price. Contact Us for the further help.