
Dear 庄秋彬,
In message CAHaqGhZq+qLNNUbS1UnPjQDYepf=aUqkdLUeZ0g+B0kYNNg96A@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@denx.de
Best regards,
Wolfgang Denk