aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim2017-12-07 18:57:41 -0600
committerGerrit Code Review2017-12-07 18:57:41 -0600
commit4eaf7a157d3fe7f673a86b78cb07a99b25f1b780 (patch)
tree9404dbb9e072724ff2cfa0aa0cf6913da796790b
parented369101ba47f5696e13d6c56df27453de2d9151 (diff)
parentc1c7311b8ada7fce948afaabe91d72f4a7c0cb68 (diff)
downloadplatform-bootable-recovery-4eaf7a157d3fe7f673a86b78cb07a99b25f1b780.tar.gz
platform-bootable-recovery-4eaf7a157d3fe7f673a86b78cb07a99b25f1b780.tar.xz
platform-bootable-recovery-4eaf7a157d3fe7f673a86b78cb07a99b25f1b780.zip
Merge "add sload.f2fs for recovery format"
-rw-r--r--Android.mk2
-rw-r--r--roots.cpp19
-rw-r--r--updater/install.cpp9
3 files changed, 23 insertions, 7 deletions
diff --git a/Android.mk b/Android.mk
index d9966b7c..2f57db34 100644
--- a/Android.mk
+++ b/Android.mk
@@ -89,7 +89,7 @@ LOCAL_REQUIRED_MODULES := e2fsdroid_static mke2fs_static mke2fs.conf
89 89
90ifeq ($(TARGET_USERIMAGES_USE_F2FS),true) 90ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
91ifeq ($(HOST_OS),linux) 91ifeq ($(HOST_OS),linux)
92LOCAL_REQUIRED_MODULES += mkfs.f2fs 92LOCAL_REQUIRED_MODULES += sload.f2fs mkfs.f2fs
93endif 93endif
94endif 94endif
95 95
diff --git a/roots.cpp b/roots.cpp
index eb299ad6..e2d5d654 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -324,16 +324,23 @@ int format_volume(const char* volume, const char* directory) {
324 } 324 }
325 325
326 // Has to be f2fs because we checked earlier. 326 // Has to be f2fs because we checked earlier.
327 std::vector<std::string> f2fs_args = { "/sbin/mkfs.f2fs", "-d1", "-f", 327 std::string cmd("/sbin/mkfs.f2fs");
328 "-O", "encrypt", "-O", "quota", 328 std::vector<std::string> make_f2fs_cmd = { cmd, "-d1", "-f", "-O",
329 v->blk_device }; 329 "encrypt", "-O", "quota", v->blk_device };
330 if (length >= 512) { 330 if (length >= 512) {
331 f2fs_args.push_back(std::to_string(length / 512)); 331 make_f2fs_cmd.push_back(std::to_string(length / 512));
332 } 332 }
333 333
334 int result = exec_cmd(f2fs_args); 334 int result = exec_cmd(make_f2fs_cmd);
335 if (result == 0 && directory != nullptr) {
336 cmd = "/sbin/sload.f2fs";
337 std::vector<std::string> sload_f2fs_cmd = {
338 cmd, "-f", directory, "-t", volume, v->blk_device,
339 };
340 result = exec_cmd(sload_f2fs_cmd);
341 }
335 if (result != 0) { 342 if (result != 0) {
336 PLOG(ERROR) << "format_volume: Failed to make f2fs on " << v->blk_device; 343 PLOG(ERROR) << "format_volume: Failed " << cmd << " on " << v->blk_device;
337 return -1; 344 return -1;
338 } 345 }
339 return 0; 346 return 0;
diff --git a/updater/install.cpp b/updater/install.cpp
index 870b8579..b83d30ff 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -318,6 +318,15 @@ Value* FormatFn(const char* name, State* state, const std::vector<std::unique_pt
318 LOG(ERROR) << name << ": mkfs.f2fs failed (" << status << ") on " << location; 318 LOG(ERROR) << name << ": mkfs.f2fs failed (" << status << ") on " << location;
319 return StringValue(""); 319 return StringValue("");
320 } 320 }
321
322 const char* sload_argv[] = { "/sbin/sload.f2fs", "-t", mount_point.c_str(), location.c_str(),
323 nullptr };
324 status = exec_cmd(sload_argv[0], const_cast<char**>(sload_argv));
325 if (status != 0) {
326 LOG(ERROR) << name << ": sload.f2fs failed (" << status << ") on " << location;
327 return StringValue("");
328 }
329
321 return StringValue(location); 330 return StringValue(location);
322 } else { 331 } else {
323 LOG(ERROR) << name << ": unsupported fs_type \"" << fs_type << "\" partition_type \"" 332 LOG(ERROR) << name << ": unsupported fs_type \"" << fs_type << "\" partition_type \""