博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux 内核启动
阅读量:2344 次
发布时间:2019-05-10

本文共 4907 字,大约阅读时间需要 16 分钟。

asmlinkage __visible void __init start_kernel(void){	char *command_line;	char *after_dashes;	set_task_stack_end_magic(&init_task);	smp_setup_processor_id();	debug_objects_early_init();	cgroup_init_early();	local_irq_disable();	early_boot_irqs_disabled = true;	/*	 * Interrupts are still disabled. Do necessary setups, then	 * enable them.	 */	boot_cpu_init();	page_address_init();	pr_notice("%s", linux_banner);	setup_arch(&command_line);	/*	 * Set up the the initial canary and entropy after arch	 * and after adding latent and command line entropy.	 */	add_latent_entropy();	add_device_randomness(command_line, strlen(command_line));	boot_init_stack_canary();	mm_init_cpumask(&init_mm);	setup_command_line(command_line);	setup_nr_cpu_ids();	setup_per_cpu_areas();	boot_cpu_state_init();	smp_prepare_boot_cpu();	/* arch-specific boot-cpu hooks */	build_all_zonelists(NULL);	page_alloc_init();	pr_notice("Kernel command line: %s\n", boot_command_line);	parse_early_param();	after_dashes = parse_args("Booting kernel",				  static_command_line, __start___param,				  __stop___param - __start___param,				  -1, -1, NULL, &unknown_bootoption);	if (!IS_ERR_OR_NULL(after_dashes))		parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,			   NULL, set_init_arg);	jump_label_init();	/*	 * These use large bootmem allocations and must precede	 * kmem_cache_init()	 */	setup_log_buf(0);	vfs_caches_init_early();	sort_main_extable();	trap_init();     // 中断处理初始化	mm_init();	ftrace_init();	/* trace_printk can be enabled here */	early_trace_init();	/*	 * Set up the scheduler prior starting any interrupts (such as the	 * timer interrupt). Full topology setup happens at smp_init()	 * time - but meanwhile we still have a functioning scheduler.	 */	sched_init();  //时间系统初始化	/*	 * Disable preemption - early bootup scheduling is extremely	 * fragile until we cpu_idle() for the first time.	 */	preempt_disable();   	if (WARN(!irqs_disabled(),		 "Interrupts were enabled *very* early, fixing it\n"))		local_irq_disable();	radix_tree_init();	/*	 * Set up housekeeping before setting up workqueues to allow the unbound	 * workqueue to take non-housekeeping into account.	 */	housekeeping_init();	/*	 * Allow workqueue creation and work item queueing/cancelling	 * early.  Work item execution depends on kthreads and starts after	 * workqueue_init().	 */	workqueue_init_early();	rcu_init();     	/* Trace events are available after this */	trace_init();	context_tracking_init();	/* init some links before init_ISA_irqs() */	early_irq_init();	init_IRQ();     //硬件中断初始化	tick_init();	rcu_init_nohz();	init_timers();	hrtimers_init();	softirq_init();	timekeeping_init();	time_init();	sched_clock_postinit();	printk_safe_init();	perf_event_init();	profile_init();     //分析数据初始化	call_function_init();	WARN(!irqs_disabled(), "Interrupts were enabled early\n");	early_boot_irqs_disabled = false;	local_irq_enable();	kmem_cache_init_late();    //  内存分区,大致分为高中低三块	/*	 * HACK ALERT! This is early. We're enabling the console before	 * we've done PCI setups etc, and console_init() must be aware of	 * this. But we do want output early, in case something goes wrong.	 */	console_init();	if (panic_later)		panic("Too many boot %s vars at `%s'", panic_later,		      panic_param);	lockdep_info();	/*	 * Need to run this when irqs are enabled, because it wants	 * to self-test [hard/soft]-irqs on/off lock inversion bugs	 * too:	 */	locking_selftest();	/*	 * This needs to be called before any devices perform DMA	 * operations that might use the SWIOTLB bounce buffers. It will	 * mark the bounce buffers as decrypted so that their usage will	 * not cause "plain-text" data to be decrypted when accessed.	 */	mem_encrypt_init();#ifdef CONFIG_BLK_DEV_INITRD	if (initrd_start && !initrd_below_start_ok &&	    page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {		pr_crit("initrd overwritten (0x%08lx < 0x%08lx) - disabling it.\n",		    page_to_pfn(virt_to_page((void *)initrd_start)),		    min_low_pfn);		initrd_start = 0;	}#endif	page_ext_init();	kmemleak_init();	debug_objects_mem_init();	setup_per_cpu_pageset();	numa_policy_init();	acpi_early_init();	if (late_time_init)		late_time_init();	calibrate_delay();	pid_idr_init();	anon_vma_init();#ifdef CONFIG_X86	if (efi_enabled(EFI_RUNTIME_SERVICES))		efi_enter_virtual_mode();#endif	thread_stack_cache_init();	cred_init();	fork_init();	proc_caches_init();	buffer_init();    //文件系统缓存数据	key_init();	security_init();   //安全模块加载	dbg_late_init();	vfs_caches_init();   //文件系统框架初始化	pagecache_init();	signals_init();	proc_root_init();    // proc  文件系统挂载	nsfs_init();	cpuset_init();	cgroup_init();	taskstats_init_early();	delayacct_init();	check_bugs();	acpi_subsystem_init();	arch_post_acpi_subsys_init();	sfi_init_late();	if (efi_enabled(EFI_RUNTIME_SERVICES)) {		efi_free_boot_services();	}	/* Do the rest non-__init'ed, we're now alive */	rest_init();    //删除内核化锁, 生成init进程}

转载地址:http://fnjvb.baihongyu.com/

你可能感兴趣的文章
对类成员访问权限的控制,是通过设置成员的访问控制属性实现的,下列不是访问控制属性的是( )
查看>>
字符串常量放在只读存储区
查看>>
#define 和 typedef 的区别
查看>>
不属于冯诺依曼体系结构必要组成部分是:
查看>>
有1000亿条记录,每条记录由url,ip,时间组成,设计一个系统能够快速查询以下内容(程序设计题)
查看>>
最大堆---实现一个简化的搜索提示系统。给定一个包含了用户query的日志文件,对于输入的任意一个字符串s,输出以s为前缀的在日志中出现频率最高的前10条query。
查看>>
拓扑排序
查看>>
已知n阶矩阵A的行列式满足|A|=1,求|A^(-1)|(A^(-1)表示A的逆矩阵)=?
查看>>
已知一对夫妇有两个孩子,如果知道有一个是男孩,那么两个都是男孩的概率?
查看>>
视图包含下列结构是不可以更新的
查看>>
可能返回 null 的 SQL 语句
查看>>
以下关于STL的描述中,错误的有
查看>>
假设某棵二叉查找树的所有键均为1到10的整数,现在我们要查找5。下面____不可能是键的检查序列。
查看>>
给定一个整数sum,从有N个无序元素的数组中寻找元素a、b、c、d,使得 a+b+c+d =sum,最快的平均时间复杂度是____。
查看>>
设二叉树结点的先根序列、中根序列和后根序列中,所有叶子结点的先后顺序____。
查看>>
将整数序列(7-2-4-6-3-1-5)按所示顺序构建一棵二叉排序树a(亦称二叉搜索树),之后将整数8按照二叉排序树规则插入树a中,请问插入之后的树a中序遍历结果是____。
查看>>
IP地址、子网掩码、网络号、主机号、网络地址、主机地址
查看>>
已知int a[]={1,2,3,4,5};int*p[]={a,a+1,a+2,a+3};int **q=p;表达式*(p[0]+1)+**(q+2)的值是____。
查看>>
CPU输出数据的速度远远高于打印机的打印速度,为了解决这一矛盾,可采用()
查看>>
整型字符常量和字符字面量的区别 sizeof(char) 和 sizeof('a')
查看>>