UPSTREAM: Add -c option for partitioning commands
Adding 'continue' option to:
gp create
enh_area set
write_reliability set
Partitioning commands are connected, register PARTITION_SETTING_COMPLETED
should not be written until all settings have been done.
The continue option enables writing more than one partitioning setting before
sealing settings.
BUG=None
TEST=Compile
Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Signed-off-by: Chris Ball <chris@printf.net>
(cherry picked from commit 752072dafe9cb8957efb5b0ca707043e19f7ce13)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I435f0a3eb2469c5862b8f101c971d45fa29209aa
Reviewed-on: https://chromium-review.googlesource.com/1114443
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/mmc_cmds.c b/mmc_cmds.c
index 4cd4001..ecf38d4 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -830,11 +830,15 @@
{
int ret;
- if (dry_run) {
+ if (dry_run == 1) {
fprintf(stderr, "NOT setting PARTITION_SETTING_COMPLETED\n");
fprintf(stderr, "These changes will not take effect neither "
"now nor after a power cycle\n");
return 1;
+ } else if (dry_run == 2) {
+ printf("-c given, expecting more partition settings before "
+ "writing PARTITION_SETTING_COMPLETED\n");
+ return 0;
}
fprintf(stderr, "setting OTP PARTITION_SETTING_COMPLETED!\n");
@@ -975,11 +979,14 @@
unsigned int length_kib, gp_size_mult;
unsigned long align;
- CHECK(nargs != 7, "Usage: mmc gp create <-y|-n> <length KiB> "
+ CHECK(nargs != 7, "Usage: mmc gp create <-y|-n|-c> <length KiB> "
"<partition> <enh_attr> <ext_attr> </path/to/mmcblkX>\n", exit(1));
- if (!strcmp("-y", argv[1]))
+ if (!strcmp("-y", argv[1])) {
dry_run = 0;
+ } else if (!strcmp("-c", argv[1])) {
+ dry_run = 2;
+ }
length_kib = strtol(argv[2], NULL, 10);
partition = strtol(argv[3], NULL, 10);
@@ -1098,11 +1105,14 @@
unsigned int start_kib, length_kib, enh_start_addr, enh_size_mult;
unsigned long align;
- CHECK(nargs != 5, "Usage: mmc enh_area set <-y|-n> <start KiB> <length KiB> "
+ CHECK(nargs != 5, "Usage: mmc enh_area set <-y|-n|-c> <start KiB> <length KiB> "
"</path/to/mmcblkX>\n", exit(1));
- if (!strcmp("-y", argv[1]))
+ if (!strcmp("-y", argv[1])) {
dry_run = 0;
+ } else if (!strcmp("-c", argv[1])) {
+ dry_run = 2;
+ }
start_kib = strtol(argv[2], NULL, 10);
length_kib = strtol(argv[3], NULL, 10);