author | Xindong Xu <xindong.xu@amlogic.com> | 2019-07-05 01:41:38 (GMT) |
---|---|---|
committer | Xindong Xu <xindong.xu@amlogic.com> | 2019-07-09 03:09:44 (GMT) |
commit | 2947bcefa3955c50dd3df07096a57865541c32f6 (patch) | |
tree | 5eb4a1df83ed726e99a8bdf1f8e97114b5dc1acb | |
parent | 76ab5a20f817022f68517fdb55157192eb8fdca9 (diff) | |
download | uboot-2947bcefa3955c50dd3df07096a57865541c32f6.zip uboot-2947bcefa3955c50dd3df07096a57865541c32f6.tar.gz uboot-2947bcefa3955c50dd3df07096a57865541c32f6.tar.bz2 |
franklin: set reboot bootloader to fastboot mode [1/1]
PD#SWPL-10797
Problem:
reboot bootloder enter shell mode
Solution:
set reboot bootloader to fastboot mode
Verify:
franklin
Change-Id: I3b981af1ca9578acd89a230c29347f750a371333
Signed-off-by: Xindong Xu <xindong.xu@amlogic.com>
-rw-r--r-- | common/cmd_bcb.c | 6 | ||||
-rw-r--r-- | common/cmd_reboot.c | 18 | ||||
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 20 |
3 files changed, 38 insertions, 6 deletions
diff --git a/common/cmd_bcb.c b/common/cmd_bcb.c index b34f6b6..d3754eb 100644 --- a/common/cmd_bcb.c +++ b/common/cmd_bcb.c @@ -35,6 +35,7 @@ extern int store_write_ops( #define CMD_WIPE_DATA "wipe_data" #define CMD_SYSTEM_CRASH "system_crash" #define CMD_RUN_RECOVERY "boot-recovery" +#define CMD_FASTBOOTD "fastbootd" struct bootloader_message { char command[32]; @@ -108,6 +109,11 @@ static int do_RunBcbCommand( memcpy(miscbuf, CMD_RUN_RECOVERY, sizeof(CMD_RUN_RECOVERY)); memcpy(miscbuf+sizeof(command)+sizeof(status), "recovery\n--system_crash", sizeof("recovery\n--system_crash")); store_write_ops((unsigned char *)partition, (unsigned char *)miscbuf, 0, sizeof(miscbuf)); + } else if (!memcmp(command_mark, CMD_FASTBOOTD, strlen(command_mark))) { + printf("write cmd to enter fastbootd \n"); + memcpy(miscbuf, CMD_RUN_RECOVERY, sizeof(CMD_RUN_RECOVERY)); + memcpy(miscbuf+sizeof(command)+sizeof(status), "recovery\n--fastboot", sizeof("recovery\n--fastboot")); + store_write_ops((unsigned char *)partition, (unsigned char *)miscbuf, 0, sizeof(miscbuf)); } printf("Start read %s partition datas!\n", partition); diff --git a/common/cmd_reboot.c b/common/cmd_reboot.c index df9f0ca..9d58887 100644 --- a/common/cmd_reboot.c +++ b/common/cmd_reboot.c @@ -26,6 +26,8 @@ #include <asm/io.h> #include <asm/arch/bl31_apis.h> #include <asm/arch/watchdog.h> +#include <partition_table.h> + /* run get_rebootmode //set reboot_mode env with current mode @@ -129,7 +131,10 @@ int do_get_rebootmode (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] break; } case AMLOGIC_BOOTLOADER_REBOOT: { - setenv("bootdelay","-1"); + if (dynamic_partition) + setenv("reboot_mode","fastboot"); + else + setenv("bootdelay","-1"); break; } } @@ -160,9 +165,14 @@ int do_reboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) reboot_mode_val = AMLOGIC_FACTORY_RESET_REBOOT; else if (strcmp(mode, "update") == 0) reboot_mode_val = AMLOGIC_UPDATE_REBOOT; - else if (strcmp(mode, "fastboot") == 0) - reboot_mode_val = AMLOGIC_FASTBOOT_REBOOT; - else if (strcmp(mode, "bootloader") == 0) + else if (strcmp(mode, "fastboot") == 0) { + if (dynamic_partition) { + printf("dynamic partition, enter fastbootd"); + reboot_mode_val = AMLOGIC_FACTORY_RESET_REBOOT; + run_command("bcb fastbootd",0); + } else + reboot_mode_val = AMLOGIC_FASTBOOT_REBOOT; + } else if (strcmp(mode, "bootloader") == 0) reboot_mode_val = AMLOGIC_BOOTLOADER_REBOOT; else if (strcmp(mode, "suspend_off") == 0) reboot_mode_val = AMLOGIC_SUSPEND_REBOOT; diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 26be4f2..ea388db 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -408,9 +408,16 @@ static void compl_do_reset(struct usb_ep *ep, struct usb_request *req) static void compl_do_reboot_bootloader(struct usb_ep *ep, struct usb_request *req) { - run_command("reboot fastboot", 0); + if (dynamic_partition) + run_command("reboot bootloader", 0); + else + run_command("reboot fastboot", 0); } +static void compl_do_reboot_fastboot(struct usb_ep *ep, struct usb_request *req) +{ + run_command("reboot fastboot", 0); +} static void cb_reboot(struct usb_ep *ep, struct usb_request *req) { @@ -425,7 +432,12 @@ static void cb_reboot(struct usb_ep *ep, struct usb_request *req) return; } - fastboot_func->in_req->complete = compl_do_reboot_bootloader; + printf("cmd cb_reboot is %s\n", cmd); + if (strcmp(cmd, "bootloader") == 0) + fastboot_func->in_req->complete = compl_do_reboot_bootloader; + else if (strcmp(cmd, "fastboot") == 0) + fastboot_func->in_req->complete = compl_do_reboot_fastboot; + fastboot_tx_write_str("OKAY"); } @@ -1414,6 +1426,10 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = { .cb = cb_reboot, }, { + .cmd = "reboot-fastboot", + .cb = cb_reboot, + }, + { .cmd = "set_active", .cb = cb_set_active, }, |