免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1276 | 回复: 0
打印 上一主题 下一主题

uboot 中 mkconfig 分析 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-08 16:59 |只看该作者 |倒序浏览
对于
mini2440_config :       unconfig
        @$(MKCONFIG) $(@:_config=) arm arm920t mini2440 NULL s3c24x0

实际执行:
./mkconfig mini2440 arm arm920t mini2440 NULL s3c24x0

以下分析mkconfig作用:
1. 确定开发板名称
11 APPEND=no       # Default: Create new config file
12 BOARD_NAME=""   # Name to print in make output
13
14 while [ $# -gt 0 ] ; do
15         case "$1" in
16         --) shift ; break ;;
17         -a) shift ; APPEND=yes ;;
18         -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
19         *)  break ;;
20         esac
21 done
22
23 [ "${BOARD_NAME}" ] || BOARD_NAME="$1"

$1 = mini2440, 参数中没有 -a, -n 等参数,所以14-21行没有执行.
BOARD_NAME = mini2440
2.创建发平台/开板头文件连接

30 #
31 # Create link to architecture specific headers
32 #
33 if [ "$SRCTREE" != "$OBJTREE" ] ; then
34         mkdir -p ${OBJTREE}/include
35         mkdir -p ${OBJTREE}/include2
36         cd ${OBJTREE}/include2
37         rm -f asm
38         ln -s ${SRCTREE}/include/asm-$2 asm
39         LNPREFIX="../../include2/asm/"
40         cd ../include
41         rm -rf asm-$2
42         rm -f asm
43         mkdir asm-$2
44         ln -s asm-$2 asm
45 else
46         cd ./include
47         rm -f asm
48         ln -s asm-$2 asm
49 fi

if [ "$SRCTREE" != "$OBJTREE" ] 判断源代码与目标文件目录是否一样,否则删除
/include/asm ,建立asm 连接到asm-arm.
51 rm -f asm-$2/arch
52
53 if [ -z "$6" -o "$6" = "NULL" ] ; then
54         ln -s ${LNPREFIX}arch-$3 asm-$2/arch
55 else
56         ln -s ${LNPREFIX}arch-$6 asm-$2/arch
57 fi
58
59 if [ "$2" = "arm" ] ; then
60         rm -f asm-$2/proc
61         ln -s ${LNPREFIX}proc-armv asm-$2/proc
62 fi

执行ln -s arch-s3c24x0 asm-arm-arch, ln -s proc-armv asm-arm/proc
3.创建顶层Makefile 包含的头文件include/config.mk
65 # Create include file for Make
66 #
67 echo "ARCH   = $2" >  config.mk
68 echo "CPU    = $3" >> config.mk
69 echo "BOARD  = $4" >> config.mk
70
71 [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
72
73 [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC    = $6" >> config.mk
执行后config.mk 内容如下:
ARCH = arm, CPU = arm920t, BOADR = mini2440, SOC = s3c24x0

# Create board specific header file
77 #
78 if [ "$APPEND" = "yes" ]        # Append to existing config file
79 then
80         echo >> config.h
81 else
82         > config.h              # Create new config file
83 fi
84 echo "/* Automatically generated - do not edit */" >>config.h
85 echo "#include " >>config.h
执行后config内容如下:
/* Automatically generated - do not edit */
#include



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/94311/showart_2021859.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP