[U-Boot] [RFC] Make U-Boot log great again
Bin Meng
bmeng.cn at gmail.com
Fri Mar 23 05:44:25 UTC 2018
Hi,
On Sat, Feb 17, 2018 at 3:49 AM, Robert Nelson <robertcnelson at gmail.com> wrote:
> On Fri, Feb 16, 2018 at 1:01 PM, Sam Protsenko
> <semen.protsenko at linaro.org> wrote:
>> Hi guys,
>>
>> TL;DR This is a suggestion about fixing U-Boot log, which has got
>> worse recently.
>>
>> Right now U-Boot and SPL logs are cluttered with bogus warnings like
>> these (on X15 board, but I'm pretty sure it should appear on many
>> others):
>>
>> Loading Environment from FAT...
>> *** Warning - bad CRC, using default environment
>> Failed (-5)
>
Do we plan to fix this "Failed (-5)" message? It's very confusing.
Like previous U-Boot just printing "*** Warning - bad CRC, using
default environment" is enough I think.
> This one seems to cause the most confusion with end users. They like
> to think it's a real bug, when in reality, "saveenv" and friends was
> just never run from within u-boot or a separate environment partition
> wasn't pre-programmed.
>
> It's one of those bugs, users asked 10 years ago when the Beagle first
> launched, yet users still ask from time to time..
>
>>
>> Those are the consequences of next commit:
>>
>> fb69464eae1e ("env: Allow to build multiple environments in Kconfig")
>>
>> Because of this commit, I can see following changes in my .config file:
>>
>> +CONFIG_ENV_IS_IN_FAT=y
>> +CONFIG_ENV_FAT_INTERFACE="mmc"
>> +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>> +CONFIG_ENV_FAT_FILE="uboot.env"
>>
>> which led U-Boot to try and load the environment from different
>> sources. I agree that it's good thing to do and can be useful, but the
>> problem is that the code for loading the environment wasn't changed to
>> handle errors properly.
>>
>> How I suggest to handle that case:
>>
>> 1. If we have two sources for the environment (e.g. FAT partition on
>> SD card and some raw partition on eMMC), we shouldn't print error
>> messages if we were unable to load the environment from one source
>> 2. We should probably print some human-readable information that we
>> didn't find the environment there, let's skip and look for next source
>> (but don't print those warnings/failed messages)
>> 3. And only print the error message in case when U-Boot environment
>> wasn't found at all (on all possible sources).
>>
>> I don't have enough time to fix this by my own right now. But let's
>> discuss how to approach this issue in a best way possible. And if
>> someone wants to step forward and do that -- would be really nice. If
>> no -- I can look into that later. But let's collect some opinions
>> here, first.
>
> I've also found, when you are dealing with multiple sources, it's nice
> to print "where" you came from.
>
> Otherwise, I've been known to make things way to verbose, but it's
> easier to debug years later, when your adding a new family, or
> overhauling when/how "overlays" are handled...
>
Regards,
Bin
More information about the U-Boot
mailing list