Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
98ca8441
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
461
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看板
提交
98ca8441
编写于
8月 28, 2021
作者:
J
jason_gitee
提交者:
Gitee
8月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add liteos patch ability
Signed-off-by:
N
jason_gitee
<
yangjie140@huawei.com
>
上级
aa5b2c76
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
82 addition
and
15 deletion
+82
-15
fs/vfs/BUILD.gn
fs/vfs/BUILD.gn
+4
-1
fs/vfs/Makefile
fs/vfs/Makefile
+1
-0
fs/vfs/include/vnode.h
fs/vfs/include/vnode.h
+1
-0
fs/vfs/vnode.c
fs/vfs/vnode.c
+16
-4
fs/zpfs/BUILD.gn
fs/zpfs/BUILD.gn
+4
-2
fs/zpfs/Makefile
fs/zpfs/Makefile
+4
-8
kernel/common/rootfs/los_rootfs.c
kernel/common/rootfs/los_rootfs.c
+40
-0
kernel/common/rootfs/los_rootfs.h
kernel/common/rootfs/los_rootfs.h
+12
-0
未找到文件。
fs/vfs/BUILD.gn
浏览文件 @
98ca8441
...
...
@@ -110,7 +110,10 @@ kernel_module(module_name) {
"$LITEOSTOPDIR/fs/vfs/vnode_hash.c",
]
include_dirs = [ "$LITEOSTOPDIR/syscall" ]
include_dirs = [
"$LITEOSTOPDIR/syscall",
"$LITEOSTOPDIR/fs/zpfs/include",
]
public_configs = [ ":public" ]
}
...
...
fs/vfs/Makefile
浏览文件 @
98ca8441
...
...
@@ -101,6 +101,7 @@ LOCAL_INCLUDE := \
-I
$(LITEOSTOPDIR)
/drivers/mtd/multi_partition/include
\
-I
$(LITEOSTOPDIR)
/fs/vfs/include/operation
\
-I
$(LITEOSTOPDIR)
/syscall
\
-I
$(LITEOSTOPDIR)
/fs/zpfs/include
ifeq
($(LOSCFG_FS_FAT), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTHIRDPARTY)
/FatFs/source
...
...
fs/vfs/include/vnode.h
浏览文件 @
98ca8441
...
...
@@ -159,6 +159,7 @@ int VnodeDevInit(void);
int
VnodeAlloc
(
struct
VnodeOps
*
vop
,
struct
Vnode
**
vnode
);
int
VnodeFree
(
struct
Vnode
*
vnode
);
int
VnodeLookup
(
const
char
*
path
,
struct
Vnode
**
vnode
,
uint32_t
flags
);
int
VnodeLookupAt
(
const
char
*
path
,
struct
Vnode
**
vnode
,
uint32_t
flags
,
struct
Vnode
*
orgVnode
);
int
VnodeHold
(
void
);
int
VnodeDrop
(
void
);
void
VnodeRefDec
(
struct
Vnode
*
vnode
);
...
...
fs/vfs/vnode.c
浏览文件 @
98ca8441
...
...
@@ -360,14 +360,21 @@ STEP_FINISH:
return
ret
;
}
int
VnodeLookup
(
const
char
*
path
,
struct
Vnode
**
result
,
uint32_t
flags
)
int
VnodeLookup
At
(
const
char
*
path
,
struct
Vnode
**
result
,
uint32_t
flags
,
struct
Vnode
*
orgVnode
)
{
int
ret
;
struct
Vnode
*
startVnode
=
NULL
;
char
*
normalizedPath
=
NULL
;
int
ret
=
PreProcess
(
path
,
&
startVnode
,
&
normalizedPath
);
if
(
ret
!=
LOS_OK
)
{
goto
OUT_FREE_PATH
;
if
(
orgVnode
!=
NULL
)
{
startVnode
=
orgVnode
;
normalizedPath
=
strdup
(
path
);
}
else
{
ret
=
PreProcess
(
path
,
&
startVnode
,
&
normalizedPath
);
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"[VFS]lookup failed, invalid path err = %d
\n
"
,
ret
);
goto
OUT_FREE_PATH
;
}
}
if
(
normalizedPath
[
0
]
==
'/'
&&
normalizedPath
[
1
]
==
'\0'
)
{
...
...
@@ -404,6 +411,11 @@ OUT_FREE_PATH:
return
ret
;
}
int
VnodeLookup
(
const
char
*
path
,
struct
Vnode
**
vnode
,
uint32_t
flags
)
{
return
VnodeLookupAt
(
path
,
vnode
,
flags
,
NULL
);
}
static
void
ChangeRootInternal
(
struct
Vnode
*
rootOld
,
char
*
dirname
)
{
int
ret
;
...
...
fs/zpfs/BUILD.gn
浏览文件 @
98ca8441
...
...
@@ -33,7 +33,9 @@ module_switch = defined(LOSCFG_FS_ZPFS)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [
"vfs_zpfs.c",
"zpfs.c",
"
src/
vfs_zpfs.c",
"
src/
zpfs.c",
]
include_dirs = [ "include" ]
}
fs/zpfs/Makefile
浏览文件 @
98ca8441
...
...
@@ -31,14 +31,10 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME
:=
$(
notdir
$(
shell
pwd
))
LOCAL_SRCS
:=
$(
wildcard
*
.c
)
LOCAL_INCLUDE
=
\
-I
$(LITEOSTOPDIR)
/fs/include
\
-I
$(LITEOSTOPDIR)
/fs/zpfs
\
-I
$(LITEOSTOPDIR)
/../../third_party/NuttX/liteos/fs/include
\
-I
$(LITEOSTOPDIR)
/../../third_party/NuttX/liteos/fs/include/inode
LOCAL_SRCS
:=
$(
wildcard
src/
*
.c
)
LOCAL_INCLUDE
:=
\
-I
$(LITEOSTOPDIR)
/fs/zpfs/include
LOCAL_FLAGS
:=
$(LITEOS_GCOV_OPTS)
LOCAL_FLAGS
:=
$(L
OCAL_INCLUDE)
$(L
ITEOS_GCOV_OPTS)
include
$(MODULE)
kernel/common/rootfs/los_rootfs.c
浏览文件 @
98ca8441
...
...
@@ -81,6 +81,17 @@ STATIC INT32 AddEmmcParts(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32
return
LOS_NOK
;
}
#ifdef LOSCFG_PLATFORM_PATCHFS
UINT64
patchStartCnt
=
userAddr
/
EMMC_SEC_SIZE
;
UINT64
patchSizeCnt
=
PATCH_SIZE
/
EMMC_SEC_SIZE
;
ret
=
add_mmc_partition
(
emmc
,
patchStartCnt
,
patchSizeCnt
);
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"Failed to add mmc patch partition!
\n
"
);
return
LOS_NOK
;
}
userAddr
+=
PATCH_SIZE
;
#endif
UINT64
storageStartCnt
=
userAddr
/
EMMC_SEC_SIZE
;
UINT64
storageSizeCnt
=
userSize
/
EMMC_SEC_SIZE
;
UINT64
userdataStartCnt
=
storageStartCnt
+
storageSizeCnt
;
...
...
@@ -235,6 +246,35 @@ STATIC INT32 MountPartitions(CHAR *fsType, UINT32 mountFlags)
return
ret
;
}
#ifdef LOSCFG_STORAGE_EMMC
#ifdef LOSCFG_PLATFORM_PATCHFS
/* Mount patch */
ret
=
mkdir
(
PATCH_DIR_NAME
,
DEFAULT_MOUNT_DIR_MODE
);
if
((
ret
!=
LOS_OK
)
&&
((
err
=
get_errno
())
!=
EEXIST
))
{
PRINT_ERR
(
"Failed to mkdir %s, errno %d: %s
\n
"
,
PATCH_DIR_NAME
,
err
,
strerror
(
err
));
return
ret
;
}
ret
=
mount
(
PATCH_DEV_NAME
,
PATCH_DIR_NAME
,
fsType
,
0
,
DEFAULT_MOUNT_DATA
);
if
((
ret
!=
LOS_OK
)
&&
((
err
=
get_errno
())
==
ENOTSUP
))
{
ret
=
format
(
PATCH_DEV_NAME
,
0
,
FM_FAT32
);
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"Failed to format %s
\n
"
,
PATCH_DEV_NAME
);
return
ret
;
}
ret
=
mount
(
PATCH_DEV_NAME
,
PATCH_DIR_NAME
,
fsType
,
0
,
DEFAULT_MOUNT_DATA
);
if
(
ret
!=
LOS_OK
)
{
err
=
get_errno
();
}
}
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"Failed to mount %s, errno %d: %s
\n
"
,
PATCH_DIR_NAME
,
err
,
strerror
(
err
));
return
ret
;
}
#endif
#endif
/* Mount userfs */
ret
=
mkdir
(
STORAGE_DIR_NAME
,
DEFAULT_MOUNT_DIR_MODE
);
if
((
ret
!=
LOS_OK
)
&&
((
err
=
get_errno
())
!=
EEXIST
))
{
...
...
kernel/common/rootfs/los_rootfs.h
浏览文件 @
98ca8441
...
...
@@ -38,6 +38,9 @@
#define STORAGE_DIR_NAME "/storage"
#ifdef LOSCFG_STORAGE_EMMC
#define USERDATA_DIR_NAME "/userdata"
#ifdef LOSCFG_PLATFORM_PATCHFS
#define PATCH_DIR_NAME "/patch"
#endif
#endif
#define DEFAULT_MOUNT_DIR_MODE 0755
#define DEFAULT_MOUNT_DATA NULL
...
...
@@ -64,11 +67,20 @@
#define USERFS_SIZE (CFIFLASH_CAPACITY - ROOTFS_ADDR - ROOTFS_SIZE)
#elif defined (LOSCFG_STORAGE_EMMC)
#define ROOT_DEV_NAME "/dev/mmcblk0p0"
#ifdef LOSCFG_PLATFORM_PATCHFS
#define PATCH_DEV_NAME "/dev/mmcblk0p1"
#define USER_DEV_NAME "/dev/mmcblk0p2"
#define USERDATA_DEV_NAME "/dev/mmcblk0p3"
#else
#define USER_DEV_NAME "/dev/mmcblk0p1"
#define USERDATA_DEV_NAME "/dev/mmcblk0p2"
#endif
#define ROOTFS_ADDR 0xA00000
#define ROOTFS_SIZE 0x1400000
#define USERFS_SIZE 0x3200000
#ifdef LOSCFG_PLATFORM_PATCHFS
#define PATCH_SIZE 0x200000
#endif
#ifdef DEFAULT_MOUNT_DIR_MODE
#undef DEFAULT_MOUNT_DIR_MODE
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录