Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
e1b72961
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e1b72961
编写于
9月 13, 2005
作者:
W
Wolfgang Denk
浏览文件
操作
浏览文件
下载
差异文件
Add support for mtddevnum and mtddevname variables (mtdparts command)
[Merge with /home/m8/git/u-boot]
上级
670d9f13
7d45477b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
9 deletion
+71
-9
CHANGELOG
CHANGELOG
+2
-0
common/cmd_jffs2.c
common/cmd_jffs2.c
+69
-9
未找到文件。
CHANGELOG
浏览文件 @
e1b72961
...
...
@@ -2,6 +2,8 @@
Changes for U-Boot 1.1.4:
======================================================================
* Added support for mtddevnum and mtddevname variables (mtdparts command)
* Change default console baud rate for stxxtc board
* Add I2C support to TQM8540 and TQM8560 boards (EEPROM, RTC, LM75-DTT).
...
...
common/cmd_jffs2.c
浏览文件 @
e1b72961
...
...
@@ -237,6 +237,46 @@ static void memsize_format(char *buf, u32 size)
sprintf
(
buf
,
"%lu"
,
size
);
}
/**
* This routine does global indexing of all partitions. Resulting index for
* current partition is saved in 'mtddevnum'. Current partition name in
* 'mtddevname'.
*/
static
void
index_partitions
(
void
)
{
char
buf
[
16
];
u16
mtddevnum
;
struct
part_info
*
part
;
struct
list_head
*
dentry
;
struct
mtd_device
*
dev
;
DEBUGF
(
"--- index partitions ---
\n
"
);
if
(
current_dev
)
{
mtddevnum
=
0
;
list_for_each
(
dentry
,
&
devices
)
{
dev
=
list_entry
(
dentry
,
struct
mtd_device
,
link
);
if
(
dev
==
current_dev
)
{
mtddevnum
+=
current_partnum
;
sprintf
(
buf
,
"%d"
,
mtddevnum
);
setenv
(
"mtddevnum"
,
buf
);
break
;
}
mtddevnum
+=
dev
->
num_parts
;
}
part
=
jffs2_part_info
(
current_dev
,
current_partnum
);
setenv
(
"mtddevname"
,
part
->
name
);
DEBUGF
(
"=> mtddevnum %d,
\n
=> mtddevname %s
\n
"
,
mtddevnum
,
part
->
name
);
}
else
{
setenv
(
"mtddevnum"
,
NULL
);
setenv
(
"mtddevname"
,
NULL
);
DEBUGF
(
"=> mtddevnum NULL
\n
=> mtddevname NULL
\n
"
);
}
}
/**
* Save current device and partition in environment variable 'partition'.
*/
...
...
@@ -260,6 +300,7 @@ static void current_save(void)
DEBUGF
(
"=> partition NULL
\n
"
);
}
index_partitions
();
}
/**
...
...
@@ -398,6 +439,8 @@ static int part_validate(struct mtdids *id, struct part_info *part)
*/
static
int
part_del
(
struct
mtd_device
*
dev
,
struct
part_info
*
part
)
{
u8
current_save_needed
=
0
;
/* if there is only one partition, remove whole device */
if
(
dev
->
num_parts
==
1
)
return
device_del
(
dev
);
...
...
@@ -414,20 +457,23 @@ static int part_del(struct mtd_device *dev, struct part_info *part)
if
(
curr_pi
==
part
)
{
printf
(
"current partition deleted, resetting current to 0
\n
"
);
current_partnum
=
0
;
current_save
();
}
else
if
(
part
->
offset
<=
curr_pi
->
offset
)
{
current_partnum
--
;
current_save
();
}
current_save_needed
=
1
;
}
}
jffs2_free_cache
(
part
);
list_del
(
&
part
->
link
);
free
(
part
);
dev
->
num_parts
--
;
if
(
current_save_needed
>
0
)
current_save
();
else
index_partitions
();
return
0
;
}
...
...
@@ -469,6 +515,8 @@ static int part_sort_add(struct mtd_device *dev, struct part_info *part)
if
(
list_empty
(
&
dev
->
parts
))
{
DEBUGF
(
"part_sort_add: list empty
\n
"
);
list_add
(
&
part
->
link
,
&
dev
->
parts
);
dev
->
num_parts
++
;
index_partitions
();
return
0
;
}
...
...
@@ -492,18 +540,23 @@ static int part_sort_add(struct mtd_device *dev, struct part_info *part)
if
(
new_pi
->
offset
<=
pi
->
offset
)
{
list_add_tail
(
&
part
->
link
,
entry
);
dev
->
num_parts
++
;
if
(
curr_pi
&&
(
pi
->
offset
<=
curr_pi
->
offset
))
{
/* we are modyfing partitions for the current
* device, update current */
current_partnum
++
;
current_save
();
}
else
{
index_partitions
();
}
return
0
;
}
}
list_add_tail
(
&
part
->
link
,
&
dev
->
parts
);
dev
->
num_parts
++
;
index_partitions
();
return
0
;
}
...
...
@@ -524,7 +577,6 @@ static int part_add(struct mtd_device *dev, struct part_info *part)
if
(
part_sort_add
(
dev
,
part
)
!=
0
)
return
1
;
dev
->
num_parts
++
;
return
0
;
}
...
...
@@ -735,9 +787,10 @@ static int device_del(struct mtd_device *dev)
current_partnum
=
0
;
}
current_save
();
return
0
;
}
index_partitions
();
return
0
;
}
...
...
@@ -771,13 +824,20 @@ static struct mtd_device* device_find(u8 type, u8 num)
*/
static
void
device_add
(
struct
mtd_device
*
dev
)
{
u8
current_save_needed
=
0
;
if
(
list_empty
(
&
devices
))
{
current_dev
=
dev
;
current_partnum
=
0
;
current_save
()
;
current_save
_needed
=
1
;
}
list_add_tail
(
&
dev
->
link
,
&
devices
);
if
(
current_save_needed
>
0
)
current_save
();
else
index_partitions
();
}
/**
...
...
@@ -896,7 +956,7 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_
}
memset
(
dev
,
0
,
sizeof
(
struct
mtd_device
));
dev
->
id
=
id
;
dev
->
num_parts
=
num_parts
;
dev
->
num_parts
=
0
;
/* part_sort_add increments num_parts */
INIT_LIST_HEAD
(
&
dev
->
parts
);
INIT_LIST_HEAD
(
&
dev
->
link
);
...
...
@@ -1548,7 +1608,7 @@ int mtdparts_init(void)
ids_changed
=
1
;
if
(
parse_mtdids
(
ids
)
!=
0
)
{
device
_delall
(
&
devices
);
device
s_init
(
);
return
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录