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
This commit is contained in:
@@ -1550,6 +1550,8 @@ $(if $(filter $(2),system),\
|
|||||||
$(if $(filter $(2),userdata),\
|
$(if $(filter $(2),userdata),\
|
||||||
$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(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_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
|
||||||
|
$(if $(PRODUCT_FS_CASEFOLD),$(hide) echo "needs_casefold=$(PRODUCT_FS_CASEFOLD)" >> $(1))
|
||||||
|
$(if $(PRODUCT_QUOTA_PROJID),$(hide) echo "needs_projid=$(PRODUCT_QUOTA_PROJID)" >> $(1))
|
||||||
$(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
|
$(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
|
||||||
)
|
)
|
||||||
$(if $(filter $(2),cache),\
|
$(if $(filter $(2),cache),\
|
||||||
|
21
target/product/emulated_storage.mk
Normal file
21
target/product/emulated_storage.mk
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2020 The Android Open-Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
PRODUCT_QUOTA_PROJID := 1
|
||||||
|
PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.projid=1
|
||||||
|
|
||||||
|
PRODUCT_FS_CASEFOLD := 1
|
||||||
|
PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.casefold=1
|
@@ -248,6 +248,8 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
|
|||||||
build_command = []
|
build_command = []
|
||||||
fs_type = prop_dict.get("fs_type", "")
|
fs_type = prop_dict.get("fs_type", "")
|
||||||
run_e2fsck = False
|
run_e2fsck = False
|
||||||
|
needs_projid = prop_dict.get("needs_projid", 0)
|
||||||
|
needs_casefold = prop_dict.get("needs_casefold", 0)
|
||||||
|
|
||||||
if fs_type.startswith("ext"):
|
if fs_type.startswith("ext"):
|
||||||
build_command = [prop_dict["ext_mkuserimg"]]
|
build_command = [prop_dict["ext_mkuserimg"]]
|
||||||
@@ -287,7 +289,10 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
|
|||||||
build_command.extend(["-S", prop_dict["hash_seed"]])
|
build_command.extend(["-S", prop_dict["hash_seed"]])
|
||||||
if "ext4_share_dup_blocks" in prop_dict:
|
if "ext4_share_dup_blocks" in prop_dict:
|
||||||
build_command.append("-c")
|
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:
|
if "selinux_fc" in prop_dict:
|
||||||
build_command.append(prop_dict["selinux_fc"])
|
build_command.append(prop_dict["selinux_fc"])
|
||||||
elif fs_type.startswith("squash"):
|
elif fs_type.startswith("squash"):
|
||||||
@@ -328,6 +333,10 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
|
|||||||
if "timestamp" in prop_dict:
|
if "timestamp" in prop_dict:
|
||||||
build_command.extend(["-T", str(prop_dict["timestamp"])])
|
build_command.extend(["-T", str(prop_dict["timestamp"])])
|
||||||
build_command.extend(["-L", prop_dict["mount_point"]])
|
build_command.extend(["-L", prop_dict["mount_point"]])
|
||||||
|
if (needs_projid):
|
||||||
|
build_command.append("--prjquota")
|
||||||
|
if (needs_casefold):
|
||||||
|
build_command.append("--casefold")
|
||||||
else:
|
else:
|
||||||
raise BuildImageError(
|
raise BuildImageError(
|
||||||
"Error: unknown filesystem type: {}".format(fs_type))
|
"Error: unknown filesystem type: {}".format(fs_type))
|
||||||
@@ -598,6 +607,8 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
|
|||||||
copy_prop("flash_logical_block_size", "flash_logical_block_size")
|
copy_prop("flash_logical_block_size", "flash_logical_block_size")
|
||||||
copy_prop("flash_erase_block_size", "flash_erase_block_size")
|
copy_prop("flash_erase_block_size", "flash_erase_block_size")
|
||||||
copy_prop("userdata_selinux_fc", "selinux_fc")
|
copy_prop("userdata_selinux_fc", "selinux_fc")
|
||||||
|
copy_prop("needs_casefold", "needs_casefold")
|
||||||
|
copy_prop("needs_projid", "needs_projid")
|
||||||
elif mount_point == "cache":
|
elif mount_point == "cache":
|
||||||
copy_prop("cache_fs_type", "fs_type")
|
copy_prop("cache_fs_type", "fs_type")
|
||||||
copy_prop("cache_size", "partition_size")
|
copy_prop("cache_size", "partition_size")
|
||||||
|
Reference in New Issue
Block a user