Add build properties to enable casefold and prj_quota
This adds the ability to format f2fs and ext4 in a way that supports
casefolding and project quotas. Project quotas require wider inodes, and
thus cannot be enable apart from at build time. Casefolding can be
configured with f2fs.fsck/tune2fs later.
Both features are enabled via inheriting emulated_storage.mk in the
device.mk
Bug: 138322712
Bug: 138321217
Test: Enable on device with related patches, view fs configuration on /data
Change-Id: Ib1ab0589006ff1b3fb7478b7e9b0a8aad71e4b09
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 1e7d387..e424b6f 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -248,6 +248,8 @@
build_command = []
fs_type = prop_dict.get("fs_type", "")
run_e2fsck = False
+ needs_projid = prop_dict.get("needs_projid", 0)
+ needs_casefold = prop_dict.get("needs_casefold", 0)
if fs_type.startswith("ext"):
build_command = [prop_dict["ext_mkuserimg"]]
@@ -287,7 +289,10 @@
build_command.extend(["-S", prop_dict["hash_seed"]])
if "ext4_share_dup_blocks" in prop_dict:
build_command.append("-c")
- build_command.extend(["--inode_size", "256"])
+ if (needs_projid):
+ build_command.extend(["--inode_size", "512"])
+ else:
+ build_command.extend(["--inode_size", "256"])
if "selinux_fc" in prop_dict:
build_command.append(prop_dict["selinux_fc"])
elif fs_type.startswith("squash"):
@@ -328,6 +333,10 @@
if "timestamp" in prop_dict:
build_command.extend(["-T", str(prop_dict["timestamp"])])
build_command.extend(["-L", prop_dict["mount_point"]])
+ if (needs_projid):
+ build_command.append("--prjquota")
+ if (needs_casefold):
+ build_command.append("--casefold")
else:
raise BuildImageError(
"Error: unknown filesystem type: {}".format(fs_type))
@@ -598,6 +607,8 @@
copy_prop("flash_logical_block_size", "flash_logical_block_size")
copy_prop("flash_erase_block_size", "flash_erase_block_size")
copy_prop("userdata_selinux_fc", "selinux_fc")
+ copy_prop("needs_casefold", "needs_casefold")
+ copy_prop("needs_projid", "needs_projid")
elif mount_point == "cache":
copy_prop("cache_fs_type", "fs_type")
copy_prop("cache_size", "partition_size")