u-boot-2010.06
主目录下的“README”提供了代码和配置的详细说明
(1) makefile
注意在make的过程中生成了"include/autoconfig.mk"
(2)mkconfig文件
makefile中的开发板配置代码:
---------------------------------
at91sam9260ek_nandflash_config /
at91sam9260ek_dataflash_cs0_config /
at91sam9260ek_dataflash_cs1_config /
at91sam9260ek_config /
at91sam9g20ek_nandflash_config /
at91sam9g20ek_dataflash_cs0_config /
at91sam9g20ek_dataflash_cs1_config /
at91sam9g20ek_config : unconfig
@mkdir -p $(obj)include
@if [ "$(findstring 9g20,$@)" ] ; then /
echo "#define CONFIG_AT91SAM9G20EK 1" >>$(obj)include/config.h ; /
$(XECHO) "... 9G20 Variant" ; /
else /
echo "#define CONFIG_AT91SAM9260EK 1" >>$(obj)include/config.h ; /
fi;
@if [ "$(findstring _nandflash,$@)" ] ; then /
echo "#define CONFIG_SYS_USE_NANDFLASH 1" >>$(obj)include/config.h ; /
$(XECHO) "... with environment variable in NAND FLASH" ; /
elif [ "$(findstring dataflash_cs0,$@)" ] ; then /
echo "#define CONFIG_SYS_USE_DATAFLASH_CS0 1" >>$(obj)include/config.h ; /
$(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; /
else /
echo "#define CONFIG_SYS_USE_DATAFLASH_CS1 1" >>$(obj)include/config.h ; /
$(XECHO) "... with environment variable in SPI DATAFLASH CS1" ; /
fi;
@$(MKCONFIG) -a at91sam9260ek arm arm926ejs at91sam9260ek atmel at91
------------------------------------------
它最后调用了mkconfig,阅读它的代码:
1.它生成的两个文件:include/config.h和include/config.mk。(还有include/autoconf.mk,这个文件是make时生成的,这个文件的内容依赖于板include/configs/配置头文件,例如include/configs/at91sam9260.h)
如果是nandflash选项,它定义了宏CONFIG_SYS_USE_NANDFLASH和宏CONFIG_AT91SAM9260EK;
如果是dataflash选项,它定义宏CONFIG_SYS_USE_DATAFLASH_CS0或CONFIG_SYS_USE_DATAFLASH_CS1和宏CONFIG_AT91SAM9260EK。
####################################
可以使用"mkconfig -n <BOARD_NAME> -a <PARA>
"-n"选项指定板名,"-a"指定附加参数,"-t"没看明白
如果没有指定"-n"选项,则"-a"选项的后面第一项为BORAD_NAME
config.mk中的内容
ARCH = arm #"-a"后面的参数$2
CPU = arm926ejs #"-a"后面的参数$3
BOARD = at91sam9260ek #"-a"后面的参数$4
VENDOR= atmel #"-a"后面的参数$5
SOC = at91 #"-a"后面的参数$6
--------------------------------------------
config.h的内容:
#define CONFIG_AT91SAM9260EK 1 //由"make at91sam9260ek_nandflash"决定,不是mkconfig生成的
#define CONFIG_SYS_USE_NANDFLASH 1 //由"make at91sam9260ek_nandflash"决定,不是mkconfig生成的
#define CONFIG_BOARDDIR board/atmel/at91sam9260ek //由"$5/$4"决定
#include <config_defaults.h> //固定内容
#include <configs/at91sam9260ek.h> //"at91sam9260ek.h"由"$1"决定
#include <asm/config.h> //固定内容
---------------------------------------------------
还生成了几个软连接:
1. "include/asm" --> "arch/$2/include/asm"
2. "include/asm/arch" --> "arch/$2/include/asm/arch-$6" //如果$6为NULL,则为"arch-$3"
3. "include/asm/proc" --> "arch/$2/include/asm/proc-armv" //仅当CPU为arm时
####################################