diff options
author | David Anderson <dvander@google.com> | 2018-11-06 22:59:17 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-11-06 22:59:17 +0000 |
commit | a97d6e36d5e3902d52d258ec0ec76d21c481ffed (patch) | |
tree | 0ff2f29625be6841ec585552dd1753ce9df97327 /fastboot/fastboot.cpp | |
parent | 7d87981f79f90db5ba4a55b3c35affabcda6dddb (diff) | |
parent | 90fe0a43abaa0d395b8884a690c0d3661282b044 (diff) | |
download | system_core-a97d6e36d5e3902d52d258ec0ec76d21c481ffed.tar.gz system_core-a97d6e36d5e3902d52d258ec0ec76d21c481ffed.tar.bz2 system_core-a97d6e36d5e3902d52d258ec0ec76d21c481ffed.zip |
Merge "fastboot: Query the name of the super partition."
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r-- | fastboot/fastboot.cpp | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index e358bec68..625e047b6 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -1129,25 +1129,6 @@ static bool is_userspace_fastboot() { return fb->GetVar("is-userspace", &value) == fastboot::SUCCESS && value == "yes"; } -static bool if_partition_exists(const std::string& partition, const std::string& slot) { - std::string has_slot; - std::string partition_name = partition; - - if (fb->GetVar("has-slot:" + partition, &has_slot) == fastboot::SUCCESS && has_slot == "yes") { - if (slot == "") { - std::string current_slot = get_current_slot(); - if (current_slot == "") { - die("Failed to identify current slot"); - } - partition_name += "_" + current_slot; - } else { - partition_name += "_" + slot; - } - } - std::string partition_size; - return fb->GetVar("partition-size:" + partition_name, &partition_size) == fastboot::SUCCESS; -} - static void reboot_to_userspace_fastboot() { fb->RebootTo("fastboot"); @@ -1307,10 +1288,6 @@ void FlashAllTool::FlashImage(const Image& image, const std::string& slot, fastb } void FlashAllTool::UpdateSuperPartition() { - if (!if_partition_exists("super", "")) { - return; - } - int fd = source_.OpenFile("super_empty.img"); if (fd < 0) { return; @@ -1321,9 +1298,14 @@ void FlashAllTool::UpdateSuperPartition() { if (!is_userspace_fastboot()) { die("Failed to boot into userspace; one or more components might be unbootable."); } - fb->Download("super", fd, get_file_size(fd)); - std::string command = "update-super:super"; + std::string super_name; + if (fb->GetVar("super-partition-name", &super_name) != fastboot::RetCode::SUCCESS) { + super_name = "super"; + } + fb->Download(super_name, fd, get_file_size(fd)); + + std::string command = "update-super:" + super_name; if (wipe_) { command += ":wipe"; } |