mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* tftp to flash from linux
@ 2011-09-13 11:36 Vanhauwaert Wouter
  2011-09-13 11:43 ` Baruch Siach
  0 siblings, 1 reply; 9+ messages in thread
From: Vanhauwaert Wouter @ 2011-09-13 11:36 UTC (permalink / raw)
  To: barebox


[-- Attachment #1.1: Type: text/plain, Size: 256 bytes --]

Hello,
To update our platform from within a booted linux, we need tftp to write to the nand-flash (another partition) directly.
Which one do I use? /dev/mtdx or /dev/mtdblockx? And what happens with bad blocks here? Are these bad-block aware?

Grtz


[-- Attachment #1.2: Type: text/html, Size: 2180 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: tftp to flash from linux
  2011-09-13 11:36 tftp to flash from linux Vanhauwaert Wouter
@ 2011-09-13 11:43 ` Baruch Siach
  2011-09-13 11:50   ` Vanhauwaert Wouter
  0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2011-09-13 11:43 UTC (permalink / raw)
  To: Vanhauwaert Wouter; +Cc: barebox

Hi Wouter,

On Tue, Sep 13, 2011 at 01:36:31PM +0200, Vanhauwaert Wouter wrote:
> To update our platform from within a booted linux, we need tftp to write to 
> the nand-flash (another partition) directly.
> Which one do I use? /dev/mtdx or /dev/mtdblockx? And what happens with bad 
> blocks here? Are these bad-block aware?

Use the nandwrite utility from the mtd-utils package (there's also a Busybox 
version), and /dev/mtdx.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* RE: tftp to flash from linux
  2011-09-13 11:43 ` Baruch Siach
@ 2011-09-13 11:50   ` Vanhauwaert Wouter
  2011-09-13 11:57     ` Marc Kleine-Budde
  2011-09-13 12:03     ` Baruch Siach
  0 siblings, 2 replies; 9+ messages in thread
From: Vanhauwaert Wouter @ 2011-09-13 11:50 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

Hello Baruch,

Yes, I already thought that this nandwrite command can be used for writing. But problem is I get the image via tftp and my RAM is to little to store it temporary. 
So I have to write it directly to flash. Can I combine this nandwrite and tftp in any way? I'm using busybox

thanks

-----Original Message-----
From: Baruch Siach [mailto:baruch@tkos.co.il] 
Sent: dinsdag 13 september 2011 13:44
To: Vanhauwaert Wouter
Cc: barebox@lists.infradead.org
Subject: Re: tftp to flash from linux

Hi Wouter,

On Tue, Sep 13, 2011 at 01:36:31PM +0200, Vanhauwaert Wouter wrote:
> To update our platform from within a booted linux, we need tftp to 
> write to the nand-flash (another partition) directly.
> Which one do I use? /dev/mtdx or /dev/mtdblockx? And what happens with 
> bad blocks here? Are these bad-block aware?

Use the nandwrite utility from the mtd-utils package (there's also a Busybox version), and a/dev/mtdx.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: tftp to flash from linux
  2011-09-13 11:50   ` Vanhauwaert Wouter
@ 2011-09-13 11:57     ` Marc Kleine-Budde
  2011-09-14 15:03       ` Vanhauwaert Wouter
  2011-09-13 12:03     ` Baruch Siach
  1 sibling, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2011-09-13 11:57 UTC (permalink / raw)
  To: Vanhauwaert Wouter; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 956 bytes --]

Hello Vanhauwaert,

please don't reply to an existing thread if you start a new topic!

On 09/13/2011 01:50 PM, Vanhauwaert Wouter wrote:
> Yes, I already thought that this nandwrite command can be used for
> writing. But problem is I get the image via tftp and my RAM is to
> little to store it temporary. So I have to write it directly to
> flash. Can I combine this nandwrite and tftp in any way? I'm using
> busybox

You need a tftp client that supports writing to stdout and a nandwrite
that supports reading from stdin.

Than it's the usual

tftp $server $file | nandwrite /dev/mtdfoo -

You probably need to pad the input file with '-p'

cheers, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: tftp to flash from linux
  2011-09-13 11:50   ` Vanhauwaert Wouter
  2011-09-13 11:57     ` Marc Kleine-Budde
@ 2011-09-13 12:03     ` Baruch Siach
  1 sibling, 0 replies; 9+ messages in thread
From: Baruch Siach @ 2011-09-13 12:03 UTC (permalink / raw)
  To: Vanhauwaert Wouter; +Cc: barebox

Hi Wouter,

On Tue, Sep 13, 2011 at 01:50:42PM +0200, Vanhauwaert Wouter wrote:
> Yes, I already thought that this nandwrite command can be used for writing. 
> But problem is I get the image via tftp and my RAM is to little to store it 
> temporary.  So I have to write it directly to flash. Can I combine this 
> nandwrite and tftp in any way? I'm using busybox

The nandwrite utility (and also the Busybox version) reads data from standard 
input in the absence of file argument. You can pipe the data stream from the 
network directly to nandwrite.

baruch

