public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Steve Rae <srae@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
Date: Wed, 11 Feb 2015 11:44:55 -0800	[thread overview]
Message-ID: <54DBB137.6050406@broadcom.com> (raw)
In-Reply-To: <1422308941-23543-3-git-send-email-robh@kernel.org>



On 15-01-26 01:49 PM, Rob Herring wrote:
> 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>
> ---
>   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");
>   	}
>

Please clarify the "partitions" env variable.
For example, if I have (snippet from the 'mmc part' command):
   3     0x00011000      0x000117ff      "u-boot"
         attrs:  0x0000000000000000
         type:   ebcf4a1c-b9e7-8f06-9885-3bd8b4a46cff
         guid:   d5b495eb-57aa-fc70-23bb-d1897fa4e840
   7     0x0001c000      0x00023fff      "kernel"
         attrs:  0x0000000000000000
         type:   3c3ea4a6-5eaa-7f7c-1cb7-9374b8191c5d
         guid:   43b9c433-a106-68bf-aff4-890416fc87d7
what would the corresponding "partitions" env variable look like?

Thanks, Steve
PS.
from doc/README.gpt:

148 Creating GPT partitions in U-Boot:
149 ==============
150
151 To restore GUID partition table one needs to:
152 1. Define partition layout in the environment.
153    Format of partitions layout:
154      "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
155         name=kernel,size=60MiB,uuid=...;"
156      or
157      "partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
158         size=${uboot_size},uuid=${uboot_uuid};"
159
160    Fields 'name', 'size' and 'uuid' are mandatory for every partition.
161    The field 'start' is optional.
162
163    option: CONFIG_RANDOM_UUID
164    If any partition "UUID" no exists then it is randomly generated.
165
166 2. Define 'CONFIG_EFI_PARTITION' and 'CONFIG_CMD_GPT'
167
168 2. From u-boot prompt type:
169    gpt write mmc 0 $partitions

How can dump the current "uuid_disk=" (not in the 'mmc part' command?)
Is the "uuid=" parameter the 'type:' or the 'guid:' in the 'mmc part' 
command?

  parent reply	other threads:[~2015-02-11 19:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 21:48 [U-Boot] [PATCH 0/2] Fastboot OEM commands Rob Herring
2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
2015-01-29  8:30   ` Lukasz Majewski
2015-01-29 16:49     ` Marek Vasut
2015-01-30 14:20     ` Rob Herring
2015-01-30 14:29       ` Lukasz Majewski
2015-01-29 23:27   ` Steve Rae
2015-01-30 15:02   ` Lukasz Majewski
2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
2015-01-29  8:31   ` Lukasz Majewski
2015-01-29 23:27   ` Steve Rae
2015-01-30 15:03   ` Lukasz Majewski
2015-02-11 19:44   ` Steve Rae [this message]
2015-02-12  1:46     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54DBB137.6050406@broadcom.com \
    --to=srae@broadcom.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox