Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
eb72f78c
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
eb72f78c
编写于
6月 25, 2021
作者:
O
openharmony_ci
提交者:
Gitee
6月 25, 2021
浏览文件
操作
浏览文件
下载
差异文件
!363 userfs分区的起始地址与大小改为通过bootargs配置
Merge pull request !363 from JING/rootfs
上级
12577ead
2e2b1420
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
31 addition
and
11 deletion
+31
-11
kernel/common/los_rootfs.c
kernel/common/los_rootfs.c
+31
-11
未找到文件。
kernel/common/los_rootfs.c
浏览文件 @
eb72f78c
...
...
@@ -106,7 +106,7 @@ struct disk_divide_info *StorageBlockGetEmmc(void);
struct
block_operations
*
StorageBlockGetMmcOps
(
void
);
char
*
StorageBlockGetEmmcNodeName
(
void
*
block
);
STATIC
const
CHAR
*
AddEmmcRootfsPart
(
INT32
rootAddr
,
INT32
rootSize
)
STATIC
const
CHAR
*
AddEmmcRootfsPart
(
INT32
rootAddr
,
INT32
rootSize
,
INT32
userAddr
,
INT32
userSize
)
{
INT32
ret
;
...
...
@@ -123,8 +123,8 @@ STATIC const CHAR *AddEmmcRootfsPart(INT32 rootAddr, INT32 rootSize)
PRINT_ERR
(
"Failed to add mmc root partition!
\n
"
);
return
NULL
;
}
else
{
UINT64
storageStartCnt
=
(
rootAddr
+
rootSize
)
/
EMMC_SEC_SIZE
;
UINT64
storageSizeCnt
=
STORAGE_SIZE
/
EMMC_SEC_SIZE
;
UINT64
storageStartCnt
=
userAddr
/
EMMC_SEC_SIZE
;
UINT64
storageSizeCnt
=
userSize
/
EMMC_SEC_SIZE
;
UINT64
userdataStartCnt
=
storageStartCnt
+
storageSizeCnt
;
UINT64
userdataSizeCnt
=
g_emmcDisk
->
sector_count
-
userdataStartCnt
;
ret
=
add_mmc_partition
(
emmc
,
storageStartCnt
,
storageSizeCnt
);
...
...
@@ -150,7 +150,7 @@ STATIC const CHAR *AddEmmcRootfsPart(INT32 rootAddr, INT32 rootSize)
}
#endif
STATIC
const
CHAR
*
GetDevName
(
const
CHAR
*
rootType
,
INT32
rootAddr
,
INT32
rootSize
)
STATIC
const
CHAR
*
GetDevName
(
const
CHAR
*
rootType
,
INT32
rootAddr
,
INT32
rootSize
,
INT32
userAddr
,
INT32
userSize
)
{
const
CHAR
*
rootDev
=
NULL
;
...
...
@@ -162,7 +162,7 @@ STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSi
PRINT_ERR
(
"Failed to add spinor/spinand root partition!
\n
"
);
}
else
{
rootDev
=
FLASH_DEV_NAME
;
ret
=
add_mtd_partition
(
FLASH_TYPE
,
(
rootAddr
+
rootSize
),
STORAGE_SIZE
,
SECOND_MTD_PART_NUM
);
ret
=
add_mtd_partition
(
FLASH_TYPE
,
userAddr
,
userSize
,
SECOND_MTD_PART_NUM
);
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"Failed to add spinor/spinand storage partition!
\n
"
);
}
...
...
@@ -189,7 +189,7 @@ STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSi
#ifdef LOSCFG_STORAGE_EMMC
if
(
strcmp
(
rootType
,
"emmc"
)
==
0
)
{
rootDev
=
AddEmmcRootfsPart
(
rootAddr
,
rootSize
);
rootDev
=
AddEmmcRootfsPart
(
rootAddr
,
rootSize
,
userAddr
,
userSize
);
}
else
#endif
...
...
@@ -341,12 +341,14 @@ ERROUT:
return
LOS_NOK
;
}
STATIC
INT32
MatchRootInfo
(
CHAR
*
p
,
CHAR
**
rootType
,
CHAR
**
fsType
,
INT32
*
rootAddr
,
INT32
*
rootSize
)
STATIC
INT32
MatchRootInfo
(
CHAR
*
p
,
CHAR
**
rootType
,
CHAR
**
fsType
,
INT32
*
rootAddr
,
INT32
*
rootSize
,
INT32
*
userAddr
,
INT32
*
userSize
)
{
const
CHAR
*
rootName
=
"root="
;
const
CHAR
*
fsName
=
"fstype="
;
const
CHAR
*
rootAddrName
=
"rootaddr="
;
const
CHAR
*
rootSizeName
=
"rootsize="
;
const
CHAR
*
userAddrName
=
"useraddr="
;
const
CHAR
*
userSizeName
=
"usersize="
;
if
((
*
rootType
==
NULL
)
&&
(
strncmp
(
p
,
rootName
,
strlen
(
rootName
))
==
0
))
{
*
rootType
=
strdup
(
p
+
strlen
(
rootName
));
...
...
@@ -378,10 +380,24 @@ STATIC INT32 MatchRootInfo(CHAR *p, CHAR **rootType, CHAR **fsType, INT32 *rootA
}
}
if
(
*
userAddr
<
0
)
{
if
(
MatchRootPos
(
p
,
userAddrName
,
userAddr
)
!=
LOS_OK
)
{
return
LOS_NOK
;
}
else
if
(
*
userAddr
>=
0
)
{
return
LOS_OK
;
}
}
if
(
*
userSize
<
0
)
{
if
(
MatchRootPos
(
p
,
userSizeName
,
userSize
)
!=
LOS_OK
)
{
return
LOS_NOK
;
}
}
return
LOS_OK
;
}
STATIC
INT32
GetRootType
(
CHAR
**
rootType
,
CHAR
**
fsType
,
INT32
*
rootAddr
,
INT32
*
rootSize
)
STATIC
INT32
GetRootType
(
CHAR
**
rootType
,
CHAR
**
fsType
,
INT32
*
rootAddr
,
INT32
*
rootSize
,
INT32
*
userAddr
,
INT32
*
userSize
)
{
CHAR
*
args
=
NULL
;
CHAR
*
p
=
NULL
;
...
...
@@ -396,7 +412,7 @@ STATIC INT32 GetRootType(CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32
#endif
p
=
strsep
(
&
args
,
" "
);
while
(
p
!=
NULL
)
{
if
(
MatchRootInfo
(
p
,
rootType
,
fsType
,
rootAddr
,
rootSize
)
!=
LOS_OK
)
{
if
(
MatchRootInfo
(
p
,
rootType
,
fsType
,
rootAddr
,
rootSize
,
userAddr
,
userSize
)
!=
LOS_OK
)
{
goto
ERROUT
;
}
p
=
strsep
(
&
args
,
" "
);
...
...
@@ -528,6 +544,8 @@ INT32 OsMountRootfs(VOID)
INT32
err
;
INT32
rootAddr
=
-
1
;
INT32
rootSize
=
-
1
;
INT32
userAddr
=
-
1
;
INT32
userSize
=
-
1
;
CHAR
*
rootType
=
NULL
;
CHAR
*
fsType
=
NULL
;
const
CHAR
*
rootDev
=
NULL
;
...
...
@@ -538,15 +556,17 @@ INT32 OsMountRootfs(VOID)
rootAddr
=
ROOTFS_FLASH_ADDR
;
rootSize
=
ROOTFS_FLASH_SIZE
;
#else
ret
=
GetRootType
(
&
rootType
,
&
fsType
,
&
rootAddr
,
&
rootSize
);
ret
=
GetRootType
(
&
rootType
,
&
fsType
,
&
rootAddr
,
&
rootSize
,
&
userAddr
,
&
userSize
);
if
(
ret
!=
LOS_OK
)
{
return
ret
;
}
rootAddr
=
(
rootAddr
>=
0
)
?
rootAddr
:
ROOTFS_FLASH_ADDR
;
rootSize
=
(
rootSize
>=
0
)
?
rootSize
:
ROOTFS_FLASH_SIZE
;
#endif
userAddr
=
(
userAddr
>=
0
)
?
userAddr
:
rootAddr
+
rootSize
;
userSize
=
(
userSize
>=
0
)
?
userSize
:
STORAGE_SIZE
;
rootDev
=
GetDevName
(
rootType
,
rootAddr
,
rootSize
);
rootDev
=
GetDevName
(
rootType
,
rootAddr
,
rootSize
,
userAddr
,
userSize
);
if
(
rootDev
!=
NULL
)
{
ret
=
OsMountRootfsAndUserfs
(
rootDev
,
fsType
);
if
(
ret
!=
LOS_OK
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录