> -----Original Message-----
> From: Baruch Siach [mailto:baruch@tkos.co.il] 
> Sent: dinsdag 13 september 2011 13:44
> To: Vanhauwaert Wouter
> Cc: barebox@lists.infradead.org
> Subject: Re: tftp to flash from linux
> 
> Hi Wouter,
> 
> On Tue, Sep 13, 2011 at 01:36:31PM +0200, Vanhauwaert Wouter wrote:
> > To update our platform from within a booted linux, we need tftp to 
> > write to the nand-flash (another partition) directly.
> > Which one do I use? /dev/mtdx or /dev/mtdblockx? And what happens with 
> > bad blocks here? Are these bad-block aware?
> 
> Use the nandwrite utility from the mtd-utils package (there's also a Busybox 
> version), and a/dev/mtdx.
> 
> baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* RE: tftp to flash from linux
  2011-09-13 11:57     ` Marc Kleine-Budde
@ 2011-09-14 15:03       ` Vanhauwaert Wouter
  2011-09-14 16:43         ` Baruch Siach
  0 siblings, 1 reply; 9+ messages in thread
From: Vanhauwaert Wouter @ 2011-09-14 15:03 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: barebox

> please don't reply to an existing thread if you start a new topic!
> 

Ok (did I do that?)

> You need a tftp client that supports writing to stdout and a nandwrite that
> supports reading from stdin.
> 
> Than it's the usual
> 
> tftp $server $file | nandwrite /dev/mtdfoo -
> 

I try 
	mx27iat# tftp -g -l /proc/self/fd/1 -r zImage_iat_3.0.11_0.02-dbg1 10.0.56.4 | nandwrite -p /dev/mtd4 -

But this doesn't work. Gives some output, from which:
	open input file: No such file or directory
The same command without the pipe at the end works (output to stdout)
 

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: tftp to flash from linux
  2011-09-14 15:03       ` Vanhauwaert Wouter
@ 2011-09-14 16:43         ` Baruch Siach
  2011-09-15  8:38           ` Vanhauwaert Wouter
  0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2011-09-14 16:43 UTC (permalink / raw)
  To: Vanhauwaert Wouter; +Cc: barebox

On Wed, Sep 14, 2011 at 05:03:07PM +0200, Vanhauwaert Wouter wrote:
> > You need a tftp client that supports writing to stdout and a nandwrite 
> > that
> > supports reading from stdin.
> > 
> > Than it's the usual
> > 
> > tftp $server $file | nandwrite /dev/mtdfoo -
> 
> I try 
> 	mx27iat# tftp -g -l /proc/self/fd/1 -r zImage_iat_3.0.11_0.02-dbg1 10.0.56.4 | nandwrite -p /dev/mtd4 -
> 
> But this doesn't work. Gives some output, from which:
> 	open input file: No such file or directory
> The same command without the pipe at the end works (output to stdout)

Try passing the data via a named pipe:

mkfifo nand_pipe
tftp -g -l nand_pipe -r zImage 10.0.56.4 &
nandwrite -p /dev/mtd4 nand_pipe

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* RE: tftp to flash from linux
  2011-09-14 16:43         ` Baruch Siach
@ 2011-09-15  8:38           ` Vanhauwaert Wouter
  2011-09-15  9:40             ` Vanhauwaert Wouter
  0 siblings, 1 reply; 9+ messages in thread
From: Vanhauwaert Wouter @ 2011-09-15  8:38 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

> > I try
> > 	mx27iat# tftp -g -l /proc/self/fd/1 -r zImage_iat_3.0.11_0.02-dbg1
> > 10.0.56.4 | nandwrite -p /dev/mtd4 -
> >
> > But this doesn't work. Gives some output, from which:
> > 	open input file: No such file or directory The same command without
> > the pipe at the end works (output to stdout)
> 
> Try passing the data via a named pipe:
> 
> mkfifo nand_pipe
> tftp -g -l nand_pipe -r zImage 10.0.56.4 & nandwrite -p /dev/mtd4 nand_pipe
> 


Doesn't work:

mx27iat# mkfifo nand_pipe
mx27iat# tftp -g -l nand_pipe -r output 10.56.114 | nandwrite -p /dev/mtd4 nand_pipe
tftp: using blksize 512MTD_open
MTD_ioctl

using server '10.0.56.114:69', rMTD_ioctl
emote_file 'output', local_file MTD_write
'nand_pipe'
sending 15 bytes
00 01 6f 75 74 70 75 74 00 6f 63 MTD_close
74 65 74 00
Writing data to block 0
sending 15 bytes
00 01 6f 75 74 70 75 74 00 6f 63 74 65 74 00
received 516 bytes: 0003 0001

End then it quits, no error, no warning, but file should be 128kB

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* RE: tftp to flash from linux
  2011-09-15  8:38           ` Vanhauwaert Wouter
@ 2011-09-15  9:40             ` Vanhauwaert Wouter
  0 siblings, 0 replies; 9+ messages in thread
From: Vanhauwaert Wouter @ 2011-09-15  9:40 UTC (permalink / raw)
  To: Vanhauwaert Wouter, Baruch Siach; +Cc: barebox

> Doesn't work:
> 
> mx27iat# mkfifo nand_pipe
> mx27iat# tftp -g -l nand_pipe -r output 10.56.114 | nandwrite -p /dev/mtd4
> nand_pipe
> tftp: using blksize 512MTD_open
> MTD_ioctl

I did some further testing, and apparantly, the nandwrite closes after writing 1 buffer
Did the test with one console "nandwrite -p /dev/mtd4 nand_pipe" and from another echo this is a test > nand_pipe:

mx27iat# nandwrite -p /dev/mtd4 nand_pipe
MTD_open
MTD_ioctl
Writing data to block 0MTD_ioctl

MTD_write
MTD_close

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2011-09-15  9:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-13 11:36 tftp to flash from linux Vanhauwaert Wouter
2011-09-13 11:43 ` Baruch Siach
2011-09-13 11:50   ` Vanhauwaert Wouter
2011-09-13 11:57     ` Marc Kleine-Budde
2011-09-14 15:03       ` Vanhauwaert Wouter
2011-09-14 16:43         ` Baruch Siach
2011-09-15  8:38           ` Vanhauwaert Wouter
2011-09-15  9:40             ` Vanhauwaert Wouter
2011-09-13 12:03     ` Baruch Siach

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