Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
349c1e46
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看板
提交
349c1e46
编写于
3月 21, 2021
作者:
L
laokz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
QEMU arm platform: get 'bootargs' from flash; fix code style
Change-Id: I94175fa89a61f4f08d9f921203bedfc2dd9e53e4
上级
c70335c8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
32 deletion
+42
-32
fs/vfs/multi_partition/Makefile
fs/vfs/multi_partition/Makefile
+4
-0
fs/vfs/multi_partition/src/mtd_partition.c
fs/vfs/multi_partition/src/mtd_partition.c
+5
-3
kernel/common/Makefile
kernel/common/Makefile
+4
-0
kernel/common/los_rootfs.c
kernel/common/los_rootfs.c
+29
-29
未找到文件。
fs/vfs/multi_partition/Makefile
浏览文件 @
349c1e46
...
...
@@ -37,6 +37,10 @@ LOCAL_INCLUDE := \
-I
$(LITEOSTOPDIR)
/fs/jffs2/include
\
-I
$(LITEOSTOPDIR)
/../../device/hisilicon/drivers/include/mtd/common/include
ifeq
($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/../../device/qemu/arm_virt/config/cfiflash
endif
LOCAL_FLAGS
:=
$(LOCAL_INCLUDE)
$(LITEOS_GCOV_OPTS)
include
$(MODULE)
fs/vfs/multi_partition/src/mtd_partition.c
浏览文件 @
349c1e46
...
...
@@ -39,6 +39,10 @@
#include "mtd_common.h"
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#include "cfiflash.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern
"C"
{
...
...
@@ -141,10 +145,9 @@ static VOID MtdNorParamAssign(partition_param *spinorParam, const struct MtdDev
spinorParam
->
blockname
=
SPIBLK_NAME
;
spinorParam
->
charname
=
SPICHR_NAME
;
#else
extern
struct
block_operations
*
GetCfiBlkOps
(
void
);
spinorParam
->
flash_ops
=
GetCfiBlkOps
();
spinorParam
->
char_ops
=
NULL
;
spinorParam
->
blockname
=
"/dev/cfiflash"
;
spinorParam
->
blockname
=
CFI_DRIVER
;
spinorParam
->
charname
=
NULL
;
#endif
spinorParam
->
partition_head
=
g_spinorPartitionHead
;
...
...
@@ -163,7 +166,6 @@ static partition_param *MtdInitSpinorParam(partition_param *spinorParam)
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
struct
MtdDev
*
spinorMtd
=
GetMtd
(
"spinor"
);
#else
extern
struct
MtdDev
*
GetCfiMtdDev
(
void
);
struct
MtdDev
*
spinorMtd
=
GetCfiMtdDev
();
#endif
if
(
spinorMtd
==
NULL
)
{
...
...
kernel/common/Makefile
浏览文件 @
349c1e46
...
...
@@ -36,6 +36,10 @@ LOCAL_SRCS := $(wildcard los_rootfs.c)
LOCAL_INCLUDE
:=
\
-I
$(LITEOSTOPDIR)/kernel/common
\
ifeq
($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/../../device/qemu/arm_virt/config/cfiflash
endif
LOCAL_FLAGS
:=
$(LOCAL_INCLUDE)
$(LITEOS_GCOV_OPTS)
include
$(MODULE)
...
...
kernel/common/los_rootfs.c
浏览文件 @
349c1e46
...
...
@@ -45,6 +45,13 @@
#include "mtd_list.h"
#include "fs/path_cache.h"
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#include "mtd_partition.h"
#include "cfiflash.h"
#define DEV_STORAGE_PATH "/dev/cfiflash1"
#define SECOND_MTD_PART_NUM 1
#endif
#ifdef LOSCFG_STORAGE_SPINOR
#define DEV_STORAGE_PATH "/dev/spinorblk2"
#define SECOND_MTD_PART_NUM 2
...
...
@@ -189,19 +196,21 @@ STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSi
#endif
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#define CFIFLASH_CAPACITY 64 * 1024 * 1024
if
(
strcmp
(
rootType
,
"cfi-flash"
)
==
0
)
{
if
(
strcmp
(
rootType
,
FLASH_TYPE
)
==
0
)
{
INT32
ret
;
extern
INT32
add_mtd_partition
(
const
CHAR
*
type
,
UINT32
startAddr
,
UINT32
length
,
UINT32
partitionNum
);
ret
=
add_mtd_partition
(
"cfi-flash"
,
rootAddr
,
rootSize
,
0
);
if
(
rootAddr
!=
CFIFLASH_ROOT_ADDR
)
{
PRINT_ERR
(
"Error rootAddr, must be %#0x!
\n
"
,
CFIFLASH_ROOT_ADDR
);
return
NULL
;
}
ret
=
add_mtd_partition
(
FLASH_TYPE
,
rootAddr
,
rootSize
,
0
);
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"Failed to add
cfi-flash root partition!
\n
"
);
PRINT_ERR
(
"Failed to add
%s root partition!
\n
"
,
FLASH_TYPE
);
}
else
{
rootDev
=
"/dev/cfiflash0"
;
ret
=
add_mtd_partition
(
"cfi-flash"
,
(
rootAddr
+
rootSize
),
CFIFLASH_CAPACITY
-
rootAddr
-
rootSize
,
1
);
ret
=
add_mtd_partition
(
FLASH_TYPE
,
(
rootAddr
+
rootSize
),
CFIFLASH_CAPACITY
-
rootAddr
-
rootSize
,
SECOND_MTD_PART_NUM
);
if
(
ret
!=
LOS_OK
)
{
PRINT_ERR
(
"Failed to add
cfi-flash storage partition!
\n
"
);
PRINT_ERR
(
"Failed to add
%s storage partition!
\n
"
,
FLASH_TYPE
);
}
}
}
else
...
...
@@ -262,13 +271,17 @@ STATIC INT32 GetArgs(CHAR **args)
}
#endif
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
/*
* TODO: Implement method of fetching bootargs for
* Qemu ARM virtual platform. If used without
* bootloader it will pass DTB by default.
*/
(
void
)
ret
;
cmdLine
=
"bootargs=root=cfi-flash fstype=jffs2 rootaddr=0xA00000 rootsize=27M"
;
struct
MtdDev
*
mtd
=
GetCfiMtdDev
();
if
(
mtd
==
NULL
)
{
PRINT_ERR
(
"Get CFI mtd failed!
\n
"
);
goto
ERROUT
;
}
g_alignSize
=
mtd
->
eraseSize
;
ret
=
mtd
->
read
(
mtd
,
CFIFLASH_BOOTARGS_ADDR
,
COMMAND_LINE_SIZE
,
cmdLine
);
if
(
ret
!=
COMMAND_LINE_SIZE
)
{
PRINT_ERR
(
"Read CFI command line failed!
\n
"
);
goto
ERROUT
;
}
#endif
for
(
i
=
0
;
i
<
COMMAND_LINE_SIZE
;
i
+=
len
+
1
)
{
...
...
@@ -493,7 +506,7 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
PRINT_ERR
(
"Failed to mount rootfs,rootDev %s, errno %d: %s
\n
"
,
rootDev
,
err
,
strerror
(
err
));
return
ret
;
}
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|| defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
ret
=
mkdir
(
"/storage"
,
DEFAULT_STORAGE_MOUNT_DIR_MODE
);
if
((
ret
!=
LOS_OK
)
&&
((
err
=
get_errno
())
!=
EEXIST
))
{
PRINT_ERR
(
"Failed to reserve vnode /storage, errno %d: %s
\n
"
,
err
,
strerror
(
err
));
...
...
@@ -504,19 +517,6 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
PRINT_ERR
(
"Failed to mount /storage, errno %d: %s
\n
"
,
err
,
strerror
(
err
));
}
}
#endif
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
ret
=
mkdir
(
"/storage"
,
DEFAULT_STORAGE_MOUNT_DIR_MODE
);
if
(
ret
!=
LOS_OK
)
{
err
=
get_errno
();
PRINT_ERR
(
"Failed to reserve inode /storage, errno %d: %s
\n
"
,
err
,
strerror
(
err
));
}
else
{
ret
=
mount
(
"/dev/cfiflash1"
,
"/storage"
,
fsType
,
0
,
NULL
);
if
(
ret
!=
LOS_OK
)
{
err
=
get_errno
();
PRINT_ERR
(
"Failed to mount /storage, errno %d: %s
\n
"
,
err
,
strerror
(
err
));
}
}
#endif
}
return
LOS_OK
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录