
-----Original Message----- From: Wolfgang Denk [mailto:wd@denx.de] Sent: Monday, July 20, 2009 8:27 PM To: Prafulla Wadaskar Cc: u-boot@lists.denx.de; Manas Saksena; Ronen Shitrit; Nicolas Pitre; Ashish Karkare; Prabhanjan Sarnaik; Lennert Buijtenhek Subject: Re: [U-Boot] [PATCH 2/3] tools: mkimage (type=kwbimage) kirkwood boot image support
Dear Prafulla Wadaskar,
In message <73173D32E9439E4ABB5151606C3E19E202DDF272E2@SC-VEXCH1.marvell. com> you wrote:
lineno++;
if (!(line[0] != '#' && strlen(line) != 1))
continue;
This is a bit simple-minded. This will for example fail on DOS-formatted files, and for lines that contain only white space (which still look "empty" to most users and are thus hard
to spot).
To take care of Dos formatted file I should use "strlen(line) <= 1" right
Hm...
Normally the use of lex (and eventually yacc) is recommended if you need a parser - writing parsers in C is a typical "programming" task (see definition in signature below :-)
If you have an extremely simple syntax, you might for example proceed like this:
- drop all lines starting with '#' as comment lines.
- use strtok_r() to split your lines of input into white-space separated tokens.
- drop all lines with zero tokens (= empty lines)
- process the rest
Dear Wolfgang I used strtok_r() since it is extremely simple parser
[See example in the strtok()/strtok_r() man page).
As explained in doc.README.kwimage, any other line apart from above will be considered as valid
configuration l> ine.
This is bare minimal parsing provided here which is sufficient
...
Hmm... it seems you add only image creation code. But "mkimage -l" should work on such an image, too. And "imls" in U-Boot should be working, too.
Well I will disable other generic mkimage options including -l for kwbimage ;-)
This makes little sense to me. When we have one command to build an image, I definitely want to have a command to check and display the contents of an image, too, and/or to verify it's integrity.
Can we add this in second part which is not required too? For me great thing is that we can support kwimage
generation through mkimage.
I understand your position. I guess you agree that _full_ support (i.e. including the ability to check and list and image, both on the host and on the target) would be even better, and more in line with existing U-Boot code?
I agreed... I have posted separate patch to support check and list support. Thanks for wishing this to make it complete kwbimage support :-)
Regards.. Prafulla . .
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de PROGRAM - n. A magic spell cast over a computer allowing it to turn one's input into error messages. v. tr. - To engage in a pastime similar to banging one's head against a wall, but with fewer opportunities for reward.