after initialization, uboot calls start_kernel to run Linux kernel.
just now, I simply looked at kernel 3.4. Now, the kernel runs init in the form of creating a kernel thread. For more information about Code , see init/main in Linux kernel code. c start_kernel-> rest_init: the kernel thread is created in rest_init. The Handler function of this thread is init_post, in init_post, the system calls
run_init_process ("/sbin/init");
run_init_process ("/etc/init ");
run_init_process ("/bin/init");
run_init_process ("/bin/sh");
earlier Linux kenel versions do not support kernel threads, it calls init directly in start_kernel.
the android init file is not complex in the system/CORE/SH/init. C code. A simple analysis is as follows:
1.ProgramFirst, determine whether it is run as ueventd. If so, run the ueventd logic.
2. Create the structure of the file system/dev,/proc,/sys, and mount tmpfs.
3. Create the/dev/. Booting file.
4. open_devnull_stdio: create a character device/dev/_ null _
5. Create a character device for klog using klog_init
6. Read the configuration file from init. C.
7. Read the configuration information focused on the local machine/init. machinename. RC
8 ...... read each configuration item and start execution.
The init. RC Script is a key aspect of the entire android system. All the keywords supported by init. Rc are included in core \ init \ keywords. h.
The numerous details in Android are classic. the RC parsing architecture can be reused in your own projects, simple parsing of configuration files, or a simple script engine.