内核启动流程分析之Makefile
2015-11-19 12:11
381 查看
分析Makefile:第一个文件、链接脚本
1、子目录下面的makefile:
obj-y += mem.o random.o tty_io.o n_tty.o tty_ioctl.o
obj-m += s3c24xx_leds.o
2、make uImage,发现uImage位于:linux-2.6.22.6_jz2440\linux-2.6.22.6\arch\arm\makefile
可以肯定上面的这个makefile会被包含在顶层的makefile里面,我们搜索顶层makefile发现里面有:include $(srctree)/arch/$(ARCH)/Makefile
在上一节的分析中,我们看到.config文件生成了autoconf.h和auto.conf
我们搜索一下顶层的makefile:-include include/config/auto.conf
在linux-2.6.22.6_jz2440\linux-2.6.22.6\arch\arm\makefile下可以看到uImage有关的一行:zImage Image xipImage bootpImage uImage: vmlinux,所以uImage依赖于vmlinux
在顶层makefile里面linux-2.6.22.6_jz2440\linux-2.6.22.6\makefile搜索vmlinux可以看到:all: vmlinux
zImage Image xipImage bootpImage uImage: vmlinux
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
vmlinux-init := $(head-y) $(init-y)
head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o
init-y := init/
init-y := $(patsubst %/, %/built-in.o, $(init-y))即=init/built-in.o
vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
core-y := usr/
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
core-y := $(patsubst %/, %/built-in.o, $(core-y))
=usr/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o
libs-y := lib/
llibs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
libs-y := $(libs-y1) $(libs-y2)
=lib/lib.a lib/built-in.o
drivers-y := drivers/ sound/
drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
=drivers/built-in.o sound/built-in.o
net-y := net/
net-y := $(patsubst %/, %/built-in.o, $(net-y))
=net/built-in.o
vmlinux-all := $(vmlinux-init) $(vmlinux-main)
vmlinux-lds := arch/$(ARCH)/kernel/vmlinux.lds
走捷径分析linux:
book@book-desktop:/work/system/linux-2.6.22.6$ rm vmlinux
book@book-desktop:/work/system/linux-2.6.22.6$ make uImage V=1
arm-linux-ld -EL -p --no-undefined -X -o vmlinux
-T arch/arm/kernel/vmlinux.lds //链接脚本
arch/arm/kernel/head.o arch/arm/kernel/init_task.o //第一个文件,下面的都是原材料
init/built-in.o
--start-group usr/built-in.o arch/arm/kernel/built-in.o arch/arm/mm/built-in.o arch/arm/common/built-in.o
arch/arm/mach-s3c2410/built-in.o arch/arm/mach-s3c2400/built-in.o arch/arm/mach-s3c2412/built-in.o arch/arm/mach-s3c2440/built-in.o
arch/arm/mach-s3c2442/built-in.o arch/arm/mach-s3c2443/built-in.o arch/arm/nwfpe/built-in.o arch/arm/plat-s3c24xx/built-in.o
kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o
arch/arm/lib/lib.a lib/lib.a arch/arm/lib/built-in.o lib/built-in.o drivers/built-in.o sound/built-in.o net/built-in.o --end-group .tmp_kallsyms2.o
1、子目录下面的makefile:
obj-y += mem.o random.o tty_io.o n_tty.o tty_ioctl.o
obj-m += s3c24xx_leds.o
2、make uImage,发现uImage位于:linux-2.6.22.6_jz2440\linux-2.6.22.6\arch\arm\makefile
可以肯定上面的这个makefile会被包含在顶层的makefile里面,我们搜索顶层makefile发现里面有:include $(srctree)/arch/$(ARCH)/Makefile
在上一节的分析中,我们看到.config文件生成了autoconf.h和auto.conf
我们搜索一下顶层的makefile:-include include/config/auto.conf
在linux-2.6.22.6_jz2440\linux-2.6.22.6\arch\arm\makefile下可以看到uImage有关的一行:zImage Image xipImage bootpImage uImage: vmlinux,所以uImage依赖于vmlinux
在顶层makefile里面linux-2.6.22.6_jz2440\linux-2.6.22.6\makefile搜索vmlinux可以看到:all: vmlinux
zImage Image xipImage bootpImage uImage: vmlinux
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
vmlinux-init := $(head-y) $(init-y)
head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o
init-y := init/
init-y := $(patsubst %/, %/built-in.o, $(init-y))即=init/built-in.o
vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
core-y := usr/
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
core-y := $(patsubst %/, %/built-in.o, $(core-y))
=usr/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o
libs-y := lib/
llibs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
libs-y := $(libs-y1) $(libs-y2)
=lib/lib.a lib/built-in.o
drivers-y := drivers/ sound/
drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
=drivers/built-in.o sound/built-in.o
net-y := net/
net-y := $(patsubst %/, %/built-in.o, $(net-y))
=net/built-in.o
vmlinux-all := $(vmlinux-init) $(vmlinux-main)
vmlinux-lds := arch/$(ARCH)/kernel/vmlinux.lds
走捷径分析linux:
book@book-desktop:/work/system/linux-2.6.22.6$ rm vmlinux
book@book-desktop:/work/system/linux-2.6.22.6$ make uImage V=1
arm-linux-ld -EL -p --no-undefined -X -o vmlinux
-T arch/arm/kernel/vmlinux.lds //链接脚本
arch/arm/kernel/head.o arch/arm/kernel/init_task.o //第一个文件,下面的都是原材料
init/built-in.o
--start-group usr/built-in.o arch/arm/kernel/built-in.o arch/arm/mm/built-in.o arch/arm/common/built-in.o
arch/arm/mach-s3c2410/built-in.o arch/arm/mach-s3c2400/built-in.o arch/arm/mach-s3c2412/built-in.o arch/arm/mach-s3c2440/built-in.o
arch/arm/mach-s3c2442/built-in.o arch/arm/mach-s3c2443/built-in.o arch/arm/nwfpe/built-in.o arch/arm/plat-s3c24xx/built-in.o
kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o
arch/arm/lib/lib.a lib/lib.a arch/arm/lib/built-in.o lib/built-in.o drivers/built-in.o sound/built-in.o net/built-in.o --end-group .tmp_kallsyms2.o
相关文章推荐
- VC6.0 MFC中WebBrowser控件禁止新窗口弹出的解决办法
- 百度api申请key
- Lowest Common Ancestor of a Binary Search Tree
- A20 linux(dragonboard)同时使用Parallel CSI Camera及UVC
- jquery_DOM笔记3
- java上传组件FileUpload
- VMnet0意外删除,找回方法!
- entity framework 迁移出错
- array_rand()函数
- MD5加密运算
- redhat6.5 配置使用centos的yum源
- Liferay学习笔记:liferay组件标签
- WebRTC编译详细介绍
- Java
- Log4j2的基本使用
- HTML5<nav>元素
- 网络嗅探器
- #import与@class的区别
- 毕业典礼—一个程序员的成长史(4)
- Tomcat:配置外部应用