uboot分析之Makefile

Uboot分析之Makefile:

1.uboot根目录下执行:make smdk2410_config
smdk2410_config	:	unconfig
	@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0
	
unconfig:
	@rm -f $(obj)include/config.h $(obj)include/config.mk \
		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep

obj := $(OBJTREE)/		
OBJTREE		:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))

SRCTREE		:= $(CURDIR)
MKCONFIG	:= $(SRCTREE)/mkconfig

即执行:先删除自动生成的配置文件,再执行根目录下的脚本mkconfig并传入参数...
@rm -f $(obj)include/config.h $(obj)include/config.mk \
		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
mkconfig smdk2410 arm arm920t smdk2410 samsung s3c24x0
   $0	    $1    $2     $3      $4       $5     $6
执行此脚本文件的作用:
Create link to architecture specific headers
Create include file for Make
Create board specific header file

2.uboot根目录下执行:make
 执行make命令时,第一个规则的目标all即是终极目标。
 ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)

all:		$(ALL)

$(obj)u-boot.bin:	$(obj)u-boot
		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
		
$(obj)u-boot:	depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds $(GEN_UBOOT)

$(OBJS):	depend
		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))

$(LIBS):	depend $(SUBDIRS)
		$(MAKE) -C $(dir $(subst $(obj),,$@))

$(LIBBOARD):	depend $(LIBS)
		$(MAKE) -C $(dir $(subst $(obj),,$@))

$(SUBDIRS):	depend
		$(MAKE) -C $@ all

$(LDSCRIPT):	depend
		$(MAKE) -C $(dir $@) $(notdir $@)

$(obj)u-boot.lds: $(LDSCRIPT)
		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@


你可能感兴趣的:(嵌入式)