From a1900841bbef237fd8d792d13a3b9038fa638095 Mon Sep 17 00:00:00 2001 From: Patrick Tjin Date: Thu, 20 Oct 2016 10:58:12 -0700 Subject: [PATCH] build_image: add support for specifying number of inodes Add support for specifying number of inodes when creating system, vendor, oem partitions. These are all read-only and have no use for extra inodes. Removing extra inodes saves a lot of space. Bug: 32246383 Change-Id: I13f1d4614b64a4abc752c42a1c65d3d151481c21 (cherry picked from commit b59eca358603a4174d4f7c9b70749e7cd0e6f3fe) --- core/Makefile | 3 +++ tools/releasetools/build_image.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/core/Makefile b/core/Makefile index 226d75d1b..c40945811 100644 --- a/core/Makefile +++ b/core/Makefile @@ -839,6 +839,7 @@ $(hide) echo "ext_mkuserimg=$(MKEXTUSERIMG)" >> $(1) $(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1)) $(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_HAS_EXT4_RESERVED_BLOCKS),$(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) @@ -851,6 +852,7 @@ $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_U $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) +$(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1)) $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1)) $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) @@ -860,6 +862,7 @@ $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashf $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1)) $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1)) +$(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(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)) $(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index eca379d50..1708d8671 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -460,6 +460,8 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None): return False build_command.extend(["-d", base_fs_file]) build_command.extend(["-L", prop_dict["mount_point"]]) + if "extfs_inode_count" in prop_dict: + build_command.extend(["-i", prop_dict["extfs_inode_count"]]) if "selinux_fc" in prop_dict: build_command.append(prop_dict["selinux_fc"]) elif fs_type.startswith("squash"): @@ -640,6 +642,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("system_avb_enable", "avb_enable") copy_prop("system_avb_add_hashtree_footer_args", "avb_add_hashtree_footer_args") + copy_prop("system_extfs_inode_count", "extfs_inode_count") elif mount_point == "system_other": # We inherit the selinux policies of /system since we contain some of its files. d["mount_point"] = "system" @@ -656,6 +659,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("system_avb_enable", "avb_enable") copy_prop("system_avb_add_hashtree_footer_args", "avb_add_hashtree_footer_args") + copy_prop("system_extfs_inode_count", "extfs_inode_count") elif mount_point == "data": # Copy the generic fs type first, override with specific one if available. copy_prop("fs_type", "fs_type") @@ -678,11 +682,13 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("vendor_avb_enable", "avb_enable") copy_prop("vendor_avb_add_hashtree_footer_args", "avb_add_hashtree_footer_args") + copy_prop("vendor_extfs_inode_count", "extfs_inode_count") elif mount_point == "oem": copy_prop("fs_type", "fs_type") copy_prop("oem_size", "partition_size") copy_prop("oem_journal_size", "journal_size") copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks") + copy_prop("oem_extfs_inode_count", "extfs_inode_count") d["partition_name"] = mount_point return d