Reg : Writing modules in new Linux versions

Majji SankaraRao sankar.linux.development at gmail.com
Mon May 4 04:37:06 EDT 2020


Hi,

Please suggest some IDE's to Linux code navigation and development
if possible.

Thanks in advance,
Sankara Rao Majji

On Sun, May 3, 2020 at 10:49 AM Majji SankaraRao <
sankar.linux.development at gmail.com> wrote:

> Hi Valdis,
>
> Thanks for your reply.
>
> With your suggestions I have used the following code to test helloworld
> module and successfully saw "Hello World!' msg with dmesg command.
>
> #include<linux/module.h>
> #include<linux/init.h>
> #include<linux/kernel.h>
>
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Sankar");
> MODULE_DESCRIPTION("Hello World Module");
>
> static int __init helloworld_init(void)
> {
>     printk(KERN_INFO "Hello world!\n");
>     return 0;
> }
>
> static void __exit helloworld_exit(void)
> {
>     printk(KERN_INFO "Cleaning up module.\n");
>     return;
> }
>
> module_init(helloworld_init);
> module_exit(helloworld_exit);
>
>
> BR,
> Sankar
>
> On Sun, May 3, 2020 at 1:37 AM Valdis Klētnieks <valdis.kletnieks at vt.edu>
> wrote:
>
>> 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?
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200504/696bf103/attachment.html>


More information about the Kernelnewbies mailing list