summaryrefslogtreecommitdiff
path: root/partition_tools
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2018-11-07 20:24:17 -0800
committerDavid Anderson <dvander@google.com>2018-11-08 11:55:13 -0800
commit47058fb731167a8c5aaf983df82675ace2b3482c (patch)
treefd50dd8ba8db16c7246f5174fb6b7ea9b24a0c8b /partition_tools
parent1c5907a24d043948803a1afa3e109d57bcffc86d (diff)
downloadextras-47058fb731167a8c5aaf983df82675ace2b3482c.tar.gz
lpmake: Allow writing split super images.
To use this mode, the build must be a retrofit build and --output should be a folder rather than a file. This also fixes a bug in lpdump where it refuses to dump full super.img images on the host. Bug: 118887112 Test: manual test Change-Id: I3318684fbea6fe67bfa171001beea3a5c560fbab
Diffstat (limited to 'partition_tools')
-rw-r--r--partition_tools/lpdump.cc6
-rw-r--r--partition_tools/lpmake.cc10
2 files changed, 10 insertions, 6 deletions
diff --git a/partition_tools/lpdump.cc b/partition_tools/lpdump.cc
index 689ffb13..e3689d23 100644
--- a/partition_tools/lpdump.cc
+++ b/partition_tools/lpdump.cc
@@ -84,10 +84,8 @@ int main(int argc, char* argv[]) {
}
const char* file = argv[optind++];
- std::unique_ptr<LpMetadata> pt;
- if (IsBlockDevice(file)) {
- pt = ReadMetadata(file, slot);
- } else {
+ auto pt = ReadMetadata(file, slot);
+ if (!pt && !IsBlockDevice(file)) {
pt = ReadFromImageFile(file);
}
if (!pt) {
diff --git a/partition_tools/lpmake.cc b/partition_tools/lpmake.cc
index 7a2ba518..1c11c4d2 100644
--- a/partition_tools/lpmake.cc
+++ b/partition_tools/lpmake.cc
@@ -352,8 +352,14 @@ int main(int argc, char* argv[]) {
std::unique_ptr<LpMetadata> metadata = builder->Export();
if (output_sparse) {
- if (!WriteToSparseFile(output_path.c_str(), *metadata.get(), block_size, images)) {
- return EX_CANTCREAT;
+ if (block_devices.size() == 1) {
+ if (!WriteToSparseFile(output_path.c_str(), *metadata.get(), block_size, images)) {
+ return EX_CANTCREAT;
+ }
+ } else {
+ if (!WriteSplitSparseFiles(output_path, *metadata.get(), block_size, images)) {
+ return EX_CANTCREAT;
+ }
}
} else if (!WriteToImageFile(output_path.c_str(), *metadata.get())) {
return EX_CANTCREAT;