Basic question..
Hi
I am new to kernel programming. I have
just written a module consisting of init and
cleanup
functions. I call init function of the module in kernel initialization function. So when system comes up, it shows that it entered module init function(printk in "init" print some string), but when I do lsmod it is not there in list of modules. But if I do insmod module, the module is listed in lsmod output. So is it that calling init module and insmod are not equivalent?
Thank You
Raghava.
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
Quoted 16 lines · Raghava Raju
Hi
I am new to kernel programming. I have
just written a module consisting of init and
cleanup
functions. I call init function of the module in kernel initialization function. So when system comes up, it shows that it entered module initfunction(printk in "init" print some string), but when I do lsmod it is not there in list of modules. But if I do insmod module, the module is listed in lsmod output. So is it that calling init module and insmod are not equivalent?
Quoted 2 lines
Thank You
Raghava.
If it's built into the kernel (a driver), it's not a module. It won't show when executing lsmod. It also can't be removed. Only drivers inserted as modules show with lsmod.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.
Quoted 11 lines · Raghava Raju
I am new to kernel programming. I have
just written a module consisting of init and
cleanup
functions. I call init function of the module in kernel initialization function. So when system comes up, it shows that it entered module initfunction(printk in "init" print some string), but when I do lsmod it is not there in list of modules. But if I do insmod module, the module is listed in lsmod output. So is it that calling init module and insmod are not equivalent?
this is correct. calling the init function from within the kernel is not the same as using insmod. calling the init function is just that -- calling some linked-in function from within the kernel.
if you want to load a module from within the kernel, what you want is:
#include<linux/kmod.h>
int request_module(const char * module_name);
you will need kmod compiled in.
however, i suppose this is not what you want. if you want to load your code into the kernel -- statically linked -- then its not a module. its a member of the kernel. have fun, enjoy the place.
if you want it to be a module, then its seperate, and you should load it via insmod/modprobe/kmod.
Signature · 3 lines
Robert M. Love rml at ufl.edu rml at tech9.net