mkconfig脚本分析

来源:互联网 发布:ubuntu pyqt4下载 编辑:程序博客网 时间:2024/06/05 15:46

mkconfig脚本分析

 

开发板使用的CPU是S5PV210,所以要找uboot中针对S5PV210或者S5PC110进行移植的作为参考。

参考include/configs/s5p_goni.h,对应的board在uboot/board/samsung/goni这个目录。

 

对应的cpu、board文件夹分别为:

cpu: u-boot-2013.10\arch\arm\cpu\armv7

board: u-boot-2013.10\board\samsung\goni

 

在命令行配置uboot时,是:make s5p_goni_config,对应Makefile中的一个目标:

执行上面命令时,其实执行脚本的下面语句:

%_config:: unconfig

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

%_config会把_config替换成空,最终得到BOARD_NAME = s5p_goni

 

sinclude $(obj).boards.depend

$(obj).boards.depend: boards.cfg   ($1 $2 $3 $4的值在此文件中)

@awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@

 

<nobuhiro.iwamatsu.yj@renesas.com>:TetsuyukiKobayashi 

Active  arm   armv7    s5pc1xx    samsung     goni     s5p_goni     -   

 

使用awk正则表达式将boards.cfg中与刚才$1(s5p_goni)能够匹配上的那一行截取出来赋值给变量line,然后将line的内容以空格为间隔依次分开,分别赋值给$1、$2...$8....

 

$1 = Active

$2 = arm

$3 = armv7

$4 = s5pc1xx

$5 = samsung

$6 = goni

$7 = s5p_goni

$8 = -

 

arch=arm   

cpu=armv7

vendor=samsung

soc=s5pc1xx

 

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

# Automatic mode

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

if [ -z "$line" ] ; then

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

exit 1

fi

 

set ${line}

# add default board name if needed

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

fi         -

 

符号链接

(1)include/asm  -> arch/arm/include/asm

(2)include/asm/arch -> include/asm/arch-s5pc1xx

(3)include/asm/proc -> include/asm/proc-armv       

 

Makefile中添加交叉编译工具链

(1)官方原版的uboot中CROSS_COMPLIE是没有定义的,需要自己去定义。如果没定义就直接去编译,就会用gcc编译。

(2)添加一行:

CROSS_COMPILE = /usr/local/arm/arm-2009q3/bin/arm-none-linux-gnueabi-

 

编译过程:

make distclean

make s5p_goni_config

make     

 

移植sd_fusing   在linux下用dd命令烧录脚本来烧录 。   

原创粉丝点击