aboutsummaryrefslogtreecommitdiff
path: root/cmd/ab_select.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/ab_select.c')
-rw-r--r--cmd/ab_select.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd/ab_select.c b/cmd/ab_select.c
index 3e46663d6e..bfb67b8236 100644
--- a/cmd/ab_select.c
+++ b/cmd/ab_select.c
@@ -16,10 +16,19 @@ static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
struct blk_desc *dev_desc;
struct disk_partition part_info;
char slot[2];
+ bool dec_tries = true;
- if (argc != 4)
+ if (argc < 4)
return CMD_RET_USAGE;
+ for (int i = 4; i < argc; i++) {
+ if (strcmp(argv[i], "--no-dec") == 0) {
+ dec_tries = false;
+ } else {
+ return CMD_RET_USAGE;
+ }
+ }
+
/* Lookup the "misc" partition from argv[2] and argv[3] */
if (part_get_info_by_dev_and_name_or_num(argv[2], argv[3],
&dev_desc, &part_info,
@@ -27,7 +36,8 @@ static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- ret = ab_select_slot(dev_desc, &part_info);
+
+ ret = ab_select_slot(dev_desc, &part_info, dec_tries);
if (ret < 0) {
printf("Android boot failed, error %d.\n", ret);
return CMD_RET_FAILURE;
@@ -41,9 +51,9 @@ static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_SUCCESS;
}
-U_BOOT_CMD(ab_select, 4, 0, do_ab_select,
+U_BOOT_CMD(ab_select, 5, 0, do_ab_select,
"Select the slot used to boot from and register the boot attempt.",
- "<slot_var_name> <interface> <dev[:part|#part_name]>\n"
+ "<slot_var_name> <interface> <dev[:part|#part_name]> [--no-dec]\n"
" - Load the slot metadata from the partition 'part' on\n"
" device type 'interface' instance 'dev' and store the active\n"
" slot in the 'slot_var_name' variable. This also updates the\n"
@@ -53,4 +63,6 @@ U_BOOT_CMD(ab_select, 4, 0, do_ab_select,
" - If 'part_name' is passed, preceded with a # instead of :, the\n"
" partition name whose label is 'part_name' will be looked up in\n"
" the partition table. This is commonly the \"misc\" partition.\n"
+ " - If '--no-dec' is set, the number of tries remaining will not\n"
+ " decremented for the selected boot slot\n"
);