Re: Help - how to let a module load another module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks so much.  This sounds like a solution for me.  Is it possible for me to see some simple sample code for doing this (for both modA and modB) somewhere?  I'm new in this area and a simple sample code would be a great help.
 
Best Regards,
 
 
T.
 
 


"Amit D. Chaudhary" <amit_c@comcast.net> wrote:
Consider the following change to you design.

Load module A and B using modprobe. since A willnot be ready
immediately, allow B to call in a function in A, say a_register_user()
and send in a set of function pointers.
Module A, then after it has done the 'work' as you described it will
call a specific function from the function pointer list, called
init_done, start_init() or whatever you can to call it and B then knows
it is safe to call into module A.

This is a common scheme in the linux kernel and other places.

Amit


l x wrote:
> Thanks so much for the information and sorry for not making myself clear.
>
> The details are like this:
>
> - modA.o needs to be loaded first and it will do some
> work after been loaded. After the work is done,
> - modB.o needs to be loaded.
>
> Is there a system call, something like "load_another_lkm"? If there is
> one, then we can call it from modA after modA completes its works.
>
> Thanks,
>
>
> T.
>
> */"Curran, Dominic" /* wrote:
>
>
> I've never done this but I believe it works like this.
>
> Copy your LKM's to somewhere under the tree:
> /lib/modules/
>
> where is the current kernel version ('uname -r').
>
> Then run depmod.
>
> depmod should create the module dependency file. This determines
> interdependencies between LKM's.
> The module dependency file will live here:
> /lib/modules//modules.dep
>
> Then load your modules using modprobe.
>
> Thus if modA.o depends on modB.o
> Then the command:
>
> # modprobe modA.o
>
> ...should load modB.o and then modA.o
>
> I'm sure someone will correct me if I'm wrong.
> dom
>
> -----Original Message-----
> *From:* kernelnewbies-bounce@nl.linux.org
> [mailto:kernelnewbies-bounce@nl.linux.org] *On Behalf Of *l x
> *Sent:* Friday, May 14, 2004 5:43 PM
> *To:* kernelnewbies@nl.linux.org
> *Subject:* Help - how to let a module load another module
>
> Hi,
>
> People usually use insmod to load a module from the
> command-line. How can we let a module load another module?
> Suppose we have module_a.o and module_b.o, how to code module_a,
> so running "insmod module_a.o" will cause module_b.o loaded.
>
> Thanks,
>
>
> T.
>
>
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> SBC Yahoo!
>
> - Internet access at a great low price.
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> SBC Yahoo!
>
> - Internet access at a great low price.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/


Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux