!254 memory-based romfs

Merge pull request !254 from LeonChan/lc-master
This commit is contained in:
openharmony_ci 2021-06-04 23:22:25 +08:00 committed by Gitee
commit efbab200aa
6 changed files with 56 additions and 2 deletions

View File

@ -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"

6
fs/romfs/Kconfig Normal file
View File

@ -0,0 +1,6 @@
config FS_ROMFS
bool "Enable ROMFS"
default n
depends on FS_VFS
help
Answer Y to enable LiteOS support romfs filesystem.

37
fs/romfs/Makefile Normal file
View File

@ -0,0 +1,37 @@
# 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)

View File

@ -165,6 +165,7 @@ LITEOS_TABLES_DRIVER_LDFLAGS := \
####FS MAP####
LITEOS_TABLES_FSMAP_LDFLAGS := \
-uramfs_fsmap \
-uromfs_fsmap \
-unfs_fsmap \
-ufat_fsmap \
-ujffs_fsmap \

View File

@ -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

View File

@ -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