public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] tools: mkimage (type=kwbimage) kirkwood boot image support
Date: Mon, 20 Jul 2009 16:57:09 +0200	[thread overview]
Message-ID: <20090720145709.4E49D832E416@gemini.denx.de> (raw)
In-Reply-To: <73173D32E9439E4ABB5151606C3E19E202DDF272E2@SC-VEXCH1.marvell.com>

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:

1) drop all lines starting with '#' as comment lines.
2) use strtok_r() to split your lines of input into white-space
   separated tokens.
3) drop all lines with zero tokens (= empty lines)
4) process the rest

[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?

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 at 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.

  parent reply	other threads:[~2009-07-20 14:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19  1:45 [U-Boot] [PATCH 1/3] tools: mkimage: hdr_size used to facilitate customized support Prafulla Wadaskar
2009-07-18 21:33 ` Wolfgang Denk
2009-07-19  5:41   ` Prafulla Wadaskar
2009-07-19  1:45 ` [U-Boot] [PATCH 2/3] tools: mkimage (type=kwbimage) kirkwood boot image support Prafulla Wadaskar
2009-07-18 21:25   ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-20  6:55     ` Prafulla Wadaskar
2009-07-18 22:02   ` Wolfgang Denk
2009-07-19  5:27     ` Prafulla Wadaskar
2009-07-20  6:24       ` Prafulla Wadaskar
2009-07-20 15:05         ` Wolfgang Denk
2009-07-20 14:57       ` Wolfgang Denk [this message]
2009-07-22  7:20         ` Prafulla Wadaskar
2009-07-19  1:45   ` [U-Boot] [PATCH 3/3] Kirkwood: Sheevaplug: kwimage configuration Prafulla Wadaskar
2009-07-18 21:26     ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-19  4:41       ` Prafulla Wadaskar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090720145709.4E49D832E416@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox