Hello Friends
I made new simple 'Hello World' module

*  
 *  hello-1.c - The simplest kernel module.
 */
#include <linux/module.h>    /* Needed by all modules */
#include <linux/kernel.h>    /* Needed for KERN_INFO */

int init_module(void)
{
    printk(KERN_INFO "Hello world 1.\n");

    /* 
     * A non 0 return means init_module failed; module can't be loaded. 
     */
    return 0;
}

void cleanup_module(void)
{
    printk(KERN_INFO "Goodbye world 1.\n");
}

then i write Makefile

obj-m += hello-1.o

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

after that i run the make command

after that insmod ./hello-1.ko
module is inserted ok
when i run cat /proc/modules
it shows that my new module is added but with (P) marked ok
when i restart my PC to see weather my module is printing ' Hello World ' or not its not res poncing any thing
when PC completely start again i run /proc/modules
then my newly added module is missing
how to add module permanently in the kernel

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.