public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Aras Vaichas <arasv@magellan-technology.com>
To: MTD-LIST <linux-mtd@lists.infradead.org>
Subject: flashcp problem when called via execlp
Date: Thu, 24 Mar 2005 11:01:24 +1100	[thread overview]
Message-ID: <42420354.5000407@magellan-technology.com> (raw)

Hello,

I'm calling "flashcp" from a utility in order to write a file to a NOR flash 
device. When I call flashcp from my utility, it doesn't work properly.

In my utility I create a temporary file, fill it with data and then I call 
flashcp via execlp like so:

execlp( "flashcp", "flashcp", filenamep, MTDFILE, (char *)0 );

where: filenamep is the temporary filename, MTDFILE is "/dev/mtd/2"

The problems are:

* I lose about 6 bytes from the beginning of the file
* all zeroes between the text are converted to linefeeds
* all zeroes at the end of the file are converted to 0xff

If I call flashcp from the command line, it copies the file over perfectly.

e.g.

1) calling flashcp from the command line you can see the zero at $0000336 and 
the zeroes at the end of the file:
$ flashcp uenv_Zdp5Bp /dev/mtd/2 && hexdump /dev/mtd/2

... SNIP ...
0000330 7361 6820 7265 0065 6e61 7464 6568 736e
0000340 6d6f 6d65 726f 3d65 7241 7361 6920 2073
0000350 7473 6c69 206c 6568 6572 202c 6164 6d6d
0000360 7469 0000 0000 0000 0000 0000 0000 0000
0000370 0000 0000 0000 0000 0000 0000 0000 0000
*
0020000

2) Calling flashcp via execlp you can see that the zero that was at $000336 has 
been turned into a linefeed (0x0a) and moved to $0000332, and that the zeroes 
at the end of the file are now 0xff.

0000330 7265 0a65 6e61 7464 6568 736e 6d6f 6d65
0000340 726f 3d65 7241 7361 6920 2073 7473 6c69
0000350 206c 6568 6572 202c 6164 6d6d 7469 0a0a
0000360 ffff ffff ffff ffff ffff ffff ffff ffff
*
0020000


bin # mtd_debug info /dev/mtd/2
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 131072 (128K)
mtd.erasesize = 131072 (128K)
mtd.oobblock = 0
mtd.oobsize = 0
mtd.ecctype = MTD_ECC_NONE
regions = 0

I'm running Linux 2.4.28-lck1, on an SC520 i386 compatible platform. We've been 
running JFFS for years and JFFS2 recently on this platform with no problems.

regards,

Aras Vaichas

             reply	other threads:[~2005-03-24  0:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-24  0:01 Aras Vaichas [this message]
2005-03-24  0:50 ` flashcp problem when called via execlp Thomas Gleixner

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=42420354.5000407@magellan-technology.com \
    --to=arasv@magellan-technology.com \
    --cc=linux-mtd@lists.infradead.org \
    /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