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

Marek Vasut marex at denx.de
Thu Oct 7 14:46:37 CEST 2021

On 10/7/21 2:40 PM, 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?

Not that I know of.

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

What you would want to have is per-device runtime properties, kind-of 
like reduced sysfs, which would need VFS in U-Boot, and we do not have 
that yet.

More information about the U-Boot mailing list