* Reg : Writing modules in new Linux versions
@ 2020-05-02 18:16 Majji SankaraRao
2020-05-02 20:07 ` Valdis Klētnieks
0 siblings, 1 reply; 4+ messages in thread
From: Majji SankaraRao @ 2020-05-02 18:16 UTC (permalink / raw)
To: Kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 177 bytes --]
Hi All,
I want to practice writing modules in Linux version 5.3.0-51-generic.
So please guide me by providing related documentation/Steps.
Thanks in advance,
SankaraRao Majji
[-- Attachment #1.2: Type: text/html, Size: 274 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reg : Writing modules in new Linux versions
2020-05-02 18:16 Reg : Writing modules in new Linux versions Majji SankaraRao
@ 2020-05-02 20:07 ` Valdis Klētnieks
[not found] ` <CAE6-iZ1se+gmpaDN1utJJPw0MnZD-+DNxc0oMYQyrdZqp6Lf2g@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Valdis Klētnieks @ 2020-05-02 20:07 UTC (permalink / raw)
To: Majji SankaraRao; +Cc: Kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 968 bytes --]
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 #1.2: Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reg : Writing modules in new Linux versions
[not found] ` <CAE6-iZ1se+gmpaDN1utJJPw0MnZD-+DNxc0oMYQyrdZqp6Lf2g@mail.gmail.com>
@ 2020-05-04 8:37 ` Majji SankaraRao
2020-05-04 9:05 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Majji SankaraRao @ 2020-05-04 8:37 UTC (permalink / raw)
To: Valdis Klētnieks; +Cc: Kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 2117 bytes --]
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@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@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?
>>
>
[-- Attachment #1.2: Type: text/html, Size: 3010 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reg : Writing modules in new Linux versions
2020-05-04 8:37 ` Majji SankaraRao
@ 2020-05-04 9:05 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-05-04 9:05 UTC (permalink / raw)
To: Majji SankaraRao; +Cc: Valdis Klētnieks, Kernelnewbies
On Mon, May 04, 2020 at 02:07:06PM +0530, Majji SankaraRao wrote:
> Hi,
>
> Please suggest some IDE's to Linux code navigation and development
> if possible.
Any one you want to use should be fine. Pick your favorite one and go
at it.
Remember, there are not specific requirements to use an IDE at all, a
huge majority of kernel developers do not use one at all.
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-04 9:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02 18:16 Reg : Writing modules in new Linux versions Majji SankaraRao
2020-05-02 20:07 ` Valdis Klētnieks
[not found] ` <CAE6-iZ1se+gmpaDN1utJJPw0MnZD-+DNxc0oMYQyrdZqp6Lf2g@mail.gmail.com>
2020-05-04 8:37 ` Majji SankaraRao
2020-05-04 9:05 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.