Re: Basic question..

From: Robert Love (rml@tech9.net)
Date: Wed Aug 01 2001 - 16:04:51 EST


On 01 Aug 2001 13:44:01 -0700, Raghava Raju wrote:
> 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?

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.

-- 
Robert M. Love
rml at ufl.edu
rml at tech9.net

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 07 2001 - 21:00:13 EST