From fde9f7906b8030af6836ac943f6d45db325e630e Mon Sep 17 00:00:00 2001 From: Jin Qian Date: Mon, 22 Jan 2018 13:15:46 -0800 Subject: [PATCH] Add BOARD_EXT4_SHARE_DUP_BLOCKS to share duplicated blocks on ext4 This option applies to system.img and vendor.img. Bug: 64109868 Change-Id: Ib4c7384049dca08e57441ef71cc81c2fba4462dd --- core/Makefile | 1 + tools/releasetools/build_image.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/Makefile b/core/Makefile index a3fbe33ab..7aa10198d 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1044,6 +1044,7 @@ $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTE $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1)) +$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 1f5caf342..f07e4b13d 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -555,6 +555,8 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None): build_command.extend(["-U", prop_dict["uuid"]]) if "hash_seed" in prop_dict: build_command.extend(["-S", prop_dict["hash_seed"]]) + if "ext4_share_dup_blocks" in prop_dict: + build_command.append("-c") if "selinux_fc" in prop_dict: build_command.append(prop_dict["selinux_fc"]) elif fs_type.startswith("squash"): @@ -723,6 +725,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("system_root_image", "system_root_image") copy_prop("ramdisk_dir", "ramdisk_dir") copy_prop("ramdisk_fs_config", "ramdisk_fs_config") + copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks") copy_prop("system_squashfs_compressor", "squashfs_compressor") copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt") copy_prop("system_squashfs_block_size", "squashfs_block_size") @@ -768,6 +771,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("vendor_size", "partition_size") copy_prop("vendor_journal_size", "journal_size") copy_prop("vendor_verity_block_device", "verity_block_device") + copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks") copy_prop("vendor_squashfs_compressor", "squashfs_compressor") copy_prop("vendor_squashfs_compressor_opt", "squashfs_compressor_opt") copy_prop("vendor_squashfs_block_size", "squashfs_block_size")