从linux主目录中的makefile文件分析编译构成。。。

来源:互联网 发布:手指数算法5加6怎么算 编辑:程序博客网 时间:2024/05/19 15:44

在嵌入式linux系统的编译中,makefile文件是最重要也是最有效的分析文件。

配置好内核之后,都需要编译内核。执行命令:make zImage或者 make uImage.(这两个镜像文件有一点点区别)

在顶层makefile中:

export KBUILD_IMAGE ?= vmlinux

找到vmlinux,便可知道依赖文件。

# 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 to vmlinux, but the arch makefile usually adds further targets


all: vmlinux

①  :export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)  (初始化函数)

 

head-y               :=arch/arm/kernel/head$(MMUEXT).o     //目标架构目录

 

init-y                   :=init/

 

②  :export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y)$(net-y) (主函数)

 

drivers-y  :=drivers/ sound/ firmware/

net-y                  :=net/

libs-y                  :=lib/

core-y                :=usr/

 

// 链接脚本文件,由各个架构的目录下的脚本文件生成。包括:程序的起始地址等

③:export KBUILD_LDS          :=arch/$(SRCARCH)/kernel/vmlinux.lds  



0 0
原创粉丝点击