summaryrefslogtreecommitdiff
authorXindong Xu <xindong.xu@amlogic.com>2019-12-13 00:57:39 (GMT)
committer Xindong Xu <xindong.xu@amlogic.com>2019-12-18 08:35:51 (GMT)
commit1f214ec1b1092df5abd721dbe47cfe008cbced85 (patch)
tree1f6f06e2f81d9dedbb35d1555e8da8902f052f65
parent2fda066b6023f1d4c9307ea0055eda566b0fd66a (diff)
downloaduboot-1f214ec1b1092df5abd721dbe47cfe008cbced85.zip
uboot-1f214ec1b1092df5abd721dbe47cfe008cbced85.tar.gz
uboot-1f214ec1b1092df5abd721dbe47cfe008cbced85.tar.bz2
fastboot: fix fastboot -w error in ab mode [1/1]
PD#OTT-7669 Problem: fastboot -w error in ab mode Solution: get slot suffix before format metadata Verify: franklin, ampere, dalton, can cover all boards. Change-Id: I1411b1742dfb05ac213696c4b853f84d3d946c77 Signed-off-by: Xindong Xu <xindong.xu@amlogic.com>
Diffstat
-rw-r--r--drivers/usb/gadget/f_fastboot.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 69d707c..2378073 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -1233,6 +1233,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
{
char *cmd = req->buf;
char* response = response_str;
+ char *slot_name;
printf("cmd cb_flash is %s\n", cmd);
@@ -1259,6 +1260,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
}
#endif
+ if ((has_boot_slot == 1) && (strcmp(cmd, "metadata") == 0)) {
+ slot_name = getenv("slot-suffixes");
+ if (strcmp(slot_name, "0") == 0) {
+ printf("set partiton metadata_a\n");
+ strcpy(cmd, "metadata_a");
+ } else if (strcmp(slot_name, "1") == 0) {
+ printf("set partiton metadata_b\n");
+ strcpy(cmd, "metadata_b");
+ }
+ }
+
printf("partition is %s\n", cmd);
if (strcmp(cmd, "userdata") == 0) {
strcpy(cmd, "data");
@@ -1359,6 +1371,7 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req)
{
char* response = response_str;
char *cmd = req->buf;
+ char *slot_name;
printf("cmd cb_erase is %s\n", cmd);
@@ -1376,6 +1389,17 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req)
}
printf("partition is %s\n", cmd);
+ if ((has_boot_slot == 1) && (strcmp(cmd, "metadata") == 0)) {
+ slot_name = getenv("slot-suffixes");
+ if (strcmp(slot_name, "0") == 0) {
+ printf("set partiton metadata_a\n");
+ strcpy(cmd, "metadata_a");
+ } else if (strcmp(slot_name, "1") == 0) {
+ printf("set partiton metadata_b\n");
+ strcpy(cmd, "metadata_b");
+ }
+ }
+
if (strcmp(cmd, "userdata") == 0) {
strcpy(cmd, "data");
printf("partition is %s\n", cmd);