当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

中国科学技术大学:《嵌入式操作系统 Embedded Operating Systems》课程教学资源(课件讲义)ArmLinux的启动(基于arm的Linux启动代码分析)

资源类别:文库,文档格式:PDF,文档页数:65,文件大小:388.5KB,团购合买
点击下载完整版文档(PDF)

嵌入式操作系统 3基于arm的Linux启动代码分析 陈香兰(xlanchenc@ustc.edu.cn) 计算机应用教研室。计算机学院 嵌入式系统实验室。苏州研究院 中国科学技术大学 Fa112014 November 27,2014 1口401是42在刀00 陈香兰(xlanchenoustc,edu,cn)(升界款应 长人式操作系统 November 27.2014 1 /48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 嵌入式操作系统 3 基于arm的Linux启动代码分析 陈香兰(xlanchen@ustc.edu.cn) 计算机应用教研室@计算机学院 嵌入式系统实验室@苏州研究院 中国科学技术大学 Fall 2014 November 27, 2014 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 1 / 48

Outline Linux的源代码组织 ② ARWM1inux的编译过程和产生的映像 ●阅读Makefile ●源代码根目录下的vmlinux的生成 ●zImage的生成 。bootpImage的生成 ARWM1inux的启动分析 小结和作业 4口4四1是142刀00 陈香兰(xlanchenoustc,edu,cn)(升界丸应 长人式择作系统 November 27.2014 2 /48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Outline 1. Linux的源代码组织 .2 ARMlinux的编译过程和产生的映像 阅读Makefile 源代码根目录下的vmlinux的生成 zImage的生成 bootpImage的生成 .3 ARMlinux的启动分析 4. 小结和作业 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 2 / 48

考虑Arch为arm,了解源码组织 ●观察Linux源码的根目录 ●观察arch目录 ●观察arch下的arm目录 ●观察include目录 。观察init目录 1口+4四1是4P在刀0C 陈香兰(xlanchenoustc,edu,cn)(升界款应 长人式操作香统 November 27.2014 5 48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 考虑Arch为arm,了解源码组织 观察Linux源码的根目录 观察arch目录 观察arch下的arm目录 观察include目录 观察init目录 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 5 / 48

Outline Liux的源代码组织 ARM1inux的编译过程和产生的映像 ●阅读Makefile ●源代码根目录下的vmlinux的生成 。zImage的生成 ●bootpImage的生成 ARM祖i山x的启动分析 小结和作业 4口4四1是142刀00 陈香兰(xlanchenoustc,edu,cn)(升界丸应 长人式择作系统 November 27.2014 6/48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Outline . 1. Linux的源代码组织 .2 ARMlinux的编译过程和产生的映像 阅读Makefile 源代码根目录下的vmlinux的生成 zImage的生成 bootpImage的生成 .3 ARMlinux的启动分析 4. 小结和作业 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 6 / 48

查看make帮助信息 ●查看make的帮助信息,了解armlinux相关的产物: make ARCH=arm help 其中 Architecture specific targets (arm): ◆zImage -Compressed kernel image (arch/arm/boot/zImage) Image -Uncompressed kernel image (arch/arm/boot/Image) ◆xipImage XIP kernel image,if configured (arch/arm/boot/xipImage) uImage -U-Boot wrapped zImage bootpImage Combined zImage and initial RAM disk (supply initrd image via make variable INITRD=) install Install uncompressed kernel zinstall -Install compressed kernel Install using (your)/bin/installkernel or (distribution)/sbin/installkernel or install to $(INSTALL_PATH)and run 1ilo 4口4四是42刀00 陈香兰(xlanchenoustc,ed加,cn)(计异丸应 收人式样作系统 November 27.2014 7 /48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 查看make帮助信息 查看make的帮助信息,了解armlinux相关的产物: . make ARCH=arm help . . 其中 Architecture specific targets (arm): * zImage - Compressed kernel image (arch/arm/boot/zImage) Image - Uncompressed kernel image (arch/arm/boot/Image) * xipImage - XIP kernel image, if configured (arch/arm/boot/xipImage) uImage - U-Boot wrapped zImage bootpImage - Combined zImage and initial RAM disk (supply initrd image via make variable INITRD=) install - Install uncompressed kernel zinstall - Install compressed kernel Install using (your) ~/bin/installkernel or (distribution) /sbin/installkernel or install to $(INSTALL_PATH) and run lilo 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 7 / 48

Outline Linx的源代码组织 2 ARM1inux的编译过程和产生的映像 ●阅读Makefile ● 源代码报目录下的vmlinux的生成 。zImage的生成 o bootpImage的生成 ARM1inUx的启动分 。小结和作业 4口4四1是142刀00 陈香兰(xlanchenoustc,edu,cn)(计界轧应 长人式择作系统 November 27.2014 8/48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Outline . 1. Linux的源代码组织 .2 ARMlinux的编译过程和产生的映像 阅读Makefile 源代码根目录下的vmlinux的生成 zImage的生成 bootpImage的生成 .3 ARMlinux的启动分析 4. 小结和作业 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 8 / 48

阅读Makefile 。阅读下列相关的Makefile和链接描述文件, 了解上述产物是如何生成的: Linux源代码根目录下的Makefile arch/arm/Makefile arch/arm/boot/Makefile Oarch/arm/boot/compressed/Makefile arch/arm/boot/bootp/Makefile arch/arm/kernel/vmlinux.1ds 0. 4口4四1是4P在刀0C 陈香兰(xlanchenoustc,edu,cn)(升界款应 长人式操作系统 November 27.2014 9 /48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 阅读Makefile 阅读下列相关的Makefile和链接描述文件, 了解上述产物是如何生成的: 1. Linux源代码根目录下的Makefile 2. arch/arm/Makefile 3. arch/arm/boot/Makefile 4. arch/arm/boot/compressed/Makefile 5. arch/arm/boot/bootp/Makefile 6. arch/arm/kernel/vmlinux.lds 7. ... 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 9 / 48

l、阅读Linux源代码根目录下的Makefile ●找到缺省目标a11 #The all:target is the default when no target is given on the #command line. This allow a user to issue only make'to build a kernel including modules Defaults vmlinux but it is usually overridden in the arch makefile all:vmlinux ●找到vmlinux目标,并阅读 vmlinux image -including updated kernel symbols vmlinux:S(vmlinux-1ds)$(vmlinux-init)$(vmlinux-main)vmlinux.o $(kallsyms.o)FORCE ifdef CONFIG_HEADERS_CHECK S(Q)S(MAKE)-f $(srctree)/Makefile headers_check endif ifdef CONFIG_SAMPLES S(Q)$(MAKE)$(build)=samples endif S(call vmlinux-modpost) S(call if_changed_rule,vmlinux_) S(Q)rm -f.old_version 4口4四1是4P,刀00 陈香兰(xlanchenoustc,ed加.cn)(计年丸应 长人式样作系蛇 ovenber27,201410/48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1、阅读Linux源代码根目录下的Makefile . 找到缺省目标all . . # The all: target is the default when no target is given on the # command line. # This allow a user to issue only ’make’ to build a kernel including modules # Defaults vmlinux but it is usually overridden in the arch makefile all: vmlinux 找到vmlinux目标,并阅读 . . # vmlinux image - including updated kernel symbols vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE ifdef CONFIG_HEADERS_CHECK $(Q)$(MAKE) -f $(srctree)/Makefile headers_check endif ifdef CONFIG_SAMPLES $(Q)$(MAKE) $(build)=samples endif $(call vmlinux-modpost) $(call if_changed_rule,vmlinux__) $(Q)rm -f .old_version 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 10 / 48

l、阅读Linux源代码根目录下的Makefile 。解释:关于 S(call if_changed_rule,vmlinux_) ↓ rule_vmlinux_ #Link of vmlinux #If CONFIG_KALLSYMS is set version is already updated Generate System.map and verify that the content is consistent #Use in front of the vmlinux_version rule to silent warning with make -j2 #First command is ':to allow us to use in front of the rule define rule_vmlinux_ 。 S(if S(CONFIG_KALLSYMS).+S(call cmd,vmlinux_version)) $(call cmd,vmlinux_) S(Q)echo cmd_se :S(cmd_vmlinux_)'S(oD)/.$(oF).cmd S(Q)S(if $(S(quiet)cmd_sysmap),\ echo s(S(quiet)end_sysmap)Systen.map')\ S(cmd_sysmap)So Systen.map:\ if SS?-ne 0 ]then rm-f80:\ /bin/false;\ fi: S(verify_kallsyms) endef 4口4四114P刀00 陈香兰(x1 anchenoustc,edu.en)(升计异丸应 长人式操作系蛇 ovenber27,201410/48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1、阅读Linux源代码根目录下的Makefile . 解释:关于 $(call if_changed_rule, vmlinux__) ↓ rule_vmlinux__ . . # Link of vmlinux # If CONFIG_KALLSYMS is set .version is already updated # Generate System.map and verify that the content is consistent # Use + in front of the vmlinux_version rule to silent warning with make -j2 # First command is ’:’ to allow us to use + in front of the rule define rule_vmlinux__ : $(if $(CONFIG_KALLSYMS)„+$(call cmd,vmlinux_version)) $(call cmd,vmlinux__) $(Q)echo ’cmd_$@ := $(cmd_vmlinux__)’ > $(@D)/.$(@F).cmd $(Q)$(if $($(quiet)cmd_sysmap), \ echo ’ $($(quiet)cmd_sysmap) System.map’ &&) \ $(cmd_sysmap) $@ System.map; \ if [ $$? -ne 0 ]; then \ rm -f $@; \ /bin/false; \ fi; $(verify_kallsyms) endef 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 10 / 48

l、阅读Linux源代码根目录下的Makefile #Rule to link vmlinux also used during CONFIG_KALLSYMS May be overridden by arch/S(ARCH)/Makefile quiet_cmd_vmlinux_?=LD $o cmd_vmlinux_?=$(LD)$(LDFLAGS)S(LDFLAGS_vmlinux)-o Sm\ -T S(vmlinux-1ds)$(vmlinux-init)\ -start-group $(vmlinux-main)-end-group\ S(filter-out S(vmlinux-1ds)$(vmlinux-init)$(vmlinux-main)vmlinux.o FORCE ,$ ●链接描述文件? ●链接顺序: vmlinux-init vmlinux-main 4口4四1是4P,刀00 陈香兰(xlanchenoustc,edu,cn)(升界丸应 长人式择作系统 ovenber27,201410/48

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1、阅读Linux源代码根目录下的Makefile . . . # Rule to link vmlinux - also used during CONFIG_KALLSYMS # May be overridden by arch/$(ARCH)/Makefile quiet_cmd_vmlinux__ ?= LD $@ cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \ -T $(vmlinux-lds) $(vmlinux-init) \ –start-group $(vmlinux-main) –end-group \ $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^) 链接描述文件? 链接顺序: ▶ vmlinux-init ▶ vmlinux-main 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室@计算机学院嵌入式系统实验室 嵌入式操作系统 @苏州研究院中国科学技术大学Fall 2014) November 27, 2014 10 / 48

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共65页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有