首页 > 代码库 > U-Boot--配置过程分析

U-Boot--配置过程分析

arm核:arm920t    2410

uboot版本:u-boot1.1.6

 

通过readme可以知道配置执行make smdk2410_config命令。

顶层Makefile :

1 smdk2410_config    :    unconfig2     @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0

上面将smdk2410   arm   arm920t   smdk2410   null   s3c2x0 六个参数穿个mkconfig.下面看顶层mkconfig文件:

 1 #!/bin/sh -e 2  3 # Script to create header files and links to configure 4 # U-Boot for a specific board. 5 # 6 # Parameters:  Target  Architecture  CPU  Board [VENDOR] [SOC] 7 # 8 # (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de> 9 #10 11 APPEND=no    # Default: Create new config file12 BOARD_NAME=""    # Name to print in make output13 14 while [ $# -gt 0 ] ; do          @@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x015     case "$1" in             @因为上面的$(@:_config=)把smdk2410_config的_config替换为空,所以不存在_16     --) shift ; break ;;     @所以这个循环不动作17     -a) shift ; APPEND=yes ;;18     -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;      19     *)  break ;;20     esac21 done22 23 [ "${BOARD_NAME}" ] || BOARD_NAME="$1"     @BOARD_NAME=smdk241024 25 [ $# -lt 4 ] && exit 126 [ $# -gt 6 ] && exit 127 28 echo "Configuring for ${BOARD_NAME} board..."29 30 #31 # Create link to architecture specific headers32 #33 if [ "$SRCTREE" != "$OBJTREE" ] ; then34     mkdir -p ${OBJTREE}/include35     mkdir -p ${OBJTREE}/include236     cd ${OBJTREE}/include237     rm -f asm38     ln -s ${SRCTREE}/include/asm-$2 asm39     LNPREFIX="../../include2/asm/"40     cd ../include41     rm -rf asm-$242     rm -f asm43     mkdir asm-$244     ln -s asm-$2 asm45 else46     cd ./include47     rm -f asm48     ln -s asm-$2 asm49 fi                               @@上面是建立或者删除一些目录50 51 rm -f asm-$2/arch                @rm -f asm-arm/arch52 53 if [ -z "$6" -o "$6" = "NULL" ] ; then          @$6=s3c24x0  不为空  所以执行else54     ln -s ${LNPREFIX}arch-$3 asm-$2/arch55 else56     ln -s ${LNPREFIX}arch-$6 asm-$2/arch    @LNPREFIX为空 所以相当于ln -s arch-s3c24x0 asm-arm/arch57 fi58 59 if [ "$2" = "arm" ] ; then60     rm -f asm-$2/proc61     ln -s ${LNPREFIX}proc-armv asm-$2/proc62 fi63 64 #65 # Create include file for Make66 #67 echo "ARCH   = $2" >  config.mk68 echo "CPU    = $3" >> config.mk69 echo "BOARD  = $4" >> config.mk70 71 [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk72 73 [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC    = $6" >> config.mk74 75 #76 # Create board specific header file77 #78 if [ "$APPEND" = "yes" ]    # Append to existing config file79 then                @APPEND维持原值,所以config.h被重建80     echo >> config.h81 else82     > config.h        # Create new config file83 fi84 echo "/* Automatically generated - do not edit */" >>config.h85 echo "#include <configs/$1.h>" >>config.h86 87 exit 0

这样在执行make smdk2410_config后,在include下面主要添改了四个文件(夹)分别是config.h,   config.mk,   asm-arm/ ,  asm/

其中config.h全部内容如下:

#include<configs/smdk2410.h>

其中config.mk文件内容如下四行

ARCH           =arm

CPU             =arm920t

BOARD        =smdk2410

SOC            =s3c24x0

 

 

由此总结执行make  smdk2410_config配置的结果:

1》开发板名称BOARD_NAME=$1

2》建立asm-arm/ ,  asm/和指向到链接

3》创建config.h,定向到开发板smdk2410.h

4》创建config.mk  

 

 

注意config/下的头文件(包含smdk2410.h)等有两种

1》选项   前缀是CONFIG_

2》参数   前缀是CFG_

 

U-Boot--配置过程分析