public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: Manoj Sontakke <manojs@sasken.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: initialisation code
Date: Thu, 22 Mar 2001 15:27:53 +1100	[thread overview]
Message-ID: <17644.985235273@kao2.melbourne.sgi.com> (raw)
In-Reply-To: Your message of "Thu, 22 Mar 2001 14:59:31 +0530." <Pine.LNX.4.21.0103221453140.1382-100000@pcc65.sasi.com>

On Thu, 22 Mar 2001 14:59:31 +0530 (IST), 
Manoj Sontakke <manojs@sasken.com> wrote:
>On Wed, 21 Mar 2001, Keith Owens wrote:
>> Welcome to the wonderful world of magic initialisation.
>> 
>> (1) Declare your initialisation function as int __init foo_init(void).
>> (2) Decide when your function needs to be called, e.g. after initialisers
>>     for A, B, C but before initialisers for X, Y, Z.
>
>where do i find this ABC abs XYZ ?

You coded it, you know what kernel facilities must be initialised
before your program (ABC) and what kernel code cannot be initialised
until after your program (XYZ).

>What if I have to make it as an insertable/removable module?

static int __init foo_init(void) {
  ...
}

module_init(foo_init);

Automatically generates the correct code for a built in object and for
a module.  See include/linux/init.h and almost any drivers/net/*.c,
plip.c is a good example.

>> 
>> (3) Edit the Makefile to insert obj-$(CONFIG_FOO) after the objects
>>     that contain initialisers A, B, C and before the objects for
>>     initialisers X, Y, Z.
>
>Do I need to edit the .config file to add CONFIG_FOO=y ?

Do not edit .config, it is generated.  Edit a [Cc]onfig.in file, read
Documentation/kbuild/config-language.txt and look at the [Cc]onfig.in
file in the directory where you are putting your source.  Do not forget
to update Documentation/Configure.help.


      reply	other threads:[~2001-03-22  4:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-21 16:30 initialisation code Manoj Sontakke
2001-03-21 11:37 ` Keith Owens
2001-03-22  9:29   ` Manoj Sontakke
2001-03-22  4:27     ` Keith Owens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17644.985235273@kao2.melbourne.sgi.com \
    --to=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manojs@sasken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox