Loading core/Makefile +1 −2 Original line number Diff line number Diff line Loading @@ -1691,7 +1691,7 @@ ifneq ($(filter \ $(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE) \ $(BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE) \ ,erofs),) INTERNAL_USERIMAGES_DEPS += $(MKEROFSUSERIMG) INTERNAL_USERIMAGES_DEPS += $(MKEROFS) BOARD_EROFS_COMPRESSOR ?= "lz4hc,9" endif Loading Loading @@ -4657,7 +4657,6 @@ INTERNAL_OTATOOLS_MODULES := \ mke2fs \ mke2fs.conf \ mkfs.erofs \ mkerofsimage.sh \ mkf2fsuserimg.sh \ mksquashfs \ mksquashfsimage.sh \ Loading core/config.mk +0 −1 Original line number Diff line number Diff line Loading @@ -598,7 +598,6 @@ FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf MKEROFS := $(HOST_OUT_EXECUTABLES)/mkfs.erofs MKEROFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkerofsimage.sh MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX) Loading tools/releasetools/Android.bp +3 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,9 @@ python_defaults { required: [ "blk_alloc_to_base_fs", "e2fsck", "mkerofsimage.sh", "fsck.erofs", "img2simg", "mkfs.erofs", "mkuserimg_mke2fs", "simg2img", "tune2fs", Loading tools/releasetools/build_image.py +50 −24 Original line number Diff line number Diff line Loading @@ -268,18 +268,19 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): """ build_command = [] fs_type = prop_dict.get("fs_type", "") run_e2fsck = False run_fsck = None needs_projid = prop_dict.get("needs_projid", 0) needs_casefold = prop_dict.get("needs_casefold", 0) needs_compress = prop_dict.get("needs_compress", 0) disable_sparse = "disable_sparse" in prop_dict manual_sparse = False if fs_type.startswith("ext"): build_command = [prop_dict["ext_mkuserimg"]] if "extfs_sparse_flag" in prop_dict and not disable_sparse: build_command.append(prop_dict["extfs_sparse_flag"]) run_e2fsck = True run_e2fsck = RunE2fsck build_command.extend([in_dir, out_file, fs_type, prop_dict["mount_point"]]) build_command.append(prop_dict["image_size"]) Loading Loading @@ -320,17 +321,8 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): if "selinux_fc" in prop_dict: build_command.append(prop_dict["selinux_fc"]) elif fs_type.startswith("erofs"): build_command = ["mkerofsimage.sh"] build_command.extend([in_dir, out_file]) if "erofs_sparse_flag" in prop_dict and not disable_sparse: build_command.extend([prop_dict["erofs_sparse_flag"]]) build_command.extend(["-m", prop_dict["mount_point"]]) if target_out: build_command.extend(["-d", target_out]) if fs_config: build_command.extend(["-C", fs_config]) if "selinux_fc" in prop_dict: build_command.extend(["-c", prop_dict["selinux_fc"]]) build_command = ["mkfs.erofs"] compressor = None if "erofs_default_compressor" in prop_dict: compressor = prop_dict["erofs_default_compressor"] Loading @@ -338,16 +330,30 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): compressor = prop_dict["erofs_compressor"] if compressor: build_command.extend(["-z", compressor]) build_command.extend(["--mount-point", prop_dict["mount_point"]]) if target_out: build_command.extend(["--product-out", target_out]) if fs_config: build_command.extend(["--fs-config-file", fs_config]) if "selinux_fc" in prop_dict: build_command.extend(["--file-contexts", prop_dict["selinux_fc"]]) if "timestamp" in prop_dict: build_command.extend(["-T", str(prop_dict["timestamp"])]) if "uuid" in prop_dict: build_command.extend(["-U", prop_dict["uuid"]]) if "block_list" in prop_dict: build_command.extend(["-B", prop_dict["block_list"]]) build_command.extend(["--block-list-file", prop_dict["block_list"]]) if "erofs_pcluster_size" in prop_dict: build_command.extend(["-P", prop_dict["erofs_pcluster_size"]]) build_command.extend(["-C", prop_dict["erofs_pcluster_size"]]) if "erofs_share_dup_blocks" in prop_dict: build_command.extend(["-k", "4096"]) build_command.extend(["--chunksize", "4096"]) build_command.extend([out_file, in_dir]) if "erofs_sparse_flag" in prop_dict and not disable_sparse: manual_sparse = True run_fsck = RunErofsFsck elif fs_type.startswith("squash"): build_command = ["mksquashfsimage.sh"] build_command.extend([in_dir, out_file]) Loading Loading @@ -436,7 +442,19 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): int(prop_dict["partition_size"]) // BYTES_IN_MB)) raise if run_e2fsck and prop_dict.get("skip_fsck") != "true": if run_fsck and prop_dict.get("skip_fsck") != "true": run_fsck(out_file) if manual_sparse: temp_file = out_file + ".sparse" img2simg_argv = ["img2simg", out_file, temp_file] common.RunAndCheckOutput(img2simg_argv) os.rename(temp_file, out_file) return mkfs_output def RunE2fsck(out_file): unsparse_image = UnsparseImage(out_file, replace=False) # Run e2fsck on the inflated image file Loading @@ -446,7 +464,15 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): finally: os.remove(unsparse_image) return mkfs_output def RunErofsFsck(out_file): fsck_command = ["fsck.erofs", "--extract", out_file] try: common.RunAndCheckOutput(fsck_command) except: print("Check failed for EROFS image {}".format(out_file)) raise def BuildImage(in_dir, prop_dict, out_file, target_out=None): """Builds an image for the files under in_dir and writes it to out_file. Loading Loading
core/Makefile +1 −2 Original line number Diff line number Diff line Loading @@ -1691,7 +1691,7 @@ ifneq ($(filter \ $(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE) \ $(BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE) \ ,erofs),) INTERNAL_USERIMAGES_DEPS += $(MKEROFSUSERIMG) INTERNAL_USERIMAGES_DEPS += $(MKEROFS) BOARD_EROFS_COMPRESSOR ?= "lz4hc,9" endif Loading Loading @@ -4657,7 +4657,6 @@ INTERNAL_OTATOOLS_MODULES := \ mke2fs \ mke2fs.conf \ mkfs.erofs \ mkerofsimage.sh \ mkf2fsuserimg.sh \ mksquashfs \ mksquashfsimage.sh \ Loading
core/config.mk +0 −1 Original line number Diff line number Diff line Loading @@ -598,7 +598,6 @@ FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf MKEROFS := $(HOST_OUT_EXECUTABLES)/mkfs.erofs MKEROFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkerofsimage.sh MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX) Loading
tools/releasetools/Android.bp +3 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,9 @@ python_defaults { required: [ "blk_alloc_to_base_fs", "e2fsck", "mkerofsimage.sh", "fsck.erofs", "img2simg", "mkfs.erofs", "mkuserimg_mke2fs", "simg2img", "tune2fs", Loading
tools/releasetools/build_image.py +50 −24 Original line number Diff line number Diff line Loading @@ -268,18 +268,19 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): """ build_command = [] fs_type = prop_dict.get("fs_type", "") run_e2fsck = False run_fsck = None needs_projid = prop_dict.get("needs_projid", 0) needs_casefold = prop_dict.get("needs_casefold", 0) needs_compress = prop_dict.get("needs_compress", 0) disable_sparse = "disable_sparse" in prop_dict manual_sparse = False if fs_type.startswith("ext"): build_command = [prop_dict["ext_mkuserimg"]] if "extfs_sparse_flag" in prop_dict and not disable_sparse: build_command.append(prop_dict["extfs_sparse_flag"]) run_e2fsck = True run_e2fsck = RunE2fsck build_command.extend([in_dir, out_file, fs_type, prop_dict["mount_point"]]) build_command.append(prop_dict["image_size"]) Loading Loading @@ -320,17 +321,8 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): if "selinux_fc" in prop_dict: build_command.append(prop_dict["selinux_fc"]) elif fs_type.startswith("erofs"): build_command = ["mkerofsimage.sh"] build_command.extend([in_dir, out_file]) if "erofs_sparse_flag" in prop_dict and not disable_sparse: build_command.extend([prop_dict["erofs_sparse_flag"]]) build_command.extend(["-m", prop_dict["mount_point"]]) if target_out: build_command.extend(["-d", target_out]) if fs_config: build_command.extend(["-C", fs_config]) if "selinux_fc" in prop_dict: build_command.extend(["-c", prop_dict["selinux_fc"]]) build_command = ["mkfs.erofs"] compressor = None if "erofs_default_compressor" in prop_dict: compressor = prop_dict["erofs_default_compressor"] Loading @@ -338,16 +330,30 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): compressor = prop_dict["erofs_compressor"] if compressor: build_command.extend(["-z", compressor]) build_command.extend(["--mount-point", prop_dict["mount_point"]]) if target_out: build_command.extend(["--product-out", target_out]) if fs_config: build_command.extend(["--fs-config-file", fs_config]) if "selinux_fc" in prop_dict: build_command.extend(["--file-contexts", prop_dict["selinux_fc"]]) if "timestamp" in prop_dict: build_command.extend(["-T", str(prop_dict["timestamp"])]) if "uuid" in prop_dict: build_command.extend(["-U", prop_dict["uuid"]]) if "block_list" in prop_dict: build_command.extend(["-B", prop_dict["block_list"]]) build_command.extend(["--block-list-file", prop_dict["block_list"]]) if "erofs_pcluster_size" in prop_dict: build_command.extend(["-P", prop_dict["erofs_pcluster_size"]]) build_command.extend(["-C", prop_dict["erofs_pcluster_size"]]) if "erofs_share_dup_blocks" in prop_dict: build_command.extend(["-k", "4096"]) build_command.extend(["--chunksize", "4096"]) build_command.extend([out_file, in_dir]) if "erofs_sparse_flag" in prop_dict and not disable_sparse: manual_sparse = True run_fsck = RunErofsFsck elif fs_type.startswith("squash"): build_command = ["mksquashfsimage.sh"] build_command.extend([in_dir, out_file]) Loading Loading @@ -436,7 +442,19 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): int(prop_dict["partition_size"]) // BYTES_IN_MB)) raise if run_e2fsck and prop_dict.get("skip_fsck") != "true": if run_fsck and prop_dict.get("skip_fsck") != "true": run_fsck(out_file) if manual_sparse: temp_file = out_file + ".sparse" img2simg_argv = ["img2simg", out_file, temp_file] common.RunAndCheckOutput(img2simg_argv) os.rename(temp_file, out_file) return mkfs_output def RunE2fsck(out_file): unsparse_image = UnsparseImage(out_file, replace=False) # Run e2fsck on the inflated image file Loading @@ -446,7 +464,15 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): finally: os.remove(unsparse_image) return mkfs_output def RunErofsFsck(out_file): fsck_command = ["fsck.erofs", "--extract", out_file] try: common.RunAndCheckOutput(fsck_command) except: print("Check failed for EROFS image {}".format(out_file)) raise def BuildImage(in_dir, prop_dict, out_file, target_out=None): """Builds an image for the files under in_dir and writes it to out_file. Loading