From 91238cce14dc9f1e0bdfb25f3e37e536f8d8b998 Mon Sep 17 00:00:00 2001 From: Alistair Delva Date: Wed, 16 Oct 2019 10:53:41 -0700 Subject: [PATCH] Allow f2fs sparse mode to be disabled Bug: 142424832 Bug: 142803849 Change-Id: Ic112128f15e3f29208332afceea4fbc3fca40b36 --- core/Makefile | 6 ++++++ tools/releasetools/build_image.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/core/Makefile b/core/Makefile index 1b4a0dadf6..63e9f4be69 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1462,6 +1462,9 @@ endif ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED)) INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s endif +ifneq (true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)) + INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG := -S +endif INTERNAL_USERIMAGES_DEPS := \ $(BUILD_IMAGE) \ @@ -1598,6 +1601,7 @@ $(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1) $(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1)) $(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1)) $(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1)) +$(if $(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG),$(hide) echo "f2fs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG)" >> $(1)) $(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1)) $(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1)) $(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1)) @@ -4187,6 +4191,8 @@ define dump-dynamic-partitions-info echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);)) $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \ echo "build_non_sparse_super_partition=true" >> $(1)) + $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)), \ + echo "build_non_sparse_super_partition=true" >> $(1)) $(if $(filter true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE)), \ echo "super_image_in_update_package=true" >> $(1)) endef diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index af508fe514..317a6d9151 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -315,6 +315,8 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): elif fs_type.startswith("f2fs"): build_command = ["mkf2fsuserimg.sh"] build_command.extend([out_file, prop_dict["image_size"]]) + if "f2fs_sparse_flag" in prop_dict: + build_command.extend([prop_dict["f2fs_sparse_flag"]]) if fs_config: build_command.extend(["-C", fs_config]) build_command.extend(["-f", in_dir]) @@ -519,6 +521,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): common_props = ( "extfs_sparse_flag", "squashfs_sparse_flag", + "f2fs_sparse_flag", "skip_fsck", "ext_mkuserimg", "verity",