[U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command

Rob Herring robh at kernel.org
Thu Feb 12 02:46:18 CET 2015


On Wed, Feb 11, 2015 at 1:44 PM, Steve Rae <srae at broadcom.com> wrote:
>
>
> 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 at 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?

Here is what I have:

"partitions=" \
"name=DTIM,start=0x00200000,size=0x200000;" \
"name=recovery,start=0x00400000,size=0xb00000;" \
"name=bootloader,start=0x00F00000,size=0x100000;" \
"name=boot,start=0x01000000,size=0x1000000;" \
"name=dtb,start=0x02000000,size=0x1000000;" \
"name=system,start=0x03000000,size=0x30000000;" \
"name=vendor,start=0x33000000,size=0x10000000;" \
"name=cache,start=0x43000000,size=0x20000000;" \
"name=userdata,start=0x63000000,size=0x15d000000\0"

The main difference from mmc partition dump is start and size in bytes
rather than start and end in blocks.

> 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?

There may not be a way to get the disk uuid currently other than
dumping the raw partition table hex. The uuid is the guid. The type
used is something corresponds "Windows data" which seems strange.
Probably that should be configurable, but it doesn't seem to really
matter.

Rob


More information about the U-Boot mailing list