Regarding module init function

Tobias Boege tobias at
Tue Jan 8 08:51:07 EST 2013

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/{,.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
accompanied by a useful comment about where the init function is called in
either case.


More information about the Kernelnewbies mailing list