public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* flashcp problem when called via execlp
@ 2005-03-24  0:01 Aras Vaichas
  2005-03-24  0:50 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Aras Vaichas @ 2005-03-24  0:01 UTC (permalink / raw)
  To: MTD-LIST

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: flashcp problem when called via execlp
  2005-03-24  0:01 flashcp problem when called via execlp Aras Vaichas
@ 2005-03-24  0:50 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2005-03-24  0:50 UTC (permalink / raw)
  To: Aras Vaichas; +Cc: MTD-LIST

On Thu, 2005-03-24 at 11:01 +1100, Aras Vaichas wrote:
> 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 );

I doubt, that flashcp executes different when executed via execlp.

> $ flashcp uenv_Zdp5Bp /dev/mtd/2 && hexdump /dev/mtd/2

Is the file created by your utility ? If not, then your file creation is
broken.

tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-24  0:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-24  0:01 flashcp problem when called via execlp Aras Vaichas
2005-03-24  0:50 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox