这个config.mk与主Makefile在同一目录下,这个文件中主要定义了以下变量以及CFLAGS和CPPFLAGS
97 AS = $(CROSS_COMPILE)as
98 LD = $(CROSS_COMPILE)ld
99 CC = $(CROSS_COMPILE)gcc
100 CPP = $(CC) -E
101 AR = $(CROSS_COMPILE)ar
102 NM = $(CROSS_COMPILE)nm
103 LDR = $(CROSS_COMPILE)ldr
104 STRIP = $(CROSS_COMPILE)strip
105 OBJCOPY = $(CROSS_COMPILE)objcopy
106 OBJDUMP = $(CROSS_COMPILE)objdump
107 RANLIB = $(CROSS_COMPILE)RANLIB
112 sinclude $(OBJTREE)/include/autoconf.mk
该文件的第112行包含了一个重要的文件autoconf.mk.该文件来源于include/configs/x210_sd.h
在include/configs目录下包含的头文件及其重要!移植uboot时,主要就修改这里。
114 ifdef ARCH
115 sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rul es
116 endif
117 ifdef CPU
118 sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
119 endif
120 ifdef SOC
121 sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rul es
122 endif
123 ifdef VENDOR
124 BOARDDIR = $(VENDOR)/$(BOARD)
125 else
126 BOARDDIR = $(BOARD)
127 endif
128 ifdef BOARD
129 sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
130 endif
142 ifndef LDSCRIPT
143 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
144 ifeq ($(CONFIG_NAND_U_BOOT),y) //判断CONFIG_NAND_U_BOOT变量有没有定义,在include/autoconf.mk中发现未定义,就会走下面的else分支
145 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
146 else
147 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds //指定uboot的链接脚本
148 endif
149 endif
156 ifneq ($(TEXT_BASE),) //这里的TEXT_BASE变量是在主Makefile的2589行配置时将 "TEXT_BASE = 0xc3e00000"写入$(obj)board/samsung/x210/config.mk
//也就是写在上面的129行包含的那个文件里的,相当于在那里定义了这个TEXT_BASE变量,然后在这里判断使用。
157 CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) //这里的TEXT_BASE是uboot的链接地址
158 endif
199 ifneq ($(TEXT_BASE),)
200 LDFLAGS += -Ttext $(TEXT_BASE) //这里的TEXT_BASE是uboot的链接地址会覆盖uboot.lds链接文件中的. = 0x00000000;
201 endif
239 ifndef REMOTE_BUILD //这里的REMOTE_BUILD变量是在主Makefile中的104-107行ifneq ($(OBJTREE),$(SRCTREE))则REMOTE_BUILD := 1
240
241 %.s: %.S
242 $(CPP) $(AFLAGS) -o $@ $<
243 %.o: %.S
244 $(CC) $(AFLAGS) -c -o $@ $<
245 %.o: %.c
246 $(CC) $(CFLAGS) -c -o $@ $<
247
248 else
249
250 $(obj)%.s: %.S
251 $(CPP) $(AFLAGS) -o $@ $<
252 $(obj)%.o: %.S
253 $(CC) $(AFLAGS) -c -o $@ $<
254 $(obj)%.o: %.c
255 $(CC) $(CFLAGS) -c -o $@ $<