diff options
author | LuK1337 <priv.luk@gmail.com> | 2020-04-06 14:38:58 +0200 |
---|---|---|
committer | Nolen Johnson <johnsonnolen@gmail.com> | 2021-03-01 18:41:42 -0500 |
commit | 95cc2d231c2b31b51f9ea3999a3137f2d918b586 (patch) | |
tree | 3d6bfee4f921d989c308be75aa960d02c23ed709 | |
parent | f29ed7dd8fbd6561e97276f250e00f62d1333995 (diff) |
fastboot: Bring back legacy A/B support
Some devices, such as the Essential PH-1, don't have an
updated bootloader and the bootloader is appending an extra
underscore.
This patch works around that issue by sanitizing the slot to be
inline with modern expectations.
Offending commit: https://github.com/aosp-mirror/platform_system_core/commit/42b18a518bac85c3eea14206f6cbafbd1e98a31f
Most of the commit above is not needed because an underscore + slot
is automatically appended when flashing to a partition. Normally, this
would result in something like boot__b instead of boot_b, where b is the
current slot.
Test: flash an image on mata without specifying slot, boots
Change-Id: Ia0b7cee603a4f9ba2e3a61ce6e369ca8c07a7caf
-rw-r--r-- | fastboot/fastboot.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index 5307a0081..89f7adf65 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -1086,6 +1086,7 @@ static void flash_buf(const std::string& partition, struct fastboot_buffer *buf) static std::string get_current_slot() { std::string current_slot; if (fb->GetVar("current-slot", ¤t_slot) != fastboot::SUCCESS) return ""; + if (current_slot[0] == '_') current_slot.erase(0, 1); return current_slot; } @@ -1929,6 +1930,7 @@ int FastBootTool::Main(int argc, char* argv[]) { if (slot_override == "") { std::string current_slot; if (fb->GetVar("current-slot", ¤t_slot) == fastboot::SUCCESS) { + if (current_slot[0] == '_') current_slot.erase(0, 1); next_active = verify_slot(current_slot, false); } else { wants_set_active = false; |