[PATCH] mtd: sf: Set SF parameters as env variables

Sean Anderson sean.anderson at seco.com
Thu Dec 2 17:41:24 CET 2021




On 10/7/21 8:40 AM, Pratyush Yadav wrote:
> On 23/09/21 10:00PM, Marek Vasut wrote:
>> On 9/23/21 8:53 PM, Pratyush Yadav wrote:
>> > On 14/09/21 05:28AM, Marek Vasut wrote:
>> > > Set the SF page size, erase block size and total size as an environment
>> > > variable after "sf probe". This lets us discern boards with multiple
>> > > distinct SPI flash options and also e.g. set mtdparts accordingly.
>> >
>> > I don't quite follow the rationale for making these environment
>> > variables. Wouldn't you be better off finding this info out via mtd or
>> > sf command?
>>
>> I need to use that info in a script, that's why these env vars.
>
> Ok. Honestly, it doesn't feel quite right to me.
>
> I haven't played with U-Boot's shell too much but is there no way to
> assign variables from command outputs? For example, can we do something
> like `foo=$(cat a.txt)`? If that is possible, maybe add some new
> subcommands to "sf" that return this information?
>

There is not.

IMO the current solution (exporting to environment variables in an ad-hoc
manner) is rather ugly, but fixing it is difficult :)

--Sean


More information about the U-Boot mailing list