summaryrefslogtreecommitdiffstats
path: root/updater
diff options
context:
space:
mode:
authorJin Qian <jinqian@google.com>2017-04-21 23:36:12 +0200
committerJin Qian <jinqian@google.com>2017-06-19 21:22:24 +0200
commitac31808cd37cfb98755e5821dbb2efb5fe5cb12a (patch)
treecf43a0fcab983f39f817ed91fe5dd739d14b0e9c /updater
parentMerge "Introduce VR recovery ui" am: 5efe2bca22 am: 850e00951a am: 8daabacce5 (diff)
downloadandroid_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.tar
android_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.tar.gz
android_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.tar.bz2
android_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.tar.lz
android_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.tar.xz
android_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.tar.zst
android_bootable_recovery-ac31808cd37cfb98755e5821dbb2efb5fe5cb12a.zip
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 ff79edce0..c9a3a0799 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
}
if (fs_type == "ext4") {
- int status = make_ext4fs(location.c_str(), size, mount_point.c_str(), sehandle);
+ const char* mke2fs_argv[] = { "/sbin/mke2fs_static", "-t", "ext4", "-b", "4096",
+ location.c_str(), nullptr, nullptr };
+ std::string size_str;
+ if (size != 0) {
+ size_str = std::to_string(size / 4096LL);
+ mke2fs_argv[6] = size_str.c_str();
+ }
+
+ int status = exec_cmd(mke2fs_argv[0], const_cast<char**>(mke2fs_argv));
+ if (status != 0) {
+ LOG(WARNING) << name << ": mke2fs failed (" << status << ") on " << location
+ << ", falling back to make_ext4fs";
+ status = make_ext4fs(location.c_str(), size, mount_point.c_str(), sehandle);
+ if (status != 0) {
+ LOG(ERROR) << name << ": make_ext4fs failed (" << status << ") on " << location;
+ return StringValue("");
+ }
+ return StringValue(location);
+ }
+
+ const char* e2fsdroid_argv[] = { "/sbin/e2fsdroid_static", "-e", "-S",
+ "/file_contexts", "-a", mount_point.c_str(),
+ location.c_str(), nullptr };
+ status = exec_cmd(e2fsdroid_argv[0], const_cast<char**>(e2fsdroid_argv));
if (status != 0) {
- LOG(ERROR) << name << ": make_ext4fs failed (" << status << ") on " << location;
+ LOG(ERROR) << name << ": e2fsdroid failed (" << status << ") on " << location;
return StringValue("");
}
return StringValue(location);