public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Basic question..
@ 2001-08-01 20:44 Raghava Raju
  2001-08-01 20:55 ` Richard B. Johnson
  2001-08-01 21:04 ` Robert Love
  0 siblings, 2 replies; 8+ messages in thread
From: Raghava Raju @ 2001-08-01 20:44 UTC (permalink / raw)
  To: linux-kernel



   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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Basic question..
  2001-08-01 20:44 Raghava Raju
@ 2001-08-01 20:55 ` Richard B. Johnson
  2001-08-01 21:04 ` Robert Love
  1 sibling, 0 replies; 8+ messages in thread
From: Richard B. Johnson @ 2001-08-01 20:55 UTC (permalink / raw)
  To: Raghava Raju; +Cc: linux-kernel

On Wed, 1 Aug 2001, Raghava Raju wrote:

> 
> 
>    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.

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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Basic question..
  2001-08-01 20:44 Raghava Raju
  2001-08-01 20:55 ` Richard B. Johnson
@ 2001-08-01 21:04 ` Robert Love
  1 sibling, 0 replies; 8+ messages in thread
From: Robert Love @ 2001-08-01 21:04 UTC (permalink / raw)
  To: Raghava Raju; +Cc: linux-kernel

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Basic question
@ 2002-07-16  1:08 nejhdeh
  2002-07-16 12:47 ` Erik Mouw
  0 siblings, 1 reply; 8+ messages in thread
From: nejhdeh @ 2002-07-16  1:08 UTC (permalink / raw)
  To: linux-kernel

I end up getting all the required source codes from kernel-source-2.4.18-5.RPM
> 

> Now, it appears for me to use the kernel routines such as enable_irq 
(defined 
> in (/usr/src/linux-2.4.18-5/arch/i386/kernel/irq.c) I have to make the 
entire 
> kernel.o, since there are a lot of dependencies.
> 

> Do I need to go this far?? 
> 

> What is a simpler way to use these routines (in irq.c) with my application??
> 

> How do I link this module (i.e irq.o) with my application?? I get heaps of 
> unresoleved errors.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Basic question
  2002-07-16  1:08 nejhdeh
@ 2002-07-16 12:47 ` Erik Mouw
  0 siblings, 0 replies; 8+ messages in thread
From: Erik Mouw @ 2002-07-16 12:47 UTC (permalink / raw)
  To: nejhdeh; +Cc: linux-kernel

On Tue, Jul 16, 2002 at 11:08:39AM +1000, nejhdeh wrote:
> I end up getting all the required source codes from kernel-source-2.4.18-5.RPM
> > 
> 
> > Now, it appears for me to use the kernel routines such as enable_irq 
> (defined 
> > in (/usr/src/linux-2.4.18-5/arch/i386/kernel/irq.c) I have to make the 
> entire 
> > kernel.o, since there are a lot of dependencies.
> > 
> 
> > Do I need to go this far?? 
> > 
> 
> > What is a simpler way to use these routines (in irq.c) with my application??
> > 
> 
> > How do I link this module (i.e irq.o) with my application?? I get heaps of 
> > unresoleved errors.

You can't link kernel sources against applications and expect that it
just works. The kernel is a separate piece of software, all kernel
communication with the kernel goes through the file IO and system call
APIs.


Erik

-- 
J.A.K. (Erik) Mouw
Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Basic question
@ 2002-07-18 22:31 nejhdeh
  2002-07-25 12:53 ` Bill Davidsen
  2002-08-23  1:44 ` nejhdeh
  0 siblings, 2 replies; 8+ messages in thread
From: nejhdeh @ 2002-07-18 22:31 UTC (permalink / raw)
  To: linux-kernel

Hi,

Thanks to your reply erlier. I successfult compiled my device driver separatly 
as module.o and then ran a script to insmod into the kernel.

I have another basic question.

I have two PC systems. First one acts as my development system which I 
develope code using KDevelop running Red Hat linux (2.4.18). When I compile 
my application code (say app.0) and my device driver code (say module.o) then 
I FTP these files into my target system which is a scalled down single-board 
computer (with minimal RAM and disk) which runs linux 2.2.20.

Most of the time everything is O.K. However, when it comes to the device 
driver module (module.o), I get some kernel mismatch problems (obvisouly).

E.g. the file_operations struct in 2.2.20 is different to 2.4.18

My question is: How can I tell gcc or even within the module itself (e.g. 
KERNEL_VERSION) to compile for lower version kernel (i.e tell kernel 2.4.18 
to compile for 2.2.20)

Regards

Nejhdeh Ghevondian


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Basic question
  2002-07-18 22:31 Basic question nejhdeh
@ 2002-07-25 12:53 ` Bill Davidsen
  2002-08-23  1:44 ` nejhdeh
  1 sibling, 0 replies; 8+ messages in thread
From: Bill Davidsen @ 2002-07-25 12:53 UTC (permalink / raw)
  To: nejhdeh; +Cc: linux-kernel

On Fri, 19 Jul 2002, nejhdeh wrote:
> My question is: How can I tell gcc or even within the module itself (e.g. 
> KERNEL_VERSION) to compile for lower version kernel (i.e tell kernel 2.4.18 
> to compile for 2.2.20)

You go to the 2.2.20 kernel tree and use 'make.' You can't move modules
from one kernel to another, they're totally different programs!

-- 
bill davidsen <davidsen@tmr.com>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Basic question
  2002-07-18 22:31 Basic question nejhdeh
  2002-07-25 12:53 ` Bill Davidsen
@ 2002-08-23  1:44 ` nejhdeh
  1 sibling, 0 replies; 8+ messages in thread
From: nejhdeh @ 2002-08-23  1:44 UTC (permalink / raw)
  To: linux-kernel


Hi,
I have a question about fork() and messages..

For simplicity, I have a parent process that forks() two child processes (say 
pid1 & pid2).

How do I set priority levels of child1 vs child2. I want child1 to have a much 
higher priority level, since its going to read inputs from a serial device in 
the outside world?

Using basic signal calls say SIGUSR1, how can I communicate (without 
semaphores) between child1 and child2 through the parent? For instance if the 
child1 gets blocked forever trying to read the serial device then I want to 
notify the parent to kill child2??

Your time in this matter is greatly appreciated.


> Regards
>
> Nejhdeh Ghevondian

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-08-23  1:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-18 22:31 Basic question nejhdeh
2002-07-25 12:53 ` Bill Davidsen
2002-08-23  1:44 ` nejhdeh
  -- strict thread matches above, loose matches on Subject: below --
2002-07-16  1:08 nejhdeh
2002-07-16 12:47 ` Erik Mouw
2001-08-01 20:44 Raghava Raju
2001-08-01 20:55 ` Richard B. Johnson
2001-08-01 21:04 ` Robert Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox