summaryrefslogtreecommitdiff
path: root/partition_tools
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-05-24 12:19:22 -0700
committerDavid Anderson <dvander@google.com>2019-05-24 16:51:37 -0700
commitad8243f7f9a120568352333a83cf377881a4b7f4 (patch)
tree32cb573a116c1e88fc23519e46e4e836da6f0c4f /partition_tools
parent7c0b7ebe35eff51f9d794fbb8a53706ae40b980b (diff)
downloadextras-ad8243f7f9a120568352333a83cf377881a4b7f4.tar.gz
lpmake: Add a flag to force building a complete, empty super.img.
Normally lpmake without images is used to generate super_empty.img, but it is useful to also generate a fully sparse super_empty for flashing in the bootloader. This patch adds a --force-full-image flag to provide this. Bug: N/A Test: lpmake --force-full-image Change-Id: Ica55a7b35f6e1a0282e5a9305f1a3e4b5028755b
Diffstat (limited to 'partition_tools')
-rw-r--r--partition_tools/lpmake.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/partition_tools/lpmake.cc b/partition_tools/lpmake.cc
index c9333bca..42814772 100644
--- a/partition_tools/lpmake.cc
+++ b/partition_tools/lpmake.cc
@@ -62,6 +62,11 @@ static int usage(int /* argc */, char* argv[]) {
" house the super partition.\n"
" -x,--auto-slot-suffixing Mark the block device and partition names needing\n"
" slot suffixes before being used.\n"
+ " -F,--force-full-image Force a full image to be written even if no\n"
+ " partition images were specified. Normally, this\n"
+ " would produce a minimal super_empty.img which\n"
+ " cannot be flashed; force-full-image will produce\n"
+ " a flashable image.\n"
"\n"
"Partition data format:\n"
" <name>:<attributes>:<size>[:group]\n"
@@ -94,6 +99,7 @@ int main(int argc, char* argv[]) {
{ "device", required_argument, nullptr, 'D' },
{ "super-name", required_argument, nullptr, 'n' },
{ "auto-slot-suffixing", no_argument, nullptr, 'x' },
+ { "force-full-image", no_argument, nullptr, 'F' },
{ nullptr, 0, nullptr, 0 },
};
@@ -112,10 +118,11 @@ int main(int argc, char* argv[]) {
bool output_sparse = false;
bool has_implied_super = false;
bool auto_slot_suffixing = false;
+ bool force_full_image = false;
int rv;
int index;
- while ((rv = getopt_long_only(argc, argv, "d:m:s:p:o:h", options, &index)) != -1) {
+ while ((rv = getopt_long_only(argc, argv, "d:m:s:p:o:h:FSx", options, &index)) != -1) {
switch (rv) {
case 'h':
return usage(argc, argv);
@@ -218,6 +225,9 @@ int main(int argc, char* argv[]) {
case 'x':
auto_slot_suffixing = true;
break;
+ case 'F':
+ force_full_image = true;
+ break;
default:
break;
}
@@ -347,7 +357,7 @@ int main(int argc, char* argv[]) {
}
std::unique_ptr<LpMetadata> metadata = builder->Export();
- if (!images.empty()) {
+ if (!images.empty() || force_full_image) {
if (block_devices.size() == 1) {
if (!WriteToImageFile(output_path.c_str(), *metadata.get(), block_size, images,
output_sparse)) {