From 6a42a25429a3313f87c8ca5154c99c7acd0eccdf Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 27 Feb 2013 13:54:02 -0800 Subject: [PATCH] Run e2fsck only when building images with the target files. With this change, e2fsck is run only when you build the update.zip file, which is built when "dist" is among the make command. Bug: 7591683 Change-Id: I446b71d5aa9295aff3af622f115175f769746615 --- core/Makefile | 8 +++++--- tools/releasetools/build_image.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/Makefile b/core/Makefile index 7a4b874950..5928a7e82f 100644 --- a/core/Makefile +++ b/core/Makefile @@ -581,6 +581,7 @@ SELINUX_FC := $(TARGET_ROOT_OUT)/file_contexts INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC) # $(1): the path of the output dictionary file +# $(2): additional "key=value" pairs to append to the dictionary file. define generate-userimage-prop-dictionary $(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)) @@ -590,6 +591,7 @@ $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIM $(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1)) $(if $(mkyaffs2_extra_flags),$(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(1)) $(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1) +$(if $(2),$(hide) $(foreach kv,$(2),echo "$(kv)" >> $(1);)) endef # ----------------------------------------------------------------- @@ -773,7 +775,7 @@ BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img define build-systemimage-target @echo "Target system fs image: $(1)" @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt - $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt) + $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt, skip_fsck=true) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ ./build/tools/releasetools/build_image.py \ $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) @@ -930,7 +932,7 @@ define build-userdataimage-target $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") @mkdir -p $(TARGET_OUT_DATA) @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt - $(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt) + $(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt, skip_fsck=true) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ ./build/tools/releasetools/build_image.py \ $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) @@ -984,7 +986,7 @@ define build-cacheimage-target $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)") @mkdir -p $(TARGET_OUT_CACHE) @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt - $(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt) + $(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt, skip_fsck=true) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ ./build/tools/releasetools/build_image.py \ $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 94a9fda6dc..d5bd45146f 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -77,7 +77,7 @@ def BuildImage(in_dir, prop_dict, out_file): if exit_code != 0: return False - if run_fsck: + if run_fsck and prop_dict.get("skip_fsck") != "true": # Inflate the sparse image unsparse_image = os.path.join( os.path.dirname(out_file), "unsparse_" + os.path.basename(out_file)) @@ -113,6 +113,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): "extfs_sparse_flag", "mkyaffs2_extra_flags", "selinux_fc", + "skip_fsck", ) for p in common_props: copy_prop(p, p)