]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fastboot: add support for "oem format" command
authorRob Herring <robh@kernel.org>
Mon, 26 Jan 2015 21:49:01 +0000 (15:49 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 12:05:51 +0000 (14:05 +0200)
Add "oem format" command to write partition table. This relies on the
env variable partitions to contain the list of partitions as required by
the gpt command.

Note that this does not erase any data other than the partition table.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Steve Rae <srae@broadcom.com>
drivers/usb/gadget/f_fastboot.c

index e2fda8613b6bc27dbd834c0fe48f6d6d400225f7..f7d84bff3fa0a565e0fa742eda951d5ce1b3eef5 100644 (file)
@@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 static void cb_oem(struct usb_ep *ep, struct usb_request *req)
 {
        char *cmd = req->buf;
+#ifdef CONFIG_FASTBOOT_FLASH
+       if (strncmp("format", cmd + 4, 6) == 0) {
+               char cmdbuf[32];
+                sprintf(cmdbuf, "gpt write mmc %x $partitions",
+                       CONFIG_FASTBOOT_FLASH_MMC_DEV);
+                if (run_command(cmdbuf, 0))
+                       fastboot_tx_write_str("FAIL");
+                else
+                       fastboot_tx_write_str("OKAY");
+       } else
+#endif
        if (strncmp("unlock", cmd + 4, 8) == 0) {
                fastboot_tx_write_str("FAILnot implemented");
        }