QT210 -> u-boot-samsung-dev中的mkconfig文件注释

此文件是根据smdkv210single_config配置进行过删减,可生成smdkv210single_config配置的uboot镜像,其它配置被删除,仅供参考。

#!/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) 2002-2006 DENX Software Engineering, Wolfgang Denk <[email protected]>
#

APPEND=no	# Default: Create new config file
BOARD_NAME=""	# Name to print in make output

# 对于配置为smdkv210single_config,这里的参数从$1开始依次为:
# $1             $2  $3      $4       $5      $6
# smdkv210single arm s5pc11x smdkc110 samsung s5pc110
# $# 引用变量的总数量是多少
# 当变量总数大于0
while [ $# -gt 0 ] ; do
# $1 第一个变量
	case "$1" in
# 如果第一个变量值是 --。shift变量顺序左移,以前的$2变为$1,$3变为$2,依次类推。break退出循环。;;结束case分支。
	--) shift ; break ;;
# 如果第一个变量值是 -a。
	-a) shift ; APPEND=yes ;;
# 如果第一个变量值是 -n,变量顺序左移。${1%%_config} 从$1的尾部开始删除与_config匹配的最长部分,然后返回剩余部分。变量顺序左移
	-n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
# 如果第一个变量值是 其它,退出循环 。
	*)  break ;;
	esac
done
# 按照传进来的参数,上面的循环直接退出

# 如果${BOARD_NAME}值为空,则BOARD_NAME="$1"。这里为:BOARD_NAME=smdkv210single
[ "${BOARD_NAME}" ] || BOARD_NAME="$1"

# 假如参数个数小于4,退出脚本,设置退出码为1
[ $# -lt 4 ] && exit 1
# 假如参数个数大于6,退出脚本,设置退出码为1
[ $# -gt 6 ] && exit 1

# 这里输出:Configuring for smdkv210single board...
echo "Configuring for ${BOARD_NAME} board..."

#
# Create link to architecture specific headers
#
# 假如$SRCTREE不等于$OBJTREE。这里相等,两个变量的值都为此文件的所在 目录的路径
if [ "$SRCTREE" != "$OBJTREE" ] ; then
	mkdir -p ${OBJTREE}/include
	mkdir -p ${OBJTREE}/include2
	cd ${OBJTREE}/include2
	rm -f asm
	ln -s ${SRCTREE}/include/asm-$2 asm
	LNPREFIX="../../include2/asm/"
	cd ../include
	rm -rf asm-$2
	rm -f asm
	mkdir asm-$2
	ln -s asm-$2 asm
else
# 进入include目录
	cd ./include
# 删除asm。-f意思为:忽略不存在的文件,不提示
	rm -f asm
# 这里是asm符号链接到asm-arm。-s意思为:制作符号链接代替硬链接
	ln -s asm-$2 asm
fi

# 这里是删除asm-arm/arch
rm -f asm-$2/arch

# 假如$6为空,或值为NULL。这里$6值为:s5pc110
if [ -z "$6" -o "$6" = "NULL" ] ; then
	ln -s ${LNPREFIX}arch-$3 asm-$2/arch
else
#创建符号链接。这里是asm-arm/arch链接到arch-s5pc110
	ln -s ${LNPREFIX}arch-$6 asm-$2/arch
fi

# create link for s5pc11x SoC
# 假如$3等于s5pc11x。这里$3值为:s5pc11x,相等
if [ "$3" = "s5pc11x" ] ; then
# 删除reg.h
        rm -f regs.h
# 创建符号链接。reg.h链接到s5pc110.h
        ln -s $6.h regs.h
# 删除asm-arm/arch
        rm -f asm-$2/arch
# 创建符号链接。arch-s5pc11x链接到asm-arm/arch
        ln -s arch-$3 asm-$2/arch
fi

# 假如$2等于arm。这里$2值为:arm,相等
if [ "$2" = "arm" ] ; then
# 删除asm-arm/proc
	rm -f asm-$2/proc
# 创建符号链接。asm-arm/proc链接到proc-armv
	ln -s ${LNPREFIX}proc-armv asm-$2/proc
fi

#
# Create include file for Make
#
# 创建新文件:config.mk,写入:ARCH   = arm
echo "ARCH   = $2" >  config.mk
# 向文件:config.mk中添加一行,内容为:CPU    = s5pc11x
echo "CPU    = $3" >> config.mk
# 向文件:config.mk中添加一行,内容为:BOARD  = smdkc110
echo "BOARD  = $4" >> config.mk
# 假如$5存在,且不为字符串"NULL",向文件:config.mk中添加一行,内容为:VENDOR = samsung
[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
# 假如$6存在,且不为字符串"NULL",向文件:config.mk中添加一行,内容为:SOC    = s5pc110
[ "$6" ] && [ "$6" != "NULL" ] && echo "SOC    = $6" >> config.mk

#
# Create board specific header file
#
# 假如$APPEND等于yes。这里等于no,见文件开始处。
if [ "$APPEND" = "yes" ]	# Append to existing config file
then
# 添加空行
	echo >> config.h
else
# 创建新文件
	> config.h		# Create new config file
fi
# 将字符串"/* Automatically generated - do not edit */"添加到文件config.h中
echo "/* Automatically generated - do not edit */" >>config.h
# 将字符串"#include <configs/$1.h>"添加到文件config.h中
echo "#include <configs/$1.h>" >>config.h

# 退出,退出码:0
exit 0


你可能感兴趣的:(QT210 -> u-boot-samsung-dev中的mkconfig文件注释)