主题 : u-boot中mkconfig请教。 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 11816
精华: 0
发帖: 39
金钱: 195 两
威望: 39 点
贡献值: 0 点
综合积分: 78 分
注册时间: 2009-12-22
最后登录: 2014-01-16
楼主  发表于: 2010-03-30 16:00

 u-boot中mkconfig请教。

在u-boot的mkconfig中有这一段代码,变量ARCH没有定义,请问这代码是什么意思?
if [ "${ARCH}" -a "${ARCH}" != "$2" ]; then
    echo "Failed: \$ARCH=${ARCH}, should be '$2' for ${BOARD_NAME}" 1>&2
    exit 1
fi
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2010-03-30 16:45
在mkconfig的头上加上"set -x", 然后再执行make xxx_config,这样你就知道这个脚本是如何执行的了
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2010-03-30 17:02
如果你对shell脚本感兴趣,可以看看这个
http://www.cyberciti.biz/tips/debugging-shell-script.html
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 11816
精华: 0
发帖: 39
金钱: 195 两
威望: 39 点
贡献值: 0 点
综合积分: 78 分
注册时间: 2009-12-22
最后登录: 2014-01-16
3楼  发表于: 2010-03-30 19:13

 回 2楼(kasim) 的帖子

还是不太明后,不明后其中的“-a”是做什么用的。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
4楼  发表于: 2010-03-30 19:20

 回 3楼(cwzqhdx) 的帖子

and, 并且
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 11816
精华: 0
发帖: 39
金钱: 195 两
威望: 39 点
贡献值: 0 点
综合积分: 78 分
注册时间: 2009-12-22
最后登录: 2014-01-16
5楼  发表于: 2010-03-30 19:36
加入“set -x”后,发现“ARCH”为空,而“$2”不为空,那这样的话,if语句就应该执行啊,可结果不是啊。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2010-03-30 21:40
引用第5楼cwzqhdx于2010-03-30 19:36发表的  :
加入“set -x”后,发现“ARCH”为空,而“$2”不为空,那这样的话,if语句就应该执行啊,可结果不是啊。

是吗?也许你应该去看看shell脚本里关于if语句的定义了
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 11816
精华: 0
发帖: 39
金钱: 195 两
威望: 39 点
贡献值: 0 点
综合积分: 78 分
注册时间: 2009-12-22
最后登录: 2014-01-16
7楼  发表于: 2010-03-31 10:47
哦,现在明后了。谢谢