summaryrefslogtreecommitdiffstats
path: root/fastboot
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2018-11-01 17:41:29 -0700
committerDavid Anderson <dvander@google.com>2018-11-01 17:43:45 -0700
commit63ffb447a7648d9a97a088d75d8fa65d01527283 (patch)
tree485bd44ea4f1f18775e87e8c4088b88bccb7c36b /fastboot
parent1d0ee36de7af27ee43e5075b99e9427130a1f0f1 (diff)
downloadsystem_core-63ffb447a7648d9a97a088d75d8fa65d01527283.tar.gz
system_core-63ffb447a7648d9a97a088d75d8fa65d01527283.tar.bz2
system_core-63ffb447a7648d9a97a088d75d8fa65d01527283.zip
fastbootd: Partition commands should update all metadata slots.
Without this, it is much more difficult to ensure that the "a" and "b" slots are both bootable during development. We already update all metadata slots for update-super, so we should here as well. Bug: N/A Test: fastboot flashall fastboot set_active other fastboot flashall Change-Id: Ib661e35fa89171a68a0b1da195dc5ba0375d72e4
Diffstat (limited to 'fastboot')
-rw-r--r--fastboot/device/commands.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp
index 6e45133f4..11c838aae 100644
--- a/fastboot/device/commands.cpp
+++ b/fastboot/device/commands.cpp
@@ -329,7 +329,6 @@ class PartitionBuilder {
private:
std::string super_device_;
- uint32_t slot_number_;
std::unique_ptr<MetadataBuilder> builder_;
};
@@ -341,8 +340,8 @@ PartitionBuilder::PartitionBuilder(FastbootDevice* device) {
super_device_ = *super_device;
std::string slot = device->GetCurrentSlot();
- slot_number_ = SlotNumberForSlotSuffix(slot);
- builder_ = MetadataBuilder::New(super_device_, slot_number_);
+ uint32_t slot_number = SlotNumberForSlotSuffix(slot);
+ builder_ = MetadataBuilder::New(super_device_, slot_number);
}
bool PartitionBuilder::Write() {
@@ -350,7 +349,11 @@ bool PartitionBuilder::Write() {
if (!metadata) {
return false;
}
- return UpdatePartitionTable(super_device_, *metadata.get(), slot_number_);
+ bool ok = true;
+ for (uint32_t i = 0; i < metadata->geometry.metadata_slot_count; i++) {
+ ok &= UpdatePartitionTable(super_device_, *metadata.get(), i);
+ }
+ return ok;
}
bool CreatePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args) {