From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Herring Date: Mon, 26 Jan 2015 15:49:01 -0600 Subject: [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command In-Reply-To: <1422308941-23543-1-git-send-email-robh@kernel.org> References: <1422308941-23543-1-git-send-email-robh@kernel.org> Message-ID: <1422308941-23543-3-git-send-email-robh@kernel.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- drivers/usb/gadget/f_fastboot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index e2fda86..f7d84bf 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -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"); } -- 2.1.0