summaryrefslogtreecommitdiffstats
path: root/fs_mgr/fs_mgr.cpp
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2018-10-30 15:06:46 -0700
committerDavid Anderson <dvander@google.com>2018-11-02 14:51:16 -0700
commit0bfa1c8b3c19146405372d0cfb527b66ee75d433 (patch)
tree5ca5d45523020bc35408995ece918d1f991b7f04 /fs_mgr/fs_mgr.cpp
parent1d0ee36de7af27ee43e5075b99e9427130a1f0f1 (diff)
downloadsystem_core-0bfa1c8b3c19146405372d0cfb527b66ee75d433.tar.gz
system_core-0bfa1c8b3c19146405372d0cfb527b66ee75d433.tar.bz2
system_core-0bfa1c8b3c19146405372d0cfb527b66ee75d433.zip
fs_mgr: Allow overriding the super partition name via the kernel commandline.
For retrofit devices where the super partition is not called "super", this allows the correct partition to be passed via the kernel command-line, i.e.: androidboot.super_partition=system Since retrofitting is only supported for A/B devices, we assume that a partition named this way must be slot-suffixed. Bug: 116802789 Test: manual test Change-Id: I930dbbd397d5552e9ded89baa5a7bb0e63c67426
Diffstat (limited to 'fs_mgr/fs_mgr.cpp')
-rw-r--r--fs_mgr/fs_mgr.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index ae2e2fe4c..c321fe3eb 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -1588,6 +1588,25 @@ bool fs_mgr_update_verity_state(std::function<fs_mgr_verity_state_callback> call
return true;
}
-std::string fs_mgr_get_super_partition_name(int /* slot */) {
+std::string fs_mgr_get_super_partition_name(int slot) {
+ // Devices upgrading to dynamic partitions are allowed to specify a super
+ // partition name, assumed to be A/B (non-A/B retrofit is not supported).
+ // For devices launching with dynamic partition support, the partition
+ // name must be "super".
+ std::string super_partition;
+ if (fs_mgr_get_boot_config_from_kernel_cmdline("super_partition", &super_partition)) {
+ std::string suffix;
+ if (slot == 0) {
+ suffix = "_a";
+ } else if (slot == 1) {
+ suffix = "_b";
+ } else if (slot == -1) {
+ suffix = fs_mgr_get_slot_suffix();
+ }
+ if (suffix.empty()) {
+ LFATAL << "Super partition name can only be overridden on A/B devices.";
+ }
+ return super_partition + suffix;
+ }
return LP_METADATA_DEFAULT_PARTITION_NAME;
}