diff options
author | David Anderson <dvander@google.com> | 2019-12-13 15:34:54 -0800 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2019-12-13 16:15:54 -0800 |
commit | 7b14a8dc4b739f6aeb03c9743bcefb6ee1cec44b (patch) | |
tree | aad51beb0a2642d692fe871c26cd362aebc6ccd2 /partition_tools | |
parent | 07ee83b5df184de3adb05173e153be14923d2ee1 (diff) | |
download | extras-7b14a8dc4b739f6aeb03c9743bcefb6ee1cec44b.tar.gz |
partition_tools: Add support for the VIRTUAL_AB_DEVICE flag.
Bug: 134949511
Test: manual test
Change-Id: If31234d9da0b15a3dbde7dcc835b2161c5dbba61
Diffstat (limited to 'partition_tools')
-rw-r--r-- | partition_tools/lpdump.cc | 5 | ||||
-rw-r--r-- | partition_tools/lpmake.cc | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/partition_tools/lpdump.cc b/partition_tools/lpdump.cc index af370483..4f920fd5 100644 --- a/partition_tools/lpdump.cc +++ b/partition_tools/lpdump.cc @@ -71,6 +71,11 @@ static std::string BuildFlagString(const std::vector<std::string>& strings) { static std::string BuildHeaderFlagString(uint32_t flags) { std::vector<std::string> strings; + if (flags & LP_HEADER_FLAG_VIRTUAL_AB_DEVICE) { + strings.emplace_back("virtual_ab_device"); + flags &= ~LP_HEADER_FLAG_VIRTUAL_AB_DEVICE; + } + for (uint32_t i = 0; i < sizeof(flags) * 8; i++) { if (!(flags & (1 << i))) { continue; diff --git a/partition_tools/lpmake.cc b/partition_tools/lpmake.cc index 9a242355..1b879636 100644 --- a/partition_tools/lpmake.cc +++ b/partition_tools/lpmake.cc @@ -67,6 +67,9 @@ static int usage(int /* argc */, char* argv[]) { " would produce a minimal super_empty.img which\n" " cannot be flashed; force-full-image will produce\n" " a flashable image.\n" + " --virtual-ab Add the VIRTUAL_AB_DEVICE flag to the metadata\n" + " header. Note that the resulting super.img will\n" + " require a liblp capable of parsing a v1.2 header.\n" "\n" "Partition data format:\n" " <name>:<attributes>:<size>[:group]\n" @@ -83,6 +86,9 @@ static int usage(int /* argc */, char* argv[]) { } enum class Option : int { + // Long-only options. + kVirtualAB = 1, + // Short character codes. kDeviceSize = 'd', kMetadataSize = 'm', @@ -120,6 +126,7 @@ int main(int argc, char* argv[]) { { "super-name", required_argument, nullptr, (int)Option::kSuperName }, { "auto-slot-suffixing", no_argument, nullptr, (int)Option::kAutoSlotSuffixing }, { "force-full-image", no_argument, nullptr, (int)Option::kForceFullImage }, + { "virtual-ab", no_argument, nullptr, (int)Option::kVirtualAB }, { nullptr, 0, nullptr, 0 }, }; @@ -139,6 +146,7 @@ int main(int argc, char* argv[]) { bool has_implied_super = false; bool auto_slot_suffixing = false; bool force_full_image = false; + bool virtual_ab = false; int rv; int index; @@ -248,6 +256,9 @@ int main(int argc, char* argv[]) { case Option::kForceFullImage: force_full_image = true; break; + case Option::kVirtualAB: + virtual_ab = true; + break; default: break; } @@ -305,6 +316,9 @@ int main(int argc, char* argv[]) { if (auto_slot_suffixing) { builder->SetAutoSlotSuffixing(); } + if (virtual_ab) { + builder->SetVirtualABDeviceFlag(); + } for (const auto& group_info : groups) { std::vector<std::string> parts = android::base::Split(group_info, ":"); |