[U-Boot] [PATCH v1 1/1] fastboot: Update getvar command to get 'userdata' partition size

Rob Herring rob.herring at linaro.org
Thu Mar 17 13:12:20 CET 2016


On Wed, Mar 16, 2016 at 7:51 AM, Boris Brezillon
<boris.brezillon at free-electrons.com> wrote:
> Hi Rob,
>
> On Fri, 20 Feb 2015 08:54:56 -0600
> Rob Herring <rob.herring at linaro.org> wrote:
>
>> On Wed, Feb 18, 2015 at 1:52 PM, Dileep Katta <dileep.katta at linaro.org> wrote:
>> > This patch adds functionality to getvar command to get the userdata partition
>> > size.
>>
>> This is non-standard and doesn't scale to other partitions. There is
>> already a standard var "partition-size:<part name>". There is also
>> "partition-type:<part name>" which probably needs to be supported as
>> well. It would probably be good to have generic code to retrieve
>> fastboot variables from a u-boot environment variables. Something like
>> this:
>>
>>     fastboot: allow retrieving fastboot variables from env
>>
>>     Signed-off-by: Rob Herring <robh at kernel.org>
>>
>> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
>> index 310175a..31e1063 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -364,8 +364,15 @@ static void cb_getvar(struct usb_ep *ep, struct
>> usb_request *req)
>>                 else
>>                         strcpy(response, "FAILValue not set");
>>         } else {
>> -               error("unknown variable: %s\n", cmd);
>> -               strcpy(response, "FAILVariable not implemented");
>> +               char envstr[32];
>> +               snprintf(envstr, sizeof(envstr) - 1, "fastboot.%s", cmd);
>> +               s = getenv(envstr);
>> +               if (s) {
>> +                       strncat(response, s, chars_left);
>> +               } else {
>> +                       error("unknown variable: %s\n", cmd);
>> +                       strcpy(response, "FAILVariable not implemented");
>> +               }
>>         }
>>         fastboot_tx_write_str(response);
>>  }
>>
>
> I need this feature to expose some uboot variable through 'fastboot
> getvar', would you mind if I resend this patch for you?

No, go ahead.

Rob


More information about the U-Boot mailing list