Makefile:
u-boot.imx: u-boot.bin $(IMX_CONFIG) FORCE $(call if_changed,mkimage)IMX_CONFIG是什么?
IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%).cfgtmp $(IMX_CONFIG): %.cfgtmp: % FORCE $(Q)mkdir -p $(dir $@) $(call if_changed_dep,cpp_cfg)CONFIG_IMX_CONFIG是什么:
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qecovacs/mx6qecovacs.cfg,MX6Q,ANDROID_SUPPORT"然后被编译到了./include/config.h
./include/config.h:2:#define CONFIG_IMX_CONFIG board/freescale/mx6qecovacs/mx6qecovacs.cfg所以最终IMX_CONFIG的值是 mx6qecovacs.cfg.cfgtmp
如何被编译到u-boot.imx中?看 $(call if_changed,mkimage) 做了什么。
scripts/Kbuild.include:
# Execute command if command has changed or prerequisite(s) are updated. # if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)也就是说只要当发现规则的依赖有被更新了、或者编译该规则对应目标的命令行发生改变了,
cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ $(if $(KBUILD_VERBOSE:1=), >/dev/null)从编译的命令行其实也可以看到:
./tools/mkimage -n board/freescale/mx6qecovacs/mx6qecovacs.cfg.cfgtmp -T imximage -e 0x17800000 -d u-boot.bin u-boot.imx