From 5bfed5a320860de5d44c915c88cf7f72c2cdb574 Mon Sep 17 00:00:00 2001 From: JP Abgrall Date: Mon, 16 Jun 2014 14:17:40 -0700 Subject: [PATCH] core+tools: support specifying F2FS as the fstype for userdata - Support TARGET_USERIMAGES_USE_F2FS. - Support BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE. - Support "userdata_fs_type" in the prop dict. - Update build_image to recognize f2fs and call the correct command. Change-Id: If31cc8bd235f93a4c7814fab36e6e2d13d3037ad Signed-off-by: JP Abgrall --- core/Makefile | 8 +++++++- core/config.mk | 2 ++ core/product.mk | 1 + tools/releasetools/build_image.py | 5 +++++ tools/releasetools/common.py | 3 ++- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/Makefile b/core/Makefile index 00df89dba..36ad0aeb5 100644 --- a/core/Makefile +++ b/core/Makefile @@ -634,10 +634,15 @@ ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)) endif ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) -INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(SIMG2IMG) $(E2FSCK) +INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG) +INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) +ifeq ($(TARGET_USERIMAGES_USE_F2FS),true) +INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS) +endif else INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2) endif + INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS))) ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)) @@ -652,6 +657,7 @@ INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC) 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)) +$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1)) $(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)) diff --git a/core/config.mk b/core/config.mk index e444635c8..6067f9f77 100644 --- a/core/config.mk +++ b/core/config.mk @@ -386,6 +386,8 @@ FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) MKEXT2IMG := $(HOST_OUT_EXECUTABLES)/genext2fs$(HOST_EXECUTABLE_SUFFIX) MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX) MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh +MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX) +MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX) E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX) diff --git a/core/product.mk b/core/product.mk index 6a6327de5..7eef2e534 100644 --- a/core/product.mk +++ b/core/product.mk @@ -250,6 +250,7 @@ _product_stash_var_list += \ BOARD_BOOTIMAGE_PARTITION_SIZE \ BOARD_RECOVERYIMAGE_PARTITION_SIZE \ BOARD_SYSTEMIMAGE_PARTITION_SIZE \ + BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \ BOARD_USERDATAIMAGE_PARTITION_SIZE \ BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ BOARD_CACHEIMAGE_PARTITION_SIZE \ diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 6b593e394..f8cba44ca 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -256,6 +256,9 @@ def BuildImage(in_dir, prop_dict, out_file, build_command.append(fc_config) elif "selinux_fc" in prop_dict: build_command.append(prop_dict["selinux_fc"]) + elif fs_type.startswith("f2fs"): + build_command = ["mkf2fsuserimg.sh"] + build_command.extend([out_file, prop_dict["partition_size"]]) else: build_command = ["mkyaffs2image", "-f"] if prop_dict.get("mkyaffs2_extra_flags", None): @@ -325,7 +328,9 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("fs_type", "fs_type") copy_prop("system_size", "partition_size") elif mount_point == "data": + # Copy the generic fs type first, override with specific one if available. copy_prop("fs_type", "fs_type") + copy_prop("userdata_fs_type", "fs_type") copy_prop("userdata_size", "partition_size") elif mount_point == "cache": copy_prop("cache_fs_type", "fs_type") diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 27981cd0c..701a9cb85 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -968,7 +968,8 @@ def ComputeDifferences(diffs): # map recovery.fstab's fs_types to mount/format "partition types" PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD", - "ext4": "EMMC", "emmc": "EMMC" } + "ext4": "EMMC", "emmc": "EMMC", + "f2fs": "EMMC" } def GetTypeAndDevice(mount_point, info): fstab = info["fstab"]