[U-Boot] [PATCH v2 2/4] spl: fat/fs: Add option to include/exclude FAT write build in SPL

tien.fong.chee at intel.com tien.fong.chee at intel.com
Wed Jan 23 06:20:04 UTC 2019


From: Tien Fong Chee <tien.fong.chee at intel.com>

Most of the time SPL only needs very simple FAT reading, so having
CONFIG_IS_ENABLED(FAT_WRITE) to exclude it from SPL build would help
to save 64KiB default max clustersize from memory.

Signed-off-by: Tien Fong Chee <tien.fong.chee at intel.com>

---

Changes in v2:
- Changed to CONFIG_IS_ENABLED(FAT_WRITE) to control build for FAT write
int both SPL and U-Boot
- Changed to CONFIG_IS_ENABLED for config FS_FAT too.
---
 common/spl/Kconfig | 7 +++++++
 fs/fat/Makefile    | 4 ++--
 fs/fat/fat.c       | 3 ++-
 fs/fs.c            | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 93e7fe9..9042117 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -403,6 +403,13 @@ config SPL_FS_FAT
 	  filesystem from within SPL. Support for the underlying block
 	  device (e.g. MMC or USB) must be enabled separately.
 
+config SPL_FAT_WRITE
+	bool "Support write for FAT filesystems"
+	help
+	  Enable write support for FAT and VFAT filesystems with SPL.
+	  Support for the underlying block device (e.g. MMC or USB) must be
+	  enabled separately.
+
 config SPL_FPGA_SUPPORT
 	bool "Support FPGAs"
 	help
diff --git a/fs/fat/Makefile b/fs/fat/Makefile
index e64b61a..f84efac 100644
--- a/fs/fat/Makefile
+++ b/fs/fat/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-$(CONFIG_FS_FAT)	:= fat.o
-obj-$(CONFIG_FAT_WRITE):= fat_write.o
+obj-$(CONFIG_$(SPL_)FS_FAT) = fat.o
+obj-$(CONFIG_$(SPL_)FAT_WRITE) = fat_write.o
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index ac8913e..ecfa255 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -145,7 +145,8 @@ static void get_name(dir_entry *dirent, char *s_name)
 }
 
 static int flush_dirty_fat_buffer(fsdata *mydata);
-#if !defined(CONFIG_FAT_WRITE)
+
+#if !CONFIG_IS_ENABLED(FAT_WRITE)
 /* Stub for read only operation */
 int flush_dirty_fat_buffer(fsdata *mydata)
 {
diff --git a/fs/fs.c b/fs/fs.c
index cb26517..48b8e9a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -168,7 +168,7 @@ static struct fstype_info fstypes[] = {
 		.exists = fat_exists,
 		.size = fat_size,
 		.read = fat_read_file,
-#ifdef CONFIG_FAT_WRITE
+#if CONFIG_IS_ENABLED(FAT_WRITE)
 		.write = file_fat_write,
 		.unlink = fat_unlink,
 		.mkdir = fat_mkdir,
-- 
2.2.0



More information about the U-Boot mailing list