All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] Download the u-boot from flash back to PC
@ 2011-06-08 13:25 Rishi Dhupar
  2011-06-08 13:43 ` Detlev Zundel
  2011-06-08 15:35 ` Jason
  0 siblings, 2 replies; 6+ messages in thread
From: Rishi Dhupar @ 2011-06-08 13:25 UTC (permalink / raw)
  To: u-boot

I have a board which has a version of u-boot on it that I would like
to save before overwriting. I did not flash this version so I do not
have the source code for it.

I am trying to figure out is there away to essentially do a 'tftp get'
of the u-boot.bin that was originally written to flash.  I do not see
any methods to "read" data from U-boot back to the PC.  Is there any
method to do this?

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

* [U-Boot] Download the u-boot from flash back to PC
  2011-06-08 13:25 [U-Boot] Download the u-boot from flash back to PC Rishi Dhupar
@ 2011-06-08 13:43 ` Detlev Zundel
  2011-06-08 16:53   ` Mike Frysinger
  2011-06-08 15:35 ` Jason
  1 sibling, 1 reply; 6+ messages in thread
From: Detlev Zundel @ 2011-06-08 13:43 UTC (permalink / raw)
  To: u-boot

Hi Rishi,

> I have a board which has a version of u-boot on it that I would like
> to save before overwriting. I did not flash this version so I do not
> have the source code for it.
>
> I am trying to figure out is there away to essentially do a 'tftp get'
> of the u-boot.bin that was originally written to flash.  I do not see
> any methods to "read" data from U-boot back to the PC.  Is there any
> method to do this?

The only thing that I know of is CONFIG_CMD_SAVES which does a "save S
record over serial line" (check common/cmd_load.c).  It is likely that
your binary U-Boot does noe have this feature though (it is not in
config_cmd_default, so the board maintainer has to define it
explicitely).

When I needed to do this, I could either attach a BDI3000 which can do a
tftp put (remember to create the file on the host first, otherwise it
will fail silently!), or I used a linux kernel that was able to read
U-Boot through the mtd interface.

If you decide to implement a "tftpput" command, I for one would find
this a very nice addition indeed ;)

Cheers
  Detlev

-- 
Question    : If you were redesigning UNIX, what would you do differently?
Ken Thompson: I'd spell creat with an e.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

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

* [U-Boot] Download the u-boot from flash back to PC
  2011-06-08 13:25 [U-Boot] Download the u-boot from flash back to PC Rishi Dhupar
  2011-06-08 13:43 ` Detlev Zundel
@ 2011-06-08 15:35 ` Jason
  1 sibling, 0 replies; 6+ messages in thread
From: Jason @ 2011-06-08 15:35 UTC (permalink / raw)
  To: u-boot

On Wed, Jun 08, 2011 at 09:25:42AM -0400, Rishi Dhupar wrote:
> I have a board which has a version of u-boot on it that I would like
> to save before overwriting. I did not flash this version so I do not
> have the source code for it.

funny how often that happens... :-(
 
> I am trying to figure out is there away to essentially do a 'tftp get'
> of the u-boot.bin that was originally written to flash.  I do not see
> any methods to "read" data from U-boot back to the PC.  Is there any
> method to do this?

Here's what I've done in the past.

WARNING: read everything _before_ you start!

1.) On the device, in U-Boot, zero out some memory (1MB at 0x0800000)

$ mw.b 0x0800000 0x00 0x100000

2.) Read the bootloader into RAM at 0x0800000, size 1MB, offset into
nand, 0x300. 

$ nand read 0x0800000 0x300 0x100000

3.) close your minicom/screen/whatever that you are using to talk to the
serial port.  On your desktop, run the following:

$ printf "md.b 0x0800000 0x100000\r\r" | \
socat - /dev/ttyUSB0,raw,echo=0,crnl >u-boot.ascii 2>&1

This will take a while (10 - 20 minutes!), in another terminal, setup a
watch:

$ watch -n3 "ls -l u-boot.ascii"

4.) prep the ascii file for conversion to binary.
	a.) remove the first and last lines
	b.) start the address numbers (first column) at 0, eg

$ sed -i.bak -r -e 's/^008/000/' -e 's/^009/001/' u-boot.ascii

5.) Convert ascii to binary

$ xxd -r u-boot.ascii u-boot.bin

Notes: Obviously, your addresses and sizes are going to be different,
you may need to use 'sudo socat' for step 3.  This is from memory, I
just did it a week ago though.  You could always replace xxd with some
sort of sed/awk script.

hth,

Jason.

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

* [U-Boot] Download the u-boot from flash back to PC
  2011-06-08 13:43 ` Detlev Zundel
@ 2011-06-08 16:53   ` Mike Frysinger
  2011-06-08 21:42     ` Detlev Zundel
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2011-06-08 16:53 UTC (permalink / raw)
  To: u-boot

On Wednesday, June 08, 2011 09:43:36 Detlev Zundel wrote:
> If you decide to implement a "tftpput" command, I for one would find
> this a very nice addition indeed ;)

someone has already posted tftp server support for u-boot.  not sure if it's 
been merged yet, but wolfgang seemed happy with it.

not that it'd help with the OP's current issue ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110608/47f83a80/attachment.pgp 

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

* [U-Boot] Download the u-boot from flash back to PC
  2011-06-08 16:53   ` Mike Frysinger
@ 2011-06-08 21:42     ` Detlev Zundel
  2011-06-08 22:11       ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Detlev Zundel @ 2011-06-08 21:42 UTC (permalink / raw)
  To: u-boot

Hi Mike,

> On Wednesday, June 08, 2011 09:43:36 Detlev Zundel wrote:
>> If you decide to implement a "tftpput" command, I for one would find
>> this a very nice addition indeed ;)
>
> someone has already posted tftp server support for u-boot.  not sure if it's 
> been merged yet, but wolfgang seemed happy with it.

Yes, I know - but that only implemenmts the "receive" operation,
i.e. U-Boot receives data.

> not that it'd help with the OP's current issue ...

Nope, not at all ;)  That's why I said, either a "tftpput" or a
"receive" for the tftp server would be nice.

Cheers
  Detlev

-- 
Emacs is the way to purify your soul using garbage collection.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

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

* [U-Boot] Download the u-boot from flash back to PC
  2011-06-08 21:42     ` Detlev Zundel
@ 2011-06-08 22:11       ` Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-06-08 22:11 UTC (permalink / raw)
  To: u-boot

On Wednesday, June 08, 2011 17:42:30 Detlev Zundel wrote:
> > On Wednesday, June 08, 2011 09:43:36 Detlev Zundel wrote:
> >> If you decide to implement a "tftpput" command, I for one would find
> >> this a very nice addition indeed ;)
> > 
> > someone has already posted tftp server support for u-boot.  not sure if
> > it's been merged yet, but wolfgang seemed happy with it.
> 
> Yes, I know - but that only implemenmts the "receive" operation,
> i.e. U-Boot receives data.

i thought there was code sitting around for transmitting from u-boot.  *shrug* 
must have remembered wrong.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110608/3a9c7b3f/attachment.pgp 

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

end of thread, other threads:[~2011-06-08 22:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 13:25 [U-Boot] Download the u-boot from flash back to PC Rishi Dhupar
2011-06-08 13:43 ` Detlev Zundel
2011-06-08 16:53   ` Mike Frysinger
2011-06-08 21:42     ` Detlev Zundel
2011-06-08 22:11       ` Mike Frysinger
2011-06-08 15:35 ` Jason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.