summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2019-04-02 16:19:06 -0700
committerYifan Hong <elsk@google.com>2019-04-04 16:34:01 -0700
commit70179fc3c4ec0d9858f04e829f4aead709a77b98 (patch)
treeb0b951108fc7ae5c844de49402a9dffc3f26f152
parenteeca114de0fa5fb96f42ccd9cc5000221ce316aa (diff)
downloadextras-70179fc3c4ec0d9858f04e829f4aead709a77b98.tar.gz
lpmake: allow to build non-sparse super image.
Bug: 120041578 Test: build without --sparse but with --image. Change-Id: Iaaa8324fa1f9e8e6785f96e787c8a4ee23d37982 Merged-In: Iaaa8324fa1f9e8e6785f96e787c8a4ee23d37982
-rw-r--r--partition_tools/lpmake.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/partition_tools/lpmake.cc b/partition_tools/lpmake.cc
index 1c11c4d2..c9333bca 100644
--- a/partition_tools/lpmake.cc
+++ b/partition_tools/lpmake.cc
@@ -253,10 +253,6 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Partition table must have at least one entry.\n");
return EX_USAGE;
}
- if (!images.empty() && !output_sparse) {
- fprintf(stderr, "Cannot write partition data for non-sparse images.\n");
- return EX_USAGE;
- }
// Note that we take the block_size to mean both the logical block size and
// the block size for libsparse.
@@ -351,13 +347,15 @@ int main(int argc, char* argv[]) {
}
std::unique_ptr<LpMetadata> metadata = builder->Export();
- if (output_sparse) {
+ if (!images.empty()) {
if (block_devices.size() == 1) {
- if (!WriteToSparseFile(output_path.c_str(), *metadata.get(), block_size, images)) {
+ if (!WriteToImageFile(output_path.c_str(), *metadata.get(), block_size, images,
+ output_sparse)) {
return EX_CANTCREAT;
}
} else {
- if (!WriteSplitSparseFiles(output_path, *metadata.get(), block_size, images)) {
+ if (!WriteSplitImageFiles(output_path, *metadata.get(), block_size, images,
+ output_sparse)) {
return EX_CANTCREAT;
}
}