summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMartyn Welch <[email protected]>2024-10-09 14:15:40 +0100
committerTom Rini <[email protected]>2024-10-15 10:24:27 -0600
commit3809fd35a5dbdbd62043ba0a72c3f37f58e69f9d (patch)
treeb7a3cbf6da74d598d2e8529aaf18a30ce3ccba57 /cmd
parent8ba82a91b3aa615fb6148ecfa2af4e91a28659ae (diff)
bootstd: Add command to enable setting of bootmeth specific properties
We have previously added logic to allow a "fallback" option to be specified in the extlinux configuration. Provide a command that allows us to set this as the preferred default option when booting. Combined with the bootcount functionality, this allows the "altbootcmd" to provide a means of falling back to a previously known good state after a failed update. For example, if "bootcmd" is set to: bootflow scan -lb We would set "altbootcmd" to: bootmeth set extlinux fallback 1; bootflow scan -lb Causing the boot process to boot from the fallback option. Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Martyn Welch <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bootmeth.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/cmd/bootmeth.c b/cmd/bootmeth.c
index ebf8b7e2530..2f41fa1bec6 100644
--- a/cmd/bootmeth.c
+++ b/cmd/bootmeth.c
@@ -103,10 +103,31 @@ static int do_bootmeth_order(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
+static int do_bootmeth_set(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ int ret;
+
+ if (argc < 4) {
+ printf("Required parameters not provided\n");
+ return CMD_RET_FAILURE;
+ }
+
+ ret = bootmeth_set_property(argv[1], argv[2], argv[3]);
+ if (ret) {
+ printf("Failed (err=%d)\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ return 0;
+}
+
U_BOOT_LONGHELP(bootmeth,
"list [-a] - list available bootmeths (-a all)\n"
- "bootmeth order [<bd> ...] - select bootmeth order / subset to use");
+ "bootmeth order [<bd> ...] - select bootmeth order / subset to use\n"
+ "bootmeth set <bootmeth> <property> <value> - set optional property");
U_BOOT_CMD_WITH_SUBCMDS(bootmeth, "Boot methods", bootmeth_help_text,
U_BOOT_SUBCMD_MKENT(list, 2, 1, do_bootmeth_list),
- U_BOOT_SUBCMD_MKENT(order, CONFIG_SYS_MAXARGS, 1, do_bootmeth_order));
+ U_BOOT_SUBCMD_MKENT(order, CONFIG_SYS_MAXARGS, 1, do_bootmeth_order),
+ U_BOOT_SUBCMD_MKENT(set, CONFIG_SYS_MAXARGS, 1, do_bootmeth_set));