diff --git a/core/Makefile b/core/Makefile index 301e8b2952..18e01f98ea 100644 --- a/core/Makefile +++ b/core/Makefile @@ -728,6 +728,9 @@ INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS) endif endif +ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED)) + INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s +endif ifeq ($(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs) INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG) endif @@ -764,6 +767,7 @@ $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD $(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 $(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) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1)) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index cd750e8260..2b8d4eefb2 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -350,7 +350,8 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None): elif fs_type.startswith("squash"): build_command = ["mksquashfsimage.sh"] build_command.extend([in_dir, out_file]) - build_command.extend(["-s"]) + if "squashfs_sparse_flag" in prop_dict: + build_command.extend([prop_dict["squashfs_sparse_flag"]]) build_command.extend(["-m", prop_dict["mount_point"]]) if target_out: build_command.extend(["-d", target_out]) @@ -478,6 +479,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): common_props = ( "extfs_sparse_flag", + "squashfs_sparse_flag", "mkyaffs2_extra_flags", "selinux_fc", "skip_fsck",