aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@google.com>2017-11-28 19:48:05 -0800
committerLuca Stefani <luca.stefani.ge1@gmail.com>2018-02-09 19:13:58 +0000
commit245b34d39ea59ac9bda2f9d2a6fac7a4795148e4 (patch)
treeca2ece5f8c2c5befcb5f77e456ddbe4822b525f8
parent5833722548a842472f77ed69492a1607f2017175 (diff)
downloadandroid_bootable_recovery-lineage-15.1_20180224.tar.gz
android_bootable_recovery-lineage-15.1_20180224.tar.bz2
android_bootable_recovery-lineage-15.1_20180224.zip
add sload.f2fs for recovery formatstaging/lineage-15.1lineage-15.1_20180224
Change-Id: Iddfe54b2b36f2d531925cbe61c98dbfb4903c0d1 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com> (cherry picked from commit c1c7311b8ada7fce948afaabe91d72f4a7c0cb68)
-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 e81e1c71..f5af243f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -90,7 +90,7 @@ LOCAL_REQUIRED_MODULES := e2fsdroid_static mke2fs_static mke2fs.conf
ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
ifeq ($(HOST_OS),linux)
-LOCAL_REQUIRED_MODULES += mkfs.f2fs
+LOCAL_REQUIRED_MODULES += sload.f2fs mkfs.f2fs
endif
endif
diff --git a/roots.cpp b/roots.cpp
index d95bbafe..f847188b 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -301,16 +301,23 @@ int format_volume(const char* volume, const char* directory) {
}
// Has to be f2fs because we checked earlier.
- std::vector<std::string> f2fs_args = { "/sbin/mkfs.f2fs", "-d1", "-f",
- "-O", "encrypt", "-O", "quota",
- v->blk_device };
+ std::string cmd("/sbin/mkfs.f2fs");
+ std::vector<std::string> make_f2fs_cmd = { cmd, "-d1", "-f", "-O",
+ "encrypt", "-O", "quota", v->blk_device };
if (length >= 512) {
- f2fs_args.push_back(std::to_string(length / 512));
+ make_f2fs_cmd.push_back(std::to_string(length / 512));
}
- int result = exec_cmd(f2fs_args);
+ int result = exec_cmd(make_f2fs_cmd);
+ if (result == 0 && directory != nullptr) {
+ cmd = "/sbin/sload.f2fs";
+ std::vector<std::string> sload_f2fs_cmd = {
+ cmd, "-f", directory, "-t", volume, v->blk_device,
+ };
+ result = exec_cmd(sload_f2fs_cmd);
+ }
if (result != 0) {
- PLOG(ERROR) << "format_volume: Failed to make f2fs on " << v->blk_device;
+ PLOG(ERROR) << "format_volume: Failed " << cmd << " on " << v->blk_device;
return -1;
}
return 0;
diff --git a/updater/install.cpp b/updater/install.cpp
index eed581b5..774a8b7c 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -354,6 +354,15 @@ Value* FormatFn(const char* name, State* state, const std::vector<std::unique_pt
LOG(ERROR) << name << ": mkfs.f2fs failed (" << status << ") on " << location;
return StringValue("");
}
+
+ const char* sload_argv[] = { "/sbin/sload.f2fs", "-t", mount_point.c_str(), location.c_str(),
+ nullptr };
+ status = exec_cmd(sload_argv[0], const_cast<char**>(sload_argv));
+ if (status != 0) {
+ LOG(ERROR) << name << ": sload.f2fs failed (" << status << ") on " << location;
+ return StringValue("");
+ }
+
return StringValue(location);
} else {
LOG(ERROR) << name << ": unsupported fs_type \"" << fs_type << "\" partition_type \""