xx_initcall ( ) in kernel

nilesh nilesh.tayade at netscout.com
Wed Jul 13 07:09:11 EDT 2011


Hi Sumeet,

On Wednesday 13 July 2011 04:12 PM, sumeet linux wrote:
> Dear friends,
>
> I want to know the basics xx_initcall ( ) in linux kernel. How this function
> works ?
> Observed in kernel code, many places late_initcall ( ), early_initcall ( ),
> arch_initcall ( ), core_initcall ( ) gets called.
> When did all these functions gets call during kernel initialization ?
> I am more interested in what is the sequence of these functions gets called
> one after another.
I could get a nice link explaining about *_initcall(). Refer:
http://book.opensourceproject.org.cn/embedded/embeddedprime/opensource/0136130550/ch05lev1sec4.html

*_initcall() are macros which set the function pointers for subsystem 
initialization (typedef int (*initcall_t)(void) : typedef of all such 
function pointers).
Also if we look at the source code, the functions are called in below 
sequence:
http://lxr.linux.no/#linux+v2.6.39/init/main.c#L695

do_basic_setup(void) -> do_initcalls(void) -> do_one_initcall(*fn);
do_one_initcall(*fn) - calls each function. And do_basic_setup() is 
called inside the initialization sequence (kernel_init()).

>
> Thank you.
>
> Regards,
> Sumeet
>

-- 
Thanks,
Nilesh



More information about the Kernelnewbies mailing list