apps/fastboot: add switchboot command

The switchboot command can be sent even without enabling sh

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
yangsong8 2025-07-31 23:00:36 +08:00 committed by Xiang Xiao
parent 63c1767d33
commit 9633580d2c

View file

@ -226,6 +226,10 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *ctx,
static void fastboot_shell(FAR struct fastboot_ctx_s *ctx,
FAR const char *arg);
#endif
#ifdef CONFIG_BOARDCTL_SWITCH_BOOT
static void fastboot_switchboot(FAR struct fastboot_ctx_s *context,
FAR const char *arg);
#endif
/* USB transport */
@ -272,6 +276,9 @@ static const struct fastboot_cmd_s g_oem_cmd[] =
#ifdef CONFIG_SYSTEM_FASTBOOTD_SHELL
{ "shell", fastboot_shell },
#endif
#ifdef CONFIG_BOARDCTL_SWITCH_BOOT
{ "switchboot", fastboot_switchboot },
#endif
};
#ifdef CONFIG_BOARD_MEMORY_RANGE
@ -930,6 +937,21 @@ static void fastboot_shell(FAR struct fastboot_ctx_s *ctx,
}
#endif
#ifdef CONFIG_BOARDCTL_SWITCH_BOOT
static void fastboot_switchboot(FAR struct fastboot_ctx_s *context,
FAR const char *arg)
{
if (!arg)
{
fastboot_fail(context, "Invalid argument");
return;
}
boardctl(BOARDIOC_SWITCH_BOOT, (uintptr_t)&arg[0]);
fastboot_okay(context, "");
}
#endif
static void fastboot_upload(FAR struct fastboot_ctx_s *ctx,
FAR const char *arg)
{