android启动流程

下面是android启动到界面显示流程图




1:Linux内核启动
2:init进程启动。
3: 本地系统服务,Java系统服务 启动:
 1):init启动service manager,这个进程主要负责系统服务的注册管理,包括“java系统服务”“本地系统服务”
 2):init启动Media server,这个进程负责启动C/C++的“本地系统服务”。
 3):init启动Zygote,这个进程启动System server进程,这个进程启动"Java系统服务"---[包括power manager    service,sensor service]
 4):另外init启动system/bin下面的各种守护进程

4:Home启动。

-------------------------------------------
第一步:Linux内核启动
这个不祥细讲

第二步:启动Linux的第一个进程init


kernel/init/main.c

asmlinkage void __init start_kernel(void)//这是kernel的入口,head-common.S汇编代码会连接过来。
{
    ......
	ftrace_init();

	/* Do the rest non-__init'ed, we're now alive */
	rest_init();
}

static noinline void __init_refok rest_init(void)
{
	.......
	/*
	 * We need to spawn init first so that it obtains pid 1, however
	 * the init task will end up wanting to create kthreads, which, if
	 * we schedule it before we create kthreadd, will OOPS.
	 */
	kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
	.......................
}

static int __init kernel_init(void * unused)
{
	.........
	if (!ramdisk_execute_command)
		ramdisk_execute_command = "/init";//指定init文件的位置

	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
		ramdisk_execute_command = NULL;
		prepare_namespace();
	}

	/*
	 * Ok, we have completed the initial bootup, and
	 * we're essentially up and running. Get rid of the
	 * initmem segments and start the user-mode stuff..
	 */

	init_post();
	return 0;
}

static noinline int init_post(void)
{
	/* need to finish all async __init code before freeing the memory */
	async_synchronize_full();
	free_initmem();
	mark_rodata_ro();
	system_state = SYSTEM_RUNNING;
	numa_default_policy();


	current->signal->flags |= SIGNAL_UNKILLABLE;

	if (ramdisk_execute_command) {
		run_init_process(ramdisk_execute_command);//调用run_init_process函数,init进程跑起来
		printk(KERN_WARNING "Failed to execute %s\n",
				ramdisk_execute_command);
	}

...........
}

第三步:启动Service Manager进程
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值