Thank you Tim. Regards, Preetam
On Mon, Oct 31, 2011 at 11:35 PM, Tim Bird <tim.b...@am.sony.com> wrote: > On 10/31/2011 5:07 AM, preetam m.n wrote: > >> Thanks, I have started reading android system code. >> >> I have seen through traces that when in the default boot, the android >> stack entry is in the file system/core/init/init.c main() function. >> >> I would like to know how does kernel know to call this main function? >> > > Normally, the Linux kernel automatically starts a program called 'init', > int > the /sbin directory. So most legacy Linux systems have the starting > program placed there: /sbin/init. However, the kernel accepts a command > line variable 'init=<value>' which can be used to specify the starting > program. > In the case of Android, this is set to '/init' (so the full command line > argument is 'init=/init'. This is set by the bootloader. Depending on > which > bootloader you are using, you can set this either via the bootloader > command > line, or have it read from nvram. > > 'init' and other kernel command line arguments are documented in the > file: Documentation/kernel_**parameters.txt, in the kernel source > directory. > > The 'main()' function is called by the C initialization code, after the > kernel > starts execution at an address specified in the ELF header for the program. > This is part of the C standard, I believe, but in any case is rather > outside > the scope of Android. > -- Tim > > > > -- > unsubscribe: > android-kernel+unsubscribe@**googlegroups.com<android-kernel%2bunsubscr...@googlegroups.com> > website: > http://groups.google.com/**group/android-kernel<http://groups.google.com/group/android-kernel> > -- "The great pleasure in life is doing what people say you cannot do" -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel