diff options
author | Yifan Hong <elsk@google.com> | 2020-12-08 20:28:41 +0000 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2020-12-08 12:42:55 -0800 |
commit | addbafdb0b545f93bfd4dea6aa5431341559132a (patch) | |
tree | 79468416ea35d0b1220e5690819ad7609477092a | |
parent | bca7bfcc54535e71bb965f378b7bc78aea4ae7b1 (diff) | |
download | core-addbafdb0b545f93bfd4dea6aa5431341559132a.tar.gz |
Revert "Move e2fsck into /first_stage_ramdisk."
This reverts commit 3337e782e6f8462c6a2954617e4c59c01ec502be.
Reason for revert: e2fsck is moved into vendor ramdisk and installed
to / or /first_stage_ramdisk depending on the device, so there is no
need to move it.
Bug: 173425293
Change-Id: I1eb431e6b2a1e0ba7d0da0278d076b6682a0156d
Test: boots
-rw-r--r-- | init/first_stage_init.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp index 83a32e746..0949fc522 100644 --- a/init/first_stage_init.cpp +++ b/init/first_stage_init.cpp @@ -99,34 +99,6 @@ bool ForceNormalBoot(const std::string& cmdline) { return cmdline.find("androidboot.force_normal_boot=1") != std::string::npos; } -// Move e2fsck before switching root, so that it is available at the same path -// after switching root. -void PrepareSwitchRoot() { - constexpr const char* src = "/system/bin/e2fsck"; - constexpr const char* dst = "/first_stage_ramdisk/system/bin/e2fsck"; - - if (access(dst, X_OK) == 0) { - LOG(INFO) << dst << " already exists and it can be executed"; - return; - } - - if (access(src, F_OK) != 0) { - PLOG(INFO) << "Not moving " << src << " because it cannot be accessed"; - return; - } - - auto dst_dir = android::base::Dirname(dst); - std::error_code ec; - if (!fs::create_directories(dst_dir, ec) && !!ec) { - LOG(FATAL) << "Cannot create " << dst_dir << ": " << ec.message(); - } - if (rename(src, dst) != 0) { - PLOG(FATAL) << "Cannot move " << src << " to " << dst - << ". Either install e2fsck.ramdisk so that it is at the correct place (" << dst - << "), or make ramdisk writable"; - } -} - } // namespace std::string GetModuleLoadList(bool recovery, const std::string& dir_path) { @@ -327,7 +299,6 @@ int FirstStageMain(int argc, char** argv) { if (ForceNormalBoot(cmdline)) { mkdir("/first_stage_ramdisk", 0755); - PrepareSwitchRoot(); // SwitchRoot() must be called with a mount point as the target, so we bind mount the // target directory to itself here. if (mount("/first_stage_ramdisk", "/first_stage_ramdisk", nullptr, MS_BIND, nullptr) != 0) { |