[U-Boot] [PATCH v2] tools: env: support skip leading zero of env

Wolfgang Denk wd at denx.de
Wed Nov 28 09:12:28 UTC 2018


Dear 庄秋彬,

In message <CAHaqGhZq+qLNNUbS1UnPjQDYepf=aUqkdLUeZ0g+B0kYNNg96A at mail.gmail.com> you wrote:
>
> I try to use uboot envtools in allwinner's platform, then found that the
> env in allwinner's SDK have some leading zero, that prevent envtools to
> parse it. Finally I add these code to fix it.

This is the wrong approach.

Either you misunderstand the format (for example in case of a
redundant environment where you have to take the flag byte into
consideration), or there is a bug in the implementation of the
Allwinner SDK if it creates such a an environment.

In any case, it is not legal for the U-Boot environment to have any
leading zeros.  By definition, a sequence of two NUL-Bytes will mark
the end of the environment.

You should fix the cause of the problem, and not modify the code to
work on random / incorrect data.

Naked-by: Wolfgang Denk <wd at denx.de>

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Anyone can count the seeds in an apple.
No one can count the apples in a seed.


More information about the U-Boot mailing list