summaryrefslogtreecommitdiff
path: root/partition_tools
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2019-04-02 16:19:06 -0700
committerYifan Hong <elsk@google.com>2019-04-03 11:01:22 -0700
commit456e9a7c67c6feb06f6ebbcff347a61ad82bd7b2 (patch)
tree0ebb82a10047b1aa4a4c5b056bb0dd7a97d07bdc /partition_tools
parent7ed6aabda897ac6cc0baa7ae28db8a680acc91e0 (diff)
downloadextras-456e9a7c67c6feb06f6ebbcff347a61ad82bd7b2.tar.gz
lpmake: allow to build non-sparse super image.
Bug: 120041578 Test: build without --sparse but with --image. Change-Id: Iaaa8324fa1f9e8e6785f96e787c8a4ee23d37982
Diffstat (limited to 'partition_tools')
-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;
}
}