On Sat, 02 May 2020 23:46:08 +0530, Majji SankaraRao said:

> I want to practice writing modules in Linux version 5.3.0-51-generic.
> So please guide me by providing related documentation/Steps.

Create two functions, one for initializing your module, and one for cleaning up 
at exit.

static int __init init_my_module(void)
{
        printk(KERN_DEBUG "Hello World!\n");
}

static void __exit exit_my_module(void)
{
        printk(KERN_DEBUG "Say goodnight, Gracie\n");
}
module_init(init_my_module);
module_exit(exit_my_module);

Everything else isn't how to write a module, it's about how to write whatever
code is needed for the function you're trying to add, whether it's a file
system, or a new netfilter target, or a device driver, or a network congestion
control module, or whatever...

And that code basically doesn't care if it's a module or if it's built in to
the kernel.

So the question becomes:  What did you want to do inside the kernel?

Attachment: pgpcxlibfu2cL.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to