GNU ARM汇编--(十七)u-boot的makefile和mkconfig解读
时间:11-26
来源:互联网
点击:
- stackusageifsupported
- CFLAGS_STACK:=$(callcc-option,-fstack-usage)
- CFLAGS+=$(CFLAGS_STACK)
- #$(CPPFLAGS)sets-g,whichcausesgcctopassasuitable-g
- #optiontotheassembler.
- AFLAGS_DEBUG:=
- #turnjbsrintojsrform68k
- ifeq($(ARCH),m68k)
- ifeq($(findstring3.4,$(shell$(CC)--version)),3.4)
- AFLAGS_DEBUG:=-Wa,-gstabs,-S
- endif
- endif
- AFLAGS:=$(AFLAGS_DEBUG)-D__ASSEMBLY__$(CPPFLAGS)
- LDFLAGS+=$(PLATFORM_LDFLAGS)
- LDFLAGS_FINAL+=-Bstatic
- LDFLAGS_u-boot+=-T$(obj)u-boot.lds$(LDFLAGS_FINAL)
- ifneq($(CONFIG_SYS_TEXT_BASE),)
- LDFLAGS_u-boot+=-Ttext$(CONFIG_SYS_TEXT_BASE)
- endif
- LDFLAGS_u-boot-spl+=-T$(obj)u-boot-spl.lds$(LDFLAGS_FINAL)
- ifneq($(CONFIG_SPL_TEXT_BASE),)
- LDFLAGS_u-boot-spl+=-Ttext$(CONFIG_SPL_TEXT_BASE)
- endif
- #LocationofausableBFDlibrary,wherewedefine"usable"as
- #"builtfor${HOST},supports${TARGET}".Sensiblevaluesare
- #-Whencross-compiling:therootofthecross-environment
- #-Linux/ppc(native):/usr
- #-NetBSD/ppc(native):youlose...(mustextractthesefromthe
- #binutilsbuilddirectory,plusthenativeandU-Bootinclude
- #filesdontlikeeachother)
- #
- #Sofar,thisisusedonlybytools/gdb/Makefile.
- ifeq($(HOSTOS),darwin)
- BFD_ROOT_DIR=/usr/local/tools
- else
- ifeq($(HOSTARCH),$(ARCH))
- #native
- BFD_ROOT_DIR=/usr
- else
- #BFD_ROOT_DIR=/LinuxPPC/CDK#Linux/i386
- #BFD_ROOT_DIR=/usr/pkg/cross#NetBSD/i386
- BFD_ROOT_DIR=/opt/powerpc
- endif
- endif
- #########################################################################
- exportHOSTCCHOSTCFLAGSHOSTLDFLAGSPEDCFLAGSHOSTSTRIPCROSS_COMPILE
- ASLDCCCPPARNMSTRIPOBJCOPYOBJDUMPMAKE
- exportCONFIG_SYS_TEXT_BASEPLATFORM_CPPFLAGSPLATFORM_RELFLAGSCPPFLAGSCFLAGSAFLAGS
- #########################################################################
- #Allowboardstousecustomoptimizeflagsonaperdir/filebasis
- BCURDIR=$(subst$(SRCTREE)/,,$(CURDIR:$(obj)%=%))
- ALL_AFLAGS=$(AFLAGS)$(AFLAGS_$(BCURDIR)/$(@F))$(AFLAGS_$(BCURDIR))
- ALL_CFLAGS=$(CFLAGS)$(CFLAGS_$(BCURDIR)/$(@F))$(CFLAGS_$(BCURDIR))
- EXTRA_CPPFLAGS=$(CPPFLAGS_$(BCURDIR)/$(@F))$(CPPFLAGS_$(BCURDIR))
- ALL_CFLAGS+=$(EXTRA_CPPFLAGS)
- #The_DEPversionusesthe$
- #Seerules.mk
- EXTRA_CPPFLAGS_DEP=$(CPPFLAGS_$(BCURDIR)/$(addsuffix.o,$(basename$<)))
- $(CPPFLAGS_$(BCURDIR))
- $(obj)%.s:%.S
- $(CPP)$(ALL_AFLAGS)-o$@$
- $(obj)%.o:%.S
- $(CC)$(ALL_AFLAGS)-o$@$<-c
- $(obj)%.o:%.c
- $(CC)$(ALL_CFLAGS)-o$@$<-c
- $(obj)%.i:%.c
- $(CPP)$(ALL_CFLAGS)-o$@$<-c
- $(obj)%.s:%.c
- $(CC)$(ALL_CFLAGS)-o$@$<-c-S
- #########################################################################
- #Ifthelistofobjectstolinkisempty,justcreateanemptybuilt-in.o
- cmd_link_o_target=$(if$(strip$1),
- $(LD)$(LDFLAGS)-r-o$@$1,
- rm-f$@;$(AR)rcs$@)
- #########################################################################
主要是一些变量和函数的定义,编译链接的参数设置以及依赖规则.最后分析下make:
[cpp]view plaincopy
- $(obj)include/autoconf.mk.dep:$(obj)include/config.hinclude/common.h
- @$(XECHO)Generating$@;
- set-e;
- :Generatethedependancies;
- $(CC)-xc-DDO_DEPS_ONLY-M$(CFLAGS)$(CPPFLAGS)
- -MQ$(obj)include/autoconf.mkinclude/common.h>$@
- $(obj)include/autoconf.mk:$(obj)include/config.h
- @$(XECHO)Generating$@;
- set-e;
- :Extracttheconfigmacros;
- $(CPP)$(CFLAGS)-DDO_DEPS_ONLY-dMinclude/common.h|
- sed-n-ftools/scripts/define2mk.sed>$@.tmp&&
- mv$@.tmp$@
第二个是根据include/config.h的文件内容,利用tools/scripts/define2mk.sed脚本将所有的CONFIG提取到autoconf.mk文件中
终极目标是:ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
u-boot.srec也是根据u-boot用objcopy工具搞出来的,不知的什么作用
u-boot.bin也是根据u-boot用objcopy工具搞出来的,最终烧写的二进制bin档
System.map是符号列表
[cpp]view plaincopy
- $(obj)u-boot.bin:$(obj)u-boot
- $(OBJCOPY)${OBJCFLAGS}-Obinary$<$@
- $(BOARD_SIZE_CHECK)
- ###################################################################################
- #要得到最后的
ARM汇编u-bootmakefilemkconfi 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)