aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Qian2017-07-21 14:06:06 -0500
committerandroid-build-merger2017-07-21 14:06:06 -0500
commit92036417425386d103ce1550c1c95f6e695129cb (patch)
treef71477d34184063bacf632e5e2df409bd7f47f64 /updater
parent6d8827e0d3e1563d6d7e7d47f955c0118059134c (diff)
parentf7c00ddaf62a6a09ae257d193cadf286af750700 (diff)
downloadplatform-bootable-recovery-92036417425386d103ce1550c1c95f6e695129cb.tar.gz
platform-bootable-recovery-92036417425386d103ce1550c1c95f6e695129cb.tar.xz
platform-bootable-recovery-92036417425386d103ce1550c1c95f6e695129cb.zip
Merge "recovery: replace make_ext4 with e2fsprogs"
am: f7c00ddaf6 Change-Id: I17167b59242c709b18d09fccb52058b0bc25bf09
Diffstat (limited to 'updater')
-rw-r--r--updater/install.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/updater/install.cpp b/updater/install.cpp
index ff79edce..c9a3a079 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -302,9 +302,32 @@ Value* FormatFn(const char* name, State* state, const std::vector<std::unique_pt
302 } 302 }
303 303
304 if (fs_type == "ext4") { 304 if (fs_type == "ext4") {
305 int status = make_ext4fs(location.c_str(), size, mount_point.c_str(), sehandle); 305 const char* mke2fs_argv[] = { "/sbin/mke2fs_static", "-t", "ext4", "-b", "4096",
306 location.c_str(), nullptr, nullptr };
307 std::string size_str;
308 if (size != 0) {
309 size_str = std::to_string(size / 4096LL);
310 mke2fs_argv[6] = size_str.c_str();
311 }
312
313 int status = exec_cmd(mke2fs_argv[0], const_cast<char**>(mke2fs_argv));
314 if (status != 0) {
315 LOG(WARNING) << name << ": mke2fs failed (" << status << ") on " << location
316 << ", falling back to make_ext4fs";
317 status = make_ext4fs(location.c_str(), size, mount_point.c_str(), sehandle);
318 if (status != 0) {
319 LOG(ERROR) << name << ": make_ext4fs failed (" << status << ") on " << location;
320 return StringValue("");
321 }
322 return StringValue(location);
323 }
324
325 const char* e2fsdroid_argv[] = { "/sbin/e2fsdroid_static", "-e", "-S",
326 "/file_contexts", "-a", mount_point.c_str(),
327 location.c_str(), nullptr };
328 status = exec_cmd(e2fsdroid_argv[0], const_cast<char**>(e2fsdroid_argv));
306 if (status != 0) { 329 if (status != 0) {
307 LOG(ERROR) << name << ": make_ext4fs failed (" << status << ") on " << location; 330 LOG(ERROR) << name << ": e2fsdroid failed (" << status << ") on " << location;
308 return StringValue(""); 331 return StringValue("");
309 } 332 }
310 return StringValue(location); 333 return StringValue(location);