提交 c4595d25 编写于 作者: C chenwei

feat(file system): add memory-based romfs

1, this RomFS's codebase is Nuttx romfs, then it is compatible with
Linux RomFS and you can create such a file system using the tool genromfs.
2, there are two major changes against with the original Nuttx romfs:
    1), it is memory-based: all contents of the fs are stored in the
        memory in the very first stage of "mount".
    2), this version of romfs is altered to be compatible with our new
        version of VFS to take advantage of vnode cache and path cache.

close: #I3S0CP
上级 d6323564
......@@ -90,6 +90,7 @@ menu "FileSystem"
source "../../kernel/liteos_a/fs/vfs/Kconfig"
source "../../kernel/liteos_a/fs/fat/Kconfig"
source "../../kernel/liteos_a/fs/ramfs/Kconfig"
source "../../kernel/liteos_a/fs/romfs/Kconfig"
source "../../kernel/liteos_a/fs/nfs/Kconfig"
source "../../kernel/liteos_a/fs/proc/Kconfig"
source "../../kernel/liteos_a/fs/jffs2/Kconfig"
......
config FS_ROMFS
bool "Enable ROMFS"
default n
depends on FS_VFS
help
Answer Y to enable LiteOS support romfs filesystem.
# Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := $(wildcard $(LITEOSTHIRDPARTY)/NuttX/fs/romfs/*.c)
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
include $(MODULE)
......@@ -146,6 +146,7 @@ LITEOS_TABLES_DRIVER_LDFLAGS := \
####FS MAP####
LITEOS_TABLES_FSMAP_LDFLAGS := \
-uramfs_fsmap \
-uromfs_fsmap \
-unfs_fsmap \
-ufat_fsmap \
-ujffs_fsmap \
......
......@@ -325,6 +325,11 @@ ifeq ($(LOSCFG_FS_RAMFS), y)
LIB_SUBDIRS += fs/ramfs
endif
ifeq ($(LOSCFG_FS_ROMFS), y)
LITEOS_BASELIB += -lromfs
LIB_SUBDIRS += fs/romfs
endif
ifeq ($(LOSCFG_FS_NFS), y)
LITEOS_BASELIB += -lnfs
LIB_SUBDIRS += fs/nfs
......
......@@ -38,6 +38,7 @@ JFFS2_TOOL=mkfs.jffs2
WIN_JFFS2_TOOL=mkfs.jffs2.exe
YAFFS2_TOOL=mkyaffs2image100
VFAT_TOOL=mkfs.vfat
ROMFS_TOOL=genromfs
MCOPY_TOOL=mcopy
tool_check() {
......@@ -66,8 +67,11 @@ if [ "${FSTYPE}" = "jffs2" ]; then
${JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096
fi
elif [ "${FSTYPE}" = "yaffs2" ]; then
tool_check ${YAFFS2_TOOL}
${YAFFS2_TOOL} ${ROOTFS_DIR} ${ROOTFS_IMG} 2k 24bit
tool_check ${YAFFS2_TOOL}
${YAFFS2_TOOL} ${ROOTFS_DIR} ${ROOTFS_IMG} 2k 24bit
elif [ "${FSTYPE}" = "romfs" ]; then
tool_check ${ROMFS_TOOL}
${ROMFS_TOOL} -d ${ROOTFS_DIR} -f ${ROOTFS_IMG}
elif [ "${FSTYPE}" = "vfat" ]; then
if [ "${system}" != "Linux" ] ; then
echo "Unsupported fs type!" >&2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册