U-Boot--配置过程分析

时间:2024-07-02 09:38:08

arm核:arm920t    2410

uboot版本:u-boot1.1.6

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

顶层Makefile :

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

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

 #!/bin/sh -e

 # Script to create header files and links to configure
# U-Boot for a specific board.
#
# Parameters: Target Architecture CPU Board [VENDOR] [SOC]
#
# (C) - DENX Software Engineering, Wolfgang Denk <wd@denx.de>
# APPEND=no # Default: Create new config file
BOARD_NAME="" # Name to print in make output while [ $# -gt ] ; do @@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
case "$1" in @因为上面的$(@:_config=)把smdk2410_config的_config替换为空,所以不存在_
--) shift ; break ;; @所以这个循环不动作
-a) shift ; APPEND=yes ;;
-n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
*) break ;;
esac
done [ "${BOARD_NAME}" ] || BOARD_NAME="$1" @BOARD_NAME=smdk2410 [ $# -lt ] && exit
[ $# -gt ] && exit echo "Configuring for ${BOARD_NAME} board..." #
# Create link to architecture specific headers
#
if [ "$SRCTREE" != "$OBJTREE" ] ; then
mkdir -p ${OBJTREE}/include
mkdir -p ${OBJTREE}/include2
cd ${OBJTREE}/include2
rm -f asm
ln -s ${SRCTREE}/include/asm-$ asm
LNPREFIX="../../include2/asm/"
cd ../include
rm -rf asm-$
rm -f asm
mkdir asm-$
ln -s asm-$ asm
else
cd ./include
rm -f asm
ln -s asm-$ asm
fi @@上面是建立或者删除一些目录 rm -f asm-$/arch @rm -f asm-arm/arch if [ -z "$6" -o "$6" = "NULL" ] ; then @$=s3c24x0 不为空 所以执行else
ln -s ${LNPREFIX}arch-$ asm-$/arch
else
ln -s ${LNPREFIX}arch-$ asm-$/arch @LNPREFIX为空 所以相当于ln -s arch-s3c24x0 asm-arm/arch
fi if [ "$2" = "arm" ] ; then
rm -f asm-$/proc
ln -s ${LNPREFIX}proc-armv asm-$/proc
fi #
# Create include file for Make
#
echo "ARCH = $2" > config.mk
echo "CPU = $3" >> config.mk
echo "BOARD = $4" >> config.mk [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk #
# Create board specific header file
#
if [ "$APPEND" = "yes" ] # Append to existing config file
then @APPEND维持原值,所以config.h被重建
echo >> config.h
else
> config.h # Create new config file
fi
echo "/* Automatically generated - do not edit */" >>config.h
echo "#include <configs/$1.h>" >>config.h exit

这样在执行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_