summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@google.com>2017-12-08 02:07:11 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-12-08 02:07:11 +0100
commit3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e (patch)
tree9404dbb9e072724ff2cfa0aa0cf6913da796790b /roots.cpp
parentMerge "Add a /bin symlink for consistency." (diff)
parentMerge "add sload.f2fs for recovery format" (diff)
downloadandroid_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.tar
android_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.tar.gz
android_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.tar.bz2
android_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.tar.lz
android_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.tar.xz
android_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.tar.zst
android_bootable_recovery-3d4359d3ae9f25e7b6f366e6308c5c2a5cf15d3e.zip
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/roots.cpp b/roots.cpp
index eb299ad6b..e2d5d6543 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -324,16 +324,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;