Uboot Makefile
%_config:: outputmakefile
@$(MKCONFIG) -A $(@:_config=)
/*%通配符 dra7xx_evm_qspiboot_config
${VAR:_config=}:把Var中的尾部_config用空來替換變成dra7xx_evm_qspiboot
mkconfig -A dra7xx_evm_qspiboot*/
uboot mkconfig
line=`awk '($0 !~ /^#/ && $7 ~ /^'"dra7xx_evm_qspiboot"'$/) { print $1, $2, $3, $4, $5, $6, $7, $8 }' boards.cfg`
/*此個awk就是爲了得到boards.cfg內含有dra7xx_evm_qspiboot的行的所有參數,中間用空格隔開
Active arm armv7 omap5 ti dra7xx dra7xx_evm_qspiboot dra7xx_evm:CONS_INDEX=1,QSPI_BOO*/
set ${line}
/*set Active arm armv7 omap5 ti dra7xx dra7xx_evm_qspiboot dra7xx_evm:CONS_INDEX=1,QSPI_BOO 八個參數*/
# add default board name if needed
[ $# = 3 ] && set ${line} ${1}
fi
/*$#=8,$1=Active while 直接break跳出*/
while [ $# -gt 0 ] ; do
case "$1" in
--) shift ; break ;;
-a) shift ; APPEND=yes ;;
-n) shift ; BOARD_NAME="${7%_config}" ; shift ;;
-t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
*) break ;;
esac
done
/*參數低於7大於8就退出*/
[ $# -lt 7 ] && exit 1
[ $# -gt 8 ] && exit 1
/*$7 =dra7xx_evm_qspiboot CONFIG_NAME=dra7xx_evm_qspiboot*/
CONFIG_NAME="${7%_config}"
52
/*如果BOARD_NAME已經設置了,就保留,如果沒設置就BOARD_NAME=dra7xx_evm_qspiboot*/
53 [ "${BOARD_NAME}" ] || BOARD_NAME="${7%_config}"
54
/*arch=arm*/
55 arch="$2"
/*如果有splcpu armv7:arm623el 此時無cpu=armv7*/
56 cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
/*spl_cpu =空*/
57 spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
58
59 if [ "$cpu" = "-" ] ; then
60 cpu=
61 fi
62 /*board=dra7xx verdor=ti soc=omap5*/
63 [ "$6" != "-" ] && board="$6"
64 [ "$5" != "-" ] && vendor="$5"
65 [ "$4" != "-" ] && soc="$4"
/*測試如果大於7或者$8!="-"全部滿足,tmp="${8%:*}" 意味着tmp=dra7xx_evm CONFIG_NAME=dra7xx_evm
options=${8#*:}把:前面的去掉賦值給options=CONS_INDEX=1,QSPI_BOO
echo ${options} | sed 's:,: :g' 把逗號去掉TARGETS=CONS_INDEX=1 QSPI_BOO*/
[ $# -gt 7 ] && [ "$8" != "-" ] && {
# check if we have a board config name in the options field
# the options field mave have a board config name and a list
# of options, both separated by a colon (':'); the options are
# separated by commas (',').
#
# Check for board name
tmp="${8%:*}"
if [ "$tmp" ] ; then
CONFIG_NAME="$tmp"
fi
# Check if we only have a colon...
if [ "${tmp}" != "$8" ] ; then
options=${8#*:}
TARGETS="`echo ${options} | sed 's:,: :g'` ${TARGETS}"
fi
}
/*判斷ARCH存在,並且不等於arch條件不滿足退出*/
if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then
echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2
exit 1
fi
#
# Test above needed aarch64, now we need arm
#
/*如果arch=aarch64 需要把arch=arm*/
if [ "${arch}" = "aarch64" ]; then
arch="arm"
fi
if [ "$options" ] ; then
echo "Configuring for ${BOARD_NAME} - Board: ${CONFIG_NAME}, Options: ${options}"
else
echo "Configuring for ${BOARD_NAME} board..."
fi
#
# Create link to architecture specific headers
#
/*在makefile中我們已經知道SRCTREE和OBJTREE都是當前目錄,所以這裏執行else 進入include文件夾*/
if [ -n "$KBUILD_SRC" ] ; then
mkdir -p ${objtree}/include
LNPREFIX=${srctree}/arch/${arch}/include/asm/
cd ${objtree}/include
mkdir -p asm
else
cd arch/${arch}/include
fi
/*刪除asm下的arch目錄*/
rm -f asm/arch
/*創建鏈接文件目錄 ln -s arch-omap5 asm/arch ln -s arch-armv7 asm/arch */
if [ "${soc}" ] ; then
ln -s ${LNPREFIX}arch-${soc} asm/arch
elif [ "${cpu}" ] ; then
ln -s ${LNPREFIX}arch-${cpu} asm/arch
fi
if [ -z "$KBUILD_SRC" ] ; then
cd ${srctree}/include
fi
#
# Create include file for Make
#
/* include/config.mk
1 ARCH =arm
2 CPU = armv7
3 BOARD = dra7xx
4 VENDOR = ti
5 SOC = omap5*/
( echo "ARCH = ${arch}"
if [ ! -z "$spl_cpu" ] ; then
echo 'ifeq ($(CONFIG_SPL_BUILD),y)'
echo "CPU = ${spl_cpu}"
echo "else"
echo "CPU = ${cpu}"
echo "endif"
else
echo "CPU = ${cpu}"
fi
echo "BOARD = ${board}"
[ "${vendor}" ] && echo "VENDOR = ${vendor}"
[ "${soc}" ] && echo "SOC = ${soc}"
exit 0 ) > config.mk
# Assign board directory to BOARDIR variable
if [ -z "${vendor}" ] ; then
BOARDDIR=${board}
else
BOARDDIR=${vendor}/${board}
fi
/*創建config.h
2 #define CONFIG_CONS_INDEX 1
3 #define CONFIG_QSPI_BOOT 1
4 #define CONFIG_SYS_ARCH "arm"
5 #define CONFIG_SYS_CPU "armv7"
6 #define CONFIG_SYS_BOARD "dra7xx"
7 #define CONFIG_SYS_VENDOR "ti"
8 #define CONFIG_SYS_SOC "omap5"
9 #define CONFIG_BOARDDIR board/ti/dra7xx
10 #include <config_cmd_defaults.h>
11 #include <config_defaults.h>
12 #include <configs/dra7xx_evm.h>
13 #include <asm/config.h>
14 #include <config_fallbacks.h>
15 #include <config_uncmd_spl.h>
*/
#
# Create board specific header file
#
if [ "$APPEND" = "yes" ] # Append to existing config file
then
echo >> config.h
else
> config.h # Create new config file
fi
echo "/* Automatically generated - do not edit */" >>config.h
for i in ${TARGETS} ; do
i="`echo ${i} | sed '/=/ {s/=/ /;q; } ; { s/$/ 1/; }'`"
echo "#define CONFIG_${i}" >>config.h ;
done
echo "#define CONFIG_SYS_ARCH \"${arch}\"" >> config.h
echo "#define CONFIG_SYS_CPU \"${cpu}\"" >> config.h
echo "#define CONFIG_SYS_BOARD \"${board}\"" >> config.h
[ "${vendor}" ] && echo "#define CONFIG_SYS_VENDOR \"${vendor}\"" >> config.h
[ "${soc}" ] && echo "#define CONFIG_SYS_SOC \"${soc}\"" >> config.h
[ "${board}" ] && echo "#define CONFIG_BOARDDIR board/$BOARDDIR" >> config.h
cat << EOF >> config.h
#include <config_cmd_defaults.h>
#include <config_defaults.h>
#include <configs/${CONFIG_NAME}.h>
#include <asm/config.h>
#include <config_fallbacks.h>
#include <config_uncmd_spl.h>
EOF
exit 0
/*mkconfig 腳本解析boards.cfg 創建頭文件鏈接,config.mk config.h
make xxx_config後,主要的變化是多了幾個文件:
1.include/asm --> arch/arm/include/arm
2.include/asm/arch --> arch-omap5
4.在include目錄下新建了config.mk文件,文件內容是ARCH CPU BOARD VENDOR SOC的定義
5.在include目錄下新建了config.h文件*/
針對dra7xx_evm_qspiboot_config 解析uboot mkconfig
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
S5PV210開發板底層軟件移植 (1) U-BOOT
lyndon2013
2018-08-27 05:37:40
U-BOOT.2009.08中TFTP時Retry count exceeded; starting again 解決方法
atower_boy
2018-08-26 10:18:37
mkimage使用詳解
atower_boy
2018-08-26 10:18:19
Linux 內核 Starting kernel ... 串口無輸出問題歸納總結
atower_boy
2018-08-26 10:18:19
uboot-的start.S詳細註解及分析
lyf_1203
2018-08-25 10:56:09
typedef int (init_fnc_t) (void)和typedef int (*init_fnc_t) (void)
lyf_1203
2018-08-25 10:56:09
UBOOT問題收集--balignl 16, 0xdeadbeef
lyf_1203
2018-08-25 10:56:09
uboot第2階段分析 start_armboot
lyf_1203
2018-08-25 10:56:07
UBOOT timer設置(基於S3C2440)
-贤-
2018-08-24 22:25:30
常用u-boot命令詳解(全)
-贤-
2018-08-24 22:25:07
UBOOT時鐘配置(基於mini2440)
-贤-
2018-08-24 22:25:07
uboot源碼分析(3)
ufo714
2018-08-23 19:44:24