mtdconfig: modify mtdconfig kconfig

change filename  mtd/mtd_config_fs.c to mtd/mtd_config_nvs.c
and optimize the configuration related to mtdconfig

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
This commit is contained in:
zhaoxingyu1
2025-04-29 10:22:05 +08:00
committed by Donny(董九柱)
parent 116196da02
commit 273222c06e
7 changed files with 30 additions and 23 deletions

View File

@@ -271,7 +271,7 @@ config ARCH_BOARD_FLASH_PART1_FS_SMARTFS
is absolute minimum (so a 16KiB!).
config ARCH_BOARD_FLASH_PART1_FS_MTDCONFIG
select MTD_CONFIG
depends on !MTD_CONFIG_NONE
bool "mtdconfig"
---help---
Purpose build filesystem to hold application's configuration.
@@ -319,7 +319,7 @@ config ARCH_BOARD_FLASH_PART2_FS_SMARTFS
bool "smartfs"
config ARCH_BOARD_FLASH_PART2_FS_MTDCONFIG
select MTD_CONFIG
depends on !MTD_CONFIG_NONE
bool "mtdconfig"
endchoice # Filesystem of user partition 2
@@ -362,7 +362,7 @@ config ARCH_BOARD_FLASH_PART3_FS_SMARTFS
bool "smartfs"
config ARCH_BOARD_FLASH_PART3_FS_MTDCONFIG
select MTD_CONFIG
depends on !MTD_CONFIG_NONE
bool "mtdconfig"
endchoice # Filesystem of user partition 3
@@ -405,7 +405,7 @@ config ARCH_BOARD_FLASH_PART4_FS_SMARTFS
bool "smartfs"
config ARCH_BOARD_FLASH_PART4_FS_MTDCONFIG
select MTD_CONFIG
depends on !MTD_CONFIG_NONE
bool "mtdconfig"
endchoice # Filesystem of user partition 4

View File

@@ -40,6 +40,7 @@ CONFIG_INPUT=y
CONFIG_INPUT_BUTTONS=y
CONFIG_INPUT_BUTTONS_LOWER=y
CONFIG_LPUART1_SERIAL_CONSOLE=y
CONFIG_MTD_CONFIG=y
CONFIG_MTD_CONFIG_NAMED=y
CONFIG_MTD_SMART_SECTOR_SIZE=2048
CONFIG_NSH_ARCHINIT=y

View File

@@ -31,7 +31,6 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MTD_CONFIG=y
CONFIG_MTD_CONFIG_FAIL_SAFE=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@@ -23,8 +23,8 @@
if(CONFIG_MTD)
set(SRCS ftl.c)
if(CONFIG_MTD_CONFIG_FAIL_SAFE)
list(APPEND SRCS mtd_config_fs.c)
if(CONFIG_MTD_CONFIG_NVS)
list(APPEND SRCS mtd_config_nvs.c)
elseif(CONFIG_MTD_CONFIG)
list(APPEND SRCS mtd_config.c)
endif()

View File

@@ -142,14 +142,29 @@ if MTD_PROGMEM
endif #MTD_PROGMEM
choice
prompt "Select MTD config solution"
default MTD_CONFIG_NONE
config MTD_CONFIG
bool "Enable Dev Config (MTD based) device"
default n
---help---
Provides a /dev/config device for saving / restoring application
configuration data to a standard MTD device or partition.
if MTD_CONFIG
config MTD_CONFIG_NVS
bool "NVS"
---help---
NVS is a lightweight KV storage mechanism which supports classical
on-chip NorFlash, it implements basic KV write, read, and delete
functions, and supports power down protection.
config MTD_CONFIG_NONE
bool "None MTD config"
endchoice
if !MTD_CONFIG_NONE
config MTD_CONFIG_RAM_CONSOLIDATE
bool "Always use RAM consolidation method (work in progress)"
@@ -186,30 +201,22 @@ config MTD_CONFIG_NAME_LEN
---help---
Sets the maximum length of config item names.
config MTD_CONFIG_FAIL_SAFE
bool "Enable Fail Safe MTD Config"
default n
---help---
Enable the new storage layout to support the resilient to power loss.
This replaces the drivers/mtd/mtd_config, which
is resilient to power loss.
config MTD_CONFIG_BLOCKSIZE_MULTIPLE
int "Set NVS blocksize multiple"
default 1
depends on MTD_CONFIG_FAIL_SAFE
depends on MTD_CONFIG_NVS
---help---
The size of a multiple of blocksize compared to erasize
config MTD_CONFIG_CACHE_SIZE
int "Non-volatile Storage lookup cache size"
default 0
depends on MTD_CONFIG_FAIL_SAFE
depends on MTD_CONFIG_NVS
help
Number of entries in Non-volatile Storage lookup cache.
It is recommended that it be a power of 2.
endif # MTD_CONFIG
endif
comment "MTD Device Drivers"

View File

@@ -31,8 +31,8 @@ ifeq ($(CONFIG_MTD),y)
CSRCS += ftl.c
ifeq ($(CONFIG_MTD_CONFIG_FAIL_SAFE),y)
CSRCS += mtd_config_fs.c
ifeq ($(CONFIG_MTD_CONFIG_NVS),y)
CSRCS += mtd_config_nvs.c
else ifeq ($(CONFIG_MTD_CONFIG),y)
CSRCS += mtd_config.c
endif

View File

@@ -1,5 +1,5 @@
/****************************************************************************
* drivers/mtd/mtd_config_fs.c
* drivers/mtd/mtd_config_nvs.c
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2018 Laczen