From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Wed, 28 Nov 2018 10:12:28 +0100 Subject: [U-Boot] [PATCH v2] tools: env: support skip leading zero of env In-Reply-To: References: <1543283392-31275-1-git-send-email-zhuangqiubin@gmail.com> <20181127150051.3FD892400DF@gemini.denx.de> Message-ID: <20181128091228.A34BF2400DF@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Dear 庄秋彬, In message 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 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.