From d7cc7e8f9aa463c493219bd259e96b46e47ee8d7 Mon Sep 17 00:00:00 2001 From: Sandeep Dhavale Date: Mon, 11 Sep 2023 22:25:53 -0700 Subject: [PATCH] Add support for specifying erofs blocksize This change allows us to specify erofs filesystem block size which will be used to create erofs image. Either it can be specified at board level using BOARD_EROFS_BLOCKSIZE. Or per read only partition image using BOARD_IMAGE_EROFS_BLOCKSIZE. Examples: BOARD_EROFS_BLOCKSIZE := 16384 OR BOARD_PRODUCTIMAGE_EROFS_BLOCKSIZE := 16384 Bug: 303316443 Test: m and file ${ANDROID_PRODUCT_OUT}/*.img Change-Id: I9bf3d299ae02165d0bffc62f474a302408d8b9b9 Signed-off-by: Sandeep Dhavale --- core/Makefile | 2 ++ tools/releasetools/build_image.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/core/Makefile b/core/Makefile index e666dec1b3..a253026184 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2131,6 +2131,7 @@ $(eval _var := $(call to-upper,$(1))) $(if $(BOARD_$(_var)IMAGE_EROFS_COMPRESSOR),$(hide) echo "$(1)_erofs_compressor=$(BOARD_$(_var)IMAGE_EROFS_COMPRESSOR)" >> $(2)) $(if $(BOARD_$(_var)IMAGE_EROFS_COMPRESS_HINTS),$(hide) echo "$(1)_erofs_compress_hints=$(BOARD_$(_var)IMAGE_EROFS_COMPRESS_HINTS)" >> $(2)) $(if $(BOARD_$(_var)IMAGE_EROFS_PCLUSTER_SIZE),$(hide) echo "$(1)_erofs_pcluster_size=$(BOARD_$(_var)IMAGE_EROFS_PCLUSTER_SIZE)" >> $(2)) +$(if $(BOARD_$(_var)IMAGE_EROFS_BLOCKSIZE),$(hide) echo "$(1)_erofs_blocksize=$(BOARD_$(_var)IMAGE_EROFS_BLOCKSIZE)" >> $(2)) $(if $(BOARD_$(_var)IMAGE_EXTFS_INODE_COUNT),$(hide) echo "$(1)_extfs_inode_count=$(BOARD_$(_var)IMAGE_EXTFS_INODE_COUNT)" >> $(2)) $(if $(BOARD_$(_var)IMAGE_EXTFS_RSV_PCT),$(hide) echo "$(1)_extfs_rsv_pct=$(BOARD_$(_var)IMAGE_EXTFS_RSV_PCT)" >> $(2)) $(if $(BOARD_$(_var)IMAGE_F2FS_SLOAD_COMPRESS_FLAGS),$(hide) echo "$(1)_f2fs_sldc_flags=$(BOARD_$(_var)IMAGE_F2FS_SLOAD_COMPRESS_FLAGS)" >> $(2)) @@ -2220,6 +2221,7 @@ $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)),,$(hide) echo "f2f $(if $(BOARD_EROFS_COMPRESSOR),$(hide) echo "erofs_default_compressor=$(BOARD_EROFS_COMPRESSOR)" >> $(1)) $(if $(BOARD_EROFS_COMPRESS_HINTS),$(hide) echo "erofs_default_compress_hints=$(BOARD_EROFS_COMPRESS_HINTS)" >> $(1)) $(if $(BOARD_EROFS_PCLUSTER_SIZE),$(hide) echo "erofs_pcluster_size=$(BOARD_EROFS_PCLUSTER_SIZE)" >> $(1)) +$(if $(BOARD_EROFS_BLOCKSIZE),$(hide) echo "erofs_blocksize=$(BOARD_EROFS_BLOCKSIZE)" >> $(1)) $(if $(BOARD_EROFS_SHARE_DUP_BLOCKS),$(hide) echo "erofs_share_dup_blocks=$(BOARD_EROFS_SHARE_DUP_BLOCKS)" >> $(1)) $(if $(BOARD_EROFS_USE_LEGACY_COMPRESSION),$(hide) echo "erofs_use_legacy_compression=$(BOARD_EROFS_USE_LEGACY_COMPRESSION)" >> $(1)) $(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1)) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 5e4130c764..34b7172e3f 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -353,6 +353,8 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): if compress_hints: build_command.extend(["--compress-hints", compress_hints]) + build_command.extend(["-b", prop_dict.get("erofs_blocksize", "4096")]) + build_command.extend(["--mount-point", prop_dict["mount_point"]]) if target_out: build_command.extend(["--product-out", target_out]) @@ -711,6 +713,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): "erofs_default_compressor", "erofs_default_compress_hints", "erofs_pcluster_size", + "erofs_blocksize", "erofs_share_dup_blocks", "erofs_sparse_flag", "erofs_use_legacy_compression", @@ -762,6 +765,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): (True, "{}_erofs_compressor", "erofs_compressor"), (True, "{}_erofs_compress_hints", "erofs_compress_hints"), (True, "{}_erofs_pcluster_size", "erofs_pcluster_size"), + (True, "{}_erofs_blocksize", "erofs_blocksize"), (True, "{}_erofs_share_dup_blocks", "erofs_share_dup_blocks"), (True, "{}_extfs_inode_count", "extfs_inode_count"), (True, "{}_f2fs_compress", "f2fs_compress"),