summaryrefslogtreecommitdiff
path: root/partition_tools
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2018-11-07 18:27:14 -0800
committerDavid Anderson <dvander@google.com>2018-11-08 09:55:42 -0800
commit1c5907a24d043948803a1afa3e109d57bcffc86d (patch)
tree0a8abbdb8265f3a4657bcd4661fe3d320dc89768 /partition_tools
parent61faad8bb1c0838fcec95a138d55a04c9ba2439a (diff)
downloadextras-1c5907a24d043948803a1afa3e109d57bcffc86d.tar.gz
partition_tools: Update for auto-slot-suffixing.
lpmake: Add --auto-slot-suffixing for retrofit builds. lpdump: Show the slot-suffixed flag when dumping super_empty. Bug: 116802789 Test: manual test Change-Id: I65e1d4d6922d117b9dcdbfbf9ced045c97549e59
Diffstat (limited to 'partition_tools')
-rw-r--r--partition_tools/lpdump.cc7
-rw-r--r--partition_tools/lpmake.cc11
2 files changed, 17 insertions, 1 deletions
diff --git a/partition_tools/lpdump.cc b/partition_tools/lpdump.cc
index 24bee69f..689ffb13 100644
--- a/partition_tools/lpdump.cc
+++ b/partition_tools/lpdump.cc
@@ -23,7 +23,9 @@
#include <unistd.h>
#include <string>
+#include <vector>
+#include <android-base/strings.h>
#include <android-base/parseint.h>
#include <liblp/liblp.h>
@@ -44,7 +46,10 @@ static int usage(int /* argc */, char* argv[]) {
}
static std::string BuildAttributeString(uint32_t attrs) {
- return (attrs & LP_PARTITION_ATTR_READONLY) ? "readonly" : "none";
+ std::vector<std::string> strings;
+ if (attrs & LP_PARTITION_ATTR_READONLY) strings.emplace_back("readonly");
+ if (attrs & LP_PARTITION_ATTR_SLOT_SUFFIXED) strings.emplace_back("slot-suffixed");
+ return strings.empty() ? "none" : android::base::Join(strings, ",");
}
static bool IsBlockDevice(const char* file) {
diff --git a/partition_tools/lpmake.cc b/partition_tools/lpmake.cc
index c0c06df9..7a2ba518 100644
--- a/partition_tools/lpmake.cc
+++ b/partition_tools/lpmake.cc
@@ -60,6 +60,8 @@ static int usage(int /* argc */, char* argv[]) {
" for DATA is listed below.\n"
" -n,--super-name=NAME Specify the name of the block device that will\n"
" house the super partition.\n"
+ " -x,--auto-slot-suffixing Mark the block device and partition names needing\n"
+ " slot suffixes before being used.\n"
"\n"
"Partition data format:\n"
" <name>:<attributes>:<size>[:group]\n"
@@ -91,6 +93,7 @@ int main(int argc, char* argv[]) {
{ "group", required_argument, nullptr, 'g' },
{ "device", required_argument, nullptr, 'D' },
{ "super-name", required_argument, nullptr, 'n' },
+ { "auto-slot-suffixing", no_argument, nullptr, 'x' },
{ nullptr, 0, nullptr, 0 },
};
@@ -108,6 +111,7 @@ int main(int argc, char* argv[]) {
std::map<std::string, std::string> images;
bool output_sparse = false;
bool has_implied_super = false;
+ bool auto_slot_suffixing = false;
int rv;
int index;
@@ -211,6 +215,9 @@ int main(int argc, char* argv[]) {
block_devices.emplace_back(info);
break;
}
+ case 'x':
+ auto_slot_suffixing = true;
+ break;
default:
break;
}
@@ -269,6 +276,10 @@ int main(int argc, char* argv[]) {
return EX_USAGE;
}
+ if (auto_slot_suffixing) {
+ builder->SetAutoSlotSuffixing();
+ }
+
for (const auto& group_info : groups) {
std::vector<std::string> parts = android::base::Split(group_info, ":");
if (parts.size() != 2) {