Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62f35129 authored by Howard Chen's avatar Howard Chen Committed by Gerrit Code Review
Browse files

Merge "Refine the first stage mount for DSU"

parents f633b62b a841bd48
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <fs_mgr_dm_linear.h>
#include <libdm/loop_control.h>
#include <libfiemap/split_fiemap_writer.h>
#include <libgsi/libgsi.h>

#include "metadata.h"
#include "utility.h"
@@ -34,6 +35,7 @@ namespace android {
namespace fiemap {

using namespace std::literals;
using android::base::ReadFileToString;
using android::base::unique_fd;
using android::dm::DeviceMapper;
using android::dm::DmDeviceState;
@@ -53,6 +55,11 @@ static constexpr char kTestImageMetadataDir[] = "/metadata/gsi/test";
std::unique_ptr<ImageManager> ImageManager::Open(const std::string& dir_prefix) {
    auto metadata_dir = "/metadata/gsi/" + dir_prefix;
    auto data_dir = "/data/gsi/" + dir_prefix;
    auto install_dir_file = gsi::DsuInstallDirFile(gsi::GetDsuSlot(dir_prefix));
    std::string path;
    if (ReadFileToString(install_dir_file, &path)) {
        data_dir = path;
    }
    return Open(metadata_dir, data_dir);
}

+7 −2
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ using android::fs_mgr::ReadDefaultFstab;
using android::fs_mgr::ReadFstabFromDt;
using android::fs_mgr::SkipMountingPartitions;
using android::fs_mgr::TransformFstabForDsu;
using android::init::WriteFile;
using android::snapshot::SnapshotManager;

using namespace std::literals;
@@ -620,7 +619,13 @@ void FirstStageMount::UseDsuIfPresent() {
        }
        return InitRequiredDevices(std::move(devices));
    };
    auto images = IImageManager::Open("dsu", 0ms);
    std::string active_dsu;
    if (!gsi::GetActiveDsu(&active_dsu)) {
        LOG(ERROR) << "Failed to GetActiveDsu";
        return;
    }
    LOG(INFO) << "DSU slot: " << active_dsu;
    auto images = IImageManager::Open("dsu/" + active_dsu, 0ms);
    if (!images || !images->MapAllImages(init_devices)) {
        LOG(ERROR) << "DSU partition layout could not be instantiated";
        return;