From 70179fc3c4ec0d9858f04e829f4aead709a77b98 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 2 Apr 2019 16:19:06 -0700 Subject: lpmake: allow to build non-sparse super image. Bug: 120041578 Test: build without --sparse but with --image. Change-Id: Iaaa8324fa1f9e8e6785f96e787c8a4ee23d37982 Merged-In: Iaaa8324fa1f9e8e6785f96e787c8a4ee23d37982 --- partition_tools/lpmake.cc | 12 +++++------- 1 file 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 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; } } -- cgit v1.2.3