From 0bbc764bbe8fc04eba1bf708fbf97526950cbeef Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 29 Mar 2017 23:57:47 -0700 Subject: updater: Don't append newline when calling uiPrint(). LOG(INFO) already appends a newline. Don't print redundant newline. Test: No extra blank lines when calling ui_print(). And on-screen UI shows the same. Change-Id: I74e9a8504a7146a6cb3dae02fe2406d0dd54069b --- updater/install.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'updater/install.cpp') diff --git a/updater/install.cpp b/updater/install.cpp index f91f3fc9f..857d7f1e0 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -181,8 +181,8 @@ Value* MountFn(const char* name, State* state, const std::vector>& argv) { std::vector args; if (!ReadArgs(state, argv, &args)) { - return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); + return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); } - std::string buffer = android::base::Join(args, "") + "\n"; + std::string buffer = android::base::Join(args, ""); uiPrint(state, buffer); return StringValue(buffer); } -- cgit v1.2.3 From 8706a98aa635236a95795f0a0c122bb3e591a50d Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Tue, 18 Apr 2017 08:28:26 -0700 Subject: Adding support for quiescent reboot to recovery Bug: 37401320 Test: build and push OTA and hit adb reboot recovery,quiescent. The screen should remain off throughout the upgrade process. Change-Id: Ibed3795c09e26c4fa73684d40b94e40c78394d3f --- updater/install.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'updater/install.cpp') diff --git a/updater/install.cpp b/updater/install.cpp index 857d7f1e0..888239c83 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -890,7 +890,10 @@ Value* RebootNowFn(const char* name, State* state, const std::vector Date: Fri, 12 May 2017 11:02:27 -0700 Subject: updater: Update the mkfs.f2fs argument to match f2fs-tools 1.8.0. Commit adeb41a8c0da3122a2907acb4aafd7ff9bce26af has switched the argument for recovery. This CL handles the case for updater. Note that there's a chance the updater may run against the old recovery (and f2fs 1.4.1 binary). Not sending a 0-sector argument to f2fs 1.4.1 also works. Bug: 37758867 Test: Make an OTA package that calls format f2fs, with mkfs.f2fs 1.8.0 and 1.4.1 binaries respectively. Change-Id: I4d4bbe8c57544d1c514b7aa37fbf22a0aab14e2c --- updater/install.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'updater/install.cpp') diff --git a/updater/install.cpp b/updater/install.cpp index 888239c83..c5f9a89bb 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -317,9 +317,11 @@ Value* FormatFn(const char* name, State* state, const std::vector(f2fs_argv)); + const char* f2fs_argv[] = { + "mkfs.f2fs", "-t", "-d1", location.c_str(), (size < 512) ? nullptr : num_sectors.c_str(), + nullptr + }; + int status = exec_cmd(f2fs_path, const_cast(f2fs_argv)); if (status != 0) { LOG(ERROR) << name << ": mkfs.f2fs failed (" << status << ") on " << location; return StringValue(""); -- cgit v1.2.3 From 53c38b15381ace565227e49104a6fd64c4c28dcc Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Wed, 10 May 2017 14:47:45 -0700 Subject: kill package_extract_dir It's only used by file-based OTA which has been deprecated for O. Test: mma Change-Id: I439c93155ca94554d827142c99aa6c0845cc7561 --- updater/install.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'updater/install.cpp') diff --git a/updater/install.cpp b/updater/install.cpp index c5f9a89bb..ff79edce0 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -61,7 +61,6 @@ #include "mounts.h" #include "ota_io.h" #include "otautil/DirUtil.h" -#include "otautil/ZipUtil.h" #include "print_sha1.h" #include "tune2fs.h" #include "updater/updater.h" @@ -389,36 +388,6 @@ Value* SetProgressFn(const char* name, State* state, const std::vector>&argv) { - if (argv.size() != 2) { - return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, - argv.size()); - } - - std::vector args; - if (!ReadArgs(state, argv, &args)) { - return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); - } - const std::string& zip_path = args[0]; - const std::string& dest_path = args[1]; - - ZipArchiveHandle za = static_cast(state->cookie)->package_zip; - - // To create a consistent system image, never use the clock for timestamps. - constexpr struct utimbuf timestamp = { 1217592000, 1217592000 }; // 8/1/2008 default - - bool success = ExtractPackageRecursive(za, zip_path, dest_path, ×tamp, sehandle); - - return StringValue(success ? "t" : ""); -} - // package_extract_file(package_file[, dest_file]) // Extracts a single package_file from the update package and writes it to dest_file, // overwriting existing files if necessary. Without the dest_file argument, returns the @@ -1037,7 +1006,6 @@ void RegisterInstallFunctions() { RegisterFunction("format", FormatFn); RegisterFunction("show_progress", ShowProgressFn); RegisterFunction("set_progress", SetProgressFn); - RegisterFunction("package_extract_dir", PackageExtractDirFn); RegisterFunction("package_extract_file", PackageExtractFileFn); RegisterFunction("getprop", GetPropFn); -- cgit v1.2.3 From ac31808cd37cfb98755e5821dbb2efb5fe5cb12a Mon Sep 17 00:00:00 2001 From: Jin Qian Date: Fri, 21 Apr 2017 14:36:12 -0700 Subject: recovery: replace make_ext4 with e2fsprogs Execute mke2fs to create empty ext4 filesystem. Execute e2fsdroid to add files to filesystem. Test: enter recovery mode and wipe data Bug: 35219933 Change-Id: I10a9f4c1f4754ad864b2df45b1f879180ab33876 --- updater/install.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'updater/install.cpp') 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(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(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); -- cgit v1.2.3 From 7af933b6a6fd687bd17710ef6fda0ad5483e4d6d Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 11 Jul 2017 16:45:04 -0700 Subject: Remove the obsolete reference to /file_contexts. This file no longer exists: - /file_contexts has been split into plat_file_contexts and nonplat_file_contexts since commit b236eb6ca204cefcb926e19bd5682f9dcad4021d (system/sepolicy). - It was named /file_contexts.bin prior to the split. '-S file_contexts' is also no longer required by e2fsdroid, since commit 2fff6fb036cbbb6dedd7da3d208b312a9038a5ce (external/e2fsprogs). It will load the file contexts via libselinux. Test: Trigger the path by performing a data wipe for converting to FBE. Change-Id: I179939da409e5c0415ae0ea0bf5ddb23f9e6331e --- updater/install.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'updater/install.cpp') diff --git a/updater/install.cpp b/updater/install.cpp index c9a3a0799..bfe91e7f9 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -322,8 +322,7 @@ Value* FormatFn(const char* name, State* state, const std::vector(e2fsdroid_argv)); if (status != 0) { -- cgit v1.2.3