[U-Boot] [PATCH V3 1/3] imx-common/cmd_resetmode.c: add imx resetmode command

Eric Nelson
2012-08-10T01:09:56Z

On 08/09/2012 02:15 PM, Troy Kisky wrote:
> On 8/9/2012 12:29 PM, Eric Nelson wrote:
>> On 08/09/2012 11:48 AM, Troy Kisky wrote:
>>> On 8/9/2012 12:21 AM, Stefano Babic wrote:
>>>> On 09/08/2012 03:26, Troy Kisky wrote:
>>>>>
>> >>> <snip>
>> >>>
>>>>> +int do_bootmmc0(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>>>> +{
>>>>> + return do_resetmode_cmd("mmc0");
>>>>> +}
>>>>> +
>>>>> +int do_bootmmc1(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>>>> +{
>>>>> + return do_resetmode_cmd("mmc1");
>>>>> +}
>> >>
>>>> Why do you not pass the mode to do_resetmode_cmd() and let this function
>>>> parse the argument, without these help functions ? Then we do not need
>>>> to add new functions if we have, for example, mmc2 or mmc3.
>>>
>>> These functions are requested shortcuts.
>>> "bootmmc0" is the same as "resetmode mmc0 && reset"
>>>
>> Hi Troy,
>>
>> As one of the few that made this request:
>>
>> I take it back...
>>
>> I was mostly after a single command that also performs 'reset',
>> and agree with Stefano that an argument for the mode is a better
>> implementation.
>>
>> U-Boot> bootto usb
>> U-Boot> bootto mmc
>>
>> I'm also rethinking the request for 'resetmode' because
>> of the conflict with 'reset' (i.e. 'res' is no longer a
>> unique command-complete). The first implementation with
>> 'rsmode' seemed to be an odd abbreviation.
>>
>> Anybody else have a suggestion?
>>
>> U-Boot> rstmode usb && reset
>> U-Boot> bmode usb && reset
>>
>> Regards,
>>
>>
>> Eric
>>
>
> How difficult would it be for someone to implement a general "alias" command ?
> ie. 'alias bootto "resetmode $1 && reset"'
>

It's usually a customer that asks the "How hard would it be?" question,
but you can almost get there like this:

U-Boot> set mynewcommand "echo Hello"
U-Boot> $mynewcommand
Hello
U-Boot> $mynewcommand World
Hello World

That trailing "&&" is a problem though.