From mboxrd@z Thu Jan 1 00:00:00 1970 From: tobias@gambas-buch.de (Tobias Boege) Date: Thu, 10 Jan 2013 09:47:47 +0100 Subject: Regarding module init function In-Reply-To: <1357663456.1670.5.camel@anish-Inspiron-N5050> References: <20130104132213.GB526@aurora> <20130108135107.GA560@aurora> <1357663456.1670.5.camel@anish-Inspiron-N5050> Message-ID: <20130110084404.GB777@aurora> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Tue, 08 Jan 2013, anish kumar wrote: > On Tue, 2013-01-08 at 14:51 +0100, Tobias Boege wrote: > > On Tue, 08 Jan 2013, Rahul Bedarkar wrote: > > > Ok. in init/main.c we call do_basic_setup(). Where do_initcalls call each > > > of init functions from __early_initcall_end to __initcall_end. But I don't > > > know from where these values gets initialized. > > > > > > > Take a look at include/linux/init.h. There you can find the macros for > > declaring various init functions. They all go into special sections. The > > rest is linker magic (e.g. arch/x86/kernel/vmlinux.lds{,.S}). > > > > > I want to know when one of auxdriver (selected in from menuconfig) is built > > > as built-in module. When and Who calls it's init function ? > > > > It's, too, in the init.h. There are two definitions of module_init() > > depending on whether MODULE is declared or not. The first definition is > How does the individual driver define this MODULE?I think some macro > magic works here. I suppose that this is done through the invocation of the preprocessor, using -DMODULE depending on whether the target is built-in or a module. Regards, Tobi