summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-01-25 04:33:50 +0100
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-01-25 04:33:50 +0100
commitdd06949075eeee1f21c46d16f42994cd17defed0 (patch)
tree15830eef119beb1d1c9957d75737ef1905b94158
parentMerge "Mark libedify library as recovery_available." am: e3c7b067c8 am: 8de3a75e87 am: 4366e0d470 (diff)
parentMerge "Set Casefold and PrjQuotas in Factory Reset" am: 1cf5b0b591 am: ddb9dbb52b (diff)
downloadandroid_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.tar
android_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.tar.gz
android_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.tar.bz2
android_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.tar.lz
android_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.tar.xz
android_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.tar.zst
android_bootable_recovery-dd06949075eeee1f21c46d16f42994cd17defed0.zip
-rw-r--r--recovery_utils/roots.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/recovery_utils/roots.cpp b/recovery_utils/roots.cpp
index fe3a07aa2..127039872 100644
--- a/recovery_utils/roots.cpp
+++ b/recovery_utils/roots.cpp
@@ -30,6 +30,7 @@
#include <vector>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <cryptfs.h>
@@ -152,6 +153,14 @@ int format_volume(const std::string& volume, const std::string& directory) {
return -1;
}
+ bool needs_casefold = false;
+ bool needs_projid = false;
+
+ if (volume == "/data") {
+ needs_casefold = android::base::GetBoolProperty("ro.emulated_storage.casefold", false);
+ needs_projid = android::base::GetBoolProperty("ro.emulated_storage.projid", false);
+ }
+
// If there's a key_loc that looks like a path, it should be a block device for storing encryption
// metadata. Wipe it too.
if (!v->key_loc.empty() && v->key_loc[0] == '/') {
@@ -187,6 +196,12 @@ int format_volume(const std::string& volume, const std::string& directory) {
"/system/bin/mke2fs", "-F", "-t", "ext4", "-b", std::to_string(kBlockSize),
};
+ // Project ID's require wider inodes. The Quotas themselves are enabled by tune2fs on boot.
+ if (needs_projid) {
+ mke2fs_args.push_back("-I");
+ mke2fs_args.push_back("512");
+ }
+
int raid_stride = v->logical_blk_size / kBlockSize;
int raid_stripe_width = v->erase_blk_size / kBlockSize;
// stride should be the max of 8KB and logical block size
@@ -224,8 +239,18 @@ int format_volume(const std::string& volume, const std::string& directory) {
"/system/bin/make_f2fs",
"-g",
"android",
- v->blk_device,
};
+ if (needs_projid) {
+ make_f2fs_cmd.push_back("-O");
+ make_f2fs_cmd.push_back("project_quota,extra_attr");
+ }
+ if (needs_casefold) {
+ make_f2fs_cmd.push_back("-O");
+ make_f2fs_cmd.push_back("casefold");
+ make_f2fs_cmd.push_back("-C");
+ make_f2fs_cmd.push_back("utf8");
+ }
+ make_f2fs_cmd.push_back(v->blk_device);
if (length >= kSectorSize) {
make_f2fs_cmd.push_back(std::to_string(length / kSectorSize));
}