Adding flag to flash only static partitions
adding in --exclude-dynamic-partitions to flash only bootloader
partitions and skip the rest. Super optimization will be turned off as
well when this flag is enabled
Test: fastboot flashall --exclude-dynamic-partitions
Change-Id: I4b9d70b7f6179bf079991bf3a20aade64cfe9935
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 61c7204..faee5e2 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1794,6 +1794,7 @@
CancelSnapshotIfNeeded();
tasks_ = CollectTasks();
+
for (auto& task : tasks_) {
task->Run();
}
@@ -1808,7 +1809,18 @@
} else {
tasks = CollectTasksFromImageList();
}
-
+ if (fp_->exclude_dynamic_partitions) {
+ auto is_non_static_flash_task = [](const auto& task) -> bool {
+ if (auto flash_task = task->AsFlashTask()) {
+ if (!should_flash_in_userspace(flash_task->GetPartitionAndSlot())) {
+ return false;
+ }
+ }
+ return true;
+ };
+ tasks.erase(std::remove_if(tasks.begin(), tasks.end(), is_non_static_flash_task),
+ tasks.end());
+ }
return tasks;
}
@@ -2213,6 +2225,7 @@
{"disable-verification", no_argument, 0, 0},
{"disable-verity", no_argument, 0, 0},
{"disable-super-optimization", no_argument, 0, 0},
+ {"exclude-dynamic-partitions", no_argument, 0, 0},
{"disable-fastboot-info", no_argument, 0, 0},
{"force", no_argument, 0, 0},
{"fs-options", required_argument, 0, 0},
@@ -2254,6 +2267,9 @@
g_disable_verity = true;
} else if (name == "disable-super-optimization") {
fp->should_optimize_flash_super = false;
+ } else if (name == "exclude-dynamic-partitions") {
+ fp->exclude_dynamic_partitions = true;
+ fp->should_optimize_flash_super = false;
} else if (name == "disable-fastboot-info") {
fp->should_use_fastboot_info = false;
} else if (name == "force") {