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
This commit is contained in:
David Anderson 2018-11-01 17:41:29 -07:00
parent 1d0ee36de7
commit 63ffb447a7

View file

@ -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) {