[U-Boot] [RFC 2/2] env: Add prefix to error messages when loading env

Sam Protsenko
2018-07-19T13:12:20Z

On Thu, Jul 19, 2018 at 3:52 PM, Tom Rini <trini@konsulko.com> wrote:
> On Wed, Jul 18, 2018 at 04:09:33PM +0200, Wolfgang Denk wrote:
>> Dear Tom,
>>
>> In message <20180718125351.GE4609@bill-the-cat> you wrote:
>> >
>> > > Loading Environment from FAT...
>> > > --> MMC: no card present
>> > > --> ** Bad device mmc 0 **
>> > > --> Failed (-5)
>> > > Loading Environment from MMC...
>> > > --> OK
>> > >
>> > > instead of:
>> > >
>> > > Loading Environment from FAT... MMC: no card present
>> > > ** Bad device mmc 0 **
>> > > Failed (-5)
>> > > Loading Environment from MMC... OK
>> >
>> > So, I think maybe (and given Wolfgang's comments) we should think about
>> > how the output might want to look, and how to get there without GD
>> > changes. Perhaps:
>> > Attempting to load Environment from FAT (do we have more easily
>> > available info at this point?):
>> > MMC: no card present
>> > ** Bad device mmc 0 **
>> > Failed (-5)
>> > Loading Environment from MMC...
>> > Attempting to load Environment from MMC:
>> > Succeeded
>>
>> Just my 0.02â‚¬:
>>
>> In the non-error case, the output should be a single (ideally short)
>> line.
>>
>> Rationale: to many lines of ourput clutter your screen and make you
>> miss context faster; to many/long lines take time to print so they
>> make booting slower.
>>
>> In the error case, the user should be able to understand what the
>> problem was and decide if it was critical or can be ignored (like
>> here when intentionally booting without SDCard).
>
> I understand, but I don't know if we can get there still. The problem
> is we don't know if we've succeeded until we've done the relevant
> probing and that in turn is what's breaking the single line, and got us
> to where we are now.
>

Actually we can, please see my new RFC patch [1]. It's a bit hacky,
but the only other way to do so is to rework drivers (MMC, etc).

Also, I figured how to do prefixing (to display MMC errors as nested
w.r.t. "Loading environment), without adding new field to gd. We can
just add some new GD_LG_ and print prefix when it's installed. I'm
gonna send new RFC soon. Please let me know what you think about [1].

[1] https://lists.denx.de/pipermail/u-boot/2018-July/335223.html

> --
> Tom