diff --git a/Kconfig b/Kconfig index 88fc3389..768a364f 100644 --- a/Kconfig +++ b/Kconfig @@ -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" diff --git a/fs/romfs/Kconfig b/fs/romfs/Kconfig new file mode 100644 index 00000000..bb6744a0 --- /dev/null +++ b/fs/romfs/Kconfig @@ -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. diff --git a/fs/romfs/Makefile b/fs/romfs/Makefile new file mode 100644 index 00000000..49d97302 --- /dev/null +++ b/fs/romfs/Makefile @@ -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) diff --git a/tools/build/mk/liteos_tables_ldflags.mk b/tools/build/mk/liteos_tables_ldflags.mk index 07d50a02..aed13808 100644 --- a/tools/build/mk/liteos_tables_ldflags.mk +++ b/tools/build/mk/liteos_tables_ldflags.mk @@ -146,6 +146,7 @@ LITEOS_TABLES_DRIVER_LDFLAGS := \ ####FS MAP#### LITEOS_TABLES_FSMAP_LDFLAGS := \ -uramfs_fsmap \ + -uromfs_fsmap \ -unfs_fsmap \ -ufat_fsmap \ -ujffs_fsmap \ diff --git a/tools/build/mk/los_config.mk b/tools/build/mk/los_config.mk index 91cf344e..563c73ba 100644 --- a/tools/build/mk/los_config.mk +++ b/tools/build/mk/los_config.mk @@ -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 diff --git a/tools/scripts/make_rootfs/rootfsimg.sh b/tools/scripts/make_rootfs/rootfsimg.sh index 25b25daf..7d27d640 100755 --- a/tools/scripts/make_rootfs/rootfsimg.sh +++ b/tools/scripts/make_rootfs/rootfsimg.sh @@ -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