uboot的配置

来源:互联网 发布:2014年进出口数据 编辑:程序博客网 时间:2024/06/07 19:59

Uboot下载地址:ftp://ftp.denx.de/pub/u-boot/

我下载的是2014-04版本

下载后解压(过程我就不说了)

移植到am335x

 

裁剪;

1.删除arch目录下除arm的所有目录

2.删除arch/arm/cpu目录下的除armv7的所有目录

3.删除arch/arm/cpu/armv7下除am33xxomap*的所有目录

4.删除 arch/arm/include/asmarch-am33xxarch-armv7arch*目录

5.删除boardti的所有目录

 

配置原理:

 

文件:Makefilemkcofnig

 

因为我们开始的时候都是make  *_config,打开Makefile

搜索_config

 

 450 ifeq ($(config-targets),1)

 451 # =========================================================================     ==

 452 # *config targets only - make sure prerequisites are updated, and descend

 453 # in scripts/kconfig to make the *config target

 454

 455 # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.

 456 # KBUILD_DEFCONFIG may point out an alternative default configuration

 457 # used for 'make defconfig'

 458

 459 %_config:: outputmakefile

 460     @$(MKCONFIG) -A $(@:_config=)

 461

 462 else

 463 # =========================================================================     ==

 464 # Build targets only - this includes vmlinux, arch specific targets, clean

 465 # targets and others. In general all targets except *config targets.

 466

 467 # load ARCH, BOARD, and CPU configuration

 468 -include include/config.mk

 

分析脚本:

config-targets 表示make的后缀config,第一步我们make am335x_evm_config,所以为1,成立,第二个make0,不成立,所以直接执行的468行。

首先分析为1的:

 459 %_config:: outputmakefile

 460     @$(MKCONFIG) -A $(@:_config=) //%为匹配符,相当于*@为目标文件

目标文件匹配,所以执行MKCONFIG为当前目录的mkconfig(如果有 O=....输出目录,为输出目录的mkconfig,所以为 执行命令mkconfig  -A  am335x_evm

//$(@:_config=)的意思为将am335x_evm_config替换为am335x_evm

 

然后我们看mkconfig

 

 24 if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then

 25     # Automatic mode

 26     line=`awk '($0 !~ /^#/ && $7 ~ /^'"$2"'$/) { print $1, $2, $3, $4, $5, $    6, $7, $8 }' $srctree/boards.cfg`

 27     if [ -z "$line" ] ; then

 28         echo "make: *** No rule to make target \`$2_config'.  Stop." >&2

 29         exit 1

 30     fi

 31

 32     set ${line}

 33     # add default board name if needed

 34     [ $# = 3 ] && set ${line} ${1}

 35 fi

 

大概意思就是读取./boards.cfg文件,取得am335x所在的行,根据所在行的内容

创建链接

104 # Create link to architecture specific headers

105 #

106 if [ -n "$KBUILD_SRC" ] ; then

107     mkdir -p ${objtree}/include

108     LNPREFIX=${srctree}/arch/${arch}/include/asm/

109     cd ${objtree}/include

110     mkdir -p asm

111 else

112     cd arch/${arch}/include

113 fi

114

115 rm -f asm/arch

116

117 if [ -z "${soc}" ] ; then

118     ln -s ${LNPREFIX}arch-${cpu} asm/arch

119 else

120     ln -s ${LNPREFIX}arch-${soc} asm/arch

121 fi

122

123 if [ "${arch}" = "arm" ] ; then

124     rm -f asm/proc

125     ln -s ${LNPREFIX}proc-armv asm/proc

126 fi

127

128 if [ -z "$KBUILD_SRC" ] ; then

129     cd ${srctree}/include

130 fi

 

创建include/config.mk

132 #

133 # Create include file for Make

134 #

135 ( echo "ARCH   = ${arch}"

136     if [ ! -z "$spl_cpu" ] ; then

137     echo 'ifeq ($(CONFIG_SPL_BUILD),y)'

138     echo "CPU    = ${spl_cpu}"

139     echo "else"

140     echo "CPU    = ${cpu}"

141     echo "endif"

142     else

143     echo "CPU    = ${cpu}"

144     fi

145     echo "BOARD  = ${board}"

146

147     [ "${vendor}" ] && echo "VENDOR = ${vendor}"

148     [ "${soc}"    ] && echo "SOC    = ${soc}"

149     exit 0 ) > config.mk

 

 

创建include/config.h

158 #

159 # Create board specific header file

160 #

161 if [ "$APPEND" = "yes" ]    # Append to existing config file

162 then

163     echo >> config.h

164 else

165     > config.h      # Create new config file

166 fi

167 echo "/* Automatically generated - do not edit */" >>config.h

168

169 for i in ${TARGETS} ; do

170     i="`echo ${i} | sed '/=/ {s/=/  /;q; } ; { s/$/ 1/; }'`"

171     echo "#define CONFIG_${i}" >>config.h ;

172 done

173

174 echo "#define CONFIG_SYS_ARCH  \"${arch}\""  >> config.h

175 echo "#define CONFIG_SYS_CPU   \"${cpu}\""   >> config.h

176 echo "#define CONFIG_SYS_BOARD \"${board}\"" >> config.h

177

178 [ "${vendor}" ] && echo "#define CONFIG_SYS_VENDOR \"${vendor}\"" >> config.h

179

180 [ "${soc}"    ] && echo "#define CONFIG_SYS_SOC    \"${soc}\""    >> config.h

181

182 [ "${board}"  ] && echo "#define CONFIG_BOARDDIR board/$BOARDDIR" >> config.h

183 cat << EOF >> config.h

184 #include <config_cmd_defaults.h>

185 #include <config_defaults.h>

186 #include <configs/${CONFIG_NAME}.h>

187 #include <asm/config.h>

188 #include <config_fallbacks.h>

189 #include <config_uncmd_spl.h>

190 EOF

191

192 exit 0

 

我么可以查看include/config.h文件

  1 /* Automatically generated - do not edit */

  2 #define CONFIG_SERIAL1  1

  3 #define CONFIG_CONS_INDEX   1

  4 #define CONFIG_NAND 1

  5 #define CONFIG_SYS_ARCH  "arm"

  6 #define CONFIG_SYS_CPU   "armv7"

  7 #define CONFIG_SYS_BOARD "am335x"

  8 #define CONFIG_SYS_VENDOR "ti"

  9 #define CONFIG_SYS_SOC    "am33xx"

 10 #define CONFIG_BOARDDIR board/ti/am335x

 11 #include <config_cmd_defaults.h>

 12 #include <config_defaults.h>

 13 #include <configs/am335x_evm.h>

 14 #include <asm/config.h>

 15 #include <config_fallbacks.h>

 16 #include <config_uncmd_spl.h>

 

其中的#include <configs/am335x_evm.h>就是它的配置文件,配置文件的

#define CONFIG_SYS_LDSCRIPT     "board/ti/am335x/u-boot.lds"

为它的启动脚本。

原创粉丝点击