summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-11-01 04:05:02 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-11-01 04:05:02 +0100
commit3bcfb8f14ea0a2a5fb4563027a334aab24762efb (patch)
tree1756dfdd6ac3fa71e456a4d903a1659441d2a949 /roots.cpp
parentSnap for 5101359 from 3dc4ccbdea90e1aa8a93bb3f513959ef2b499df5 to qt-release (diff)
parentMerge "recovery: Fix mounting /system with dynamic partitions." am: 023807fcf7 am: e3f6814451 (diff)
downloadandroid_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.tar
android_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.tar.gz
android_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.tar.bz2
android_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.tar.lz
android_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.tar.xz
android_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.tar.zst
android_bootable_recovery-3bcfb8f14ea0a2a5fb4563027a334aab24762efb.zip
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/roots.cpp b/roots.cpp
index c29771af6..dc347848a 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -38,10 +38,12 @@
#include <cryptfs.h>
#include <ext4_utils/wipe.h>
#include <fs_mgr.h>
+#include <fs_mgr_dm_linear.h>
#include "otautil/mounts.h"
static struct fstab* fstab = nullptr;
+static bool did_map_logical_partitions = false;
extern struct selabel_handle* sehandle;
@@ -117,6 +119,25 @@ int ensure_path_mounted_at(const char* path, const char* mount_point) {
mount_point = v->mount_point;
}
+ // If we can't acquire the block device for a logical partition, it likely
+ // was never created. In that case we try to create it.
+ if (fs_mgr_is_logical(v) && !fs_mgr_update_logical_partition(v)) {
+ if (did_map_logical_partitions) {
+ LOG(ERROR) << "Failed to find block device for partition";
+ return -1;
+ }
+ std::string super_name = fs_mgr_get_super_partition_name();
+ if (!android::fs_mgr::CreateLogicalPartitions(super_name)) {
+ LOG(ERROR) << "Failed to create logical partitions";
+ return -1;
+ }
+ did_map_logical_partitions = true;
+ if (!fs_mgr_update_logical_partition(v)) {
+ LOG(ERROR) << "Failed to find block device for partition";
+ return -1;
+ }
+ }
+
const MountedVolume* mv = find_mounted_volume_by_mount_point(mount_point);
if (mv != nullptr) {
// Volume is already mounted.
@@ -387,3 +408,7 @@ int setup_install_mounts() {
}
return 0;
}
+
+bool logical_partitions_mapped() {
+ return did_map_logical_partitions;
+}