Friday, January 30, 2009

beagleboard recovery take 2

[2013-03-06 update]:
after a few years of letting things rot, I just managed to pick up my old binaries and gave it a dry run:
https://github.com/nmenon/beagle-recover has the original working binaries since the google groups link no longer work. NOTE: I HAVE NOT TRIED WITH ANY OF THE LATEST SOURCES. I do not have plans to do so in the future as well  - an quick try indicated things are broke :(

[Original post]

http://groups.google.com/group/beagleboard/web/beagle_recover.tar.bz2 has the recovery package ready to go for ubuntu 8.04 32bit OS: download this, run sudo ./recover_beagle.sh - as shown in the video... Steps summary:
1. first shutdown the board.
2. run 'sudo recover_beagle.sh /dev/ttyUSB0' in a terminal -> you need
super user permissions(sudo permissions) to run this script.
3. Keep the pushbutton S1pressed while powering on the board -> there
are two white push button switches, use the one closer to the edge of
the board
NOTE: if your nand is completely erased, the above step wont be
needed, but what the heck, use it for preventing all kind of cases
where you have an MMC card/partly corrupted nand etc..
4. Once the terminal starts downloading, you can remove ur finger off
the S1 switch ;)..
5. wait a bit for files to reach and be flashed :).. the script should
exit happily once it is done.

With u-boot-v1 in mainline arm repo, here is take two of the same.. this time with a script and a non-Oscar winning video:


complete discussion and thread here: http://groups.google.com/group/beagleboard/t/e193478766224281

copied here for details:

On my ubuntu 8.04 32bit OS PC, here are the steps I did.

------------- Build Steps ----------------
$git clone git://gitorious.org/x-load-omap3/mainline.git xloader
$git clone git://git.denx.de/u-boot-arm.git
$git clone git://git.denx.de/u-boot-v2.git
$git clone git://github.com/nmenon/omap-u-boot-utils.git


$alias mymake='make -j2 CROSS_COMPILE=arm-none-linux-gnueabi- V=1 ARCH=arm'
$cd x-loader
$mymake omap3530beagle_config;mymake
$wget "http://beagleboard.googlecode.com/files/signGP.c"
$gcc -o signGP signGP.c
$./signGP x-load.bin 0x40200800
$cd ../u-boot-v2/
$mymake omap3530_beagle_per_uart_defconfig; mymake
$cd ../u-boot-arm
$mymake omap3_beagle_config;mymake
$cd ../omap-u-boot-utils
$make;make usb
$mkdir -p ../beagle_recover/target_files;cd ../beagle_recover

$cp ../omap-u-boot-utils/pusb ../omap-u-boot-utils/pserial
../omap-u-boot-utils/ukermit ../omap-u-boot-utils/ucmd .
$cp ../u-boot-arm/u-boot.bin target_files/u-boot-v1.bin
$cp ../u-boot-v2/uboot.bin target_files/u-boot-v2.bin
$cp ../xloader/x-load.bin.ift target_files/x-load.bin.ift

------------- Flashing Steps ----------------
$TTY=/dev/ttyS0
$sudo ./pusb -f ./target_files/u-boot-v2.bin
Connected just the USB cable to the board with the user switch S1 pressed.
$./ucmd -p $TTY -c "loadb -f /dev/ram0" -e "bps..."
$./ukermit -p $TTY -f target_files/u-boot-v1.bin
$./ucmd -p $TTY -c "go 0x80000000" -e "serial";./ucmd -p $TTY -c "help" -e "#"
$./ucmd -p $TTY -c "nand erase" -e "#"
$./ucmd -p $TTY -c "nand write.i 80000000 80000 80000" -e "#"
$./ucmd -p $TTY -c "loadb 80000000" -e "bps..."
$./ukermit -p $TTY -f target_files/x-load.bin.ift
$./ucmd -p $TTY -c "nandecc hw" -e "#"
$./ucmd -p $TTY -c "nand write.i 80000000 0 80000" -e "#"


The following step is optional if you want to remove the autoboot.
$ ./ucmd -p $TTY -c "setenv bootcmd;nandecc sw;saveenv" -e "#"


The attached tarball contain prebuilt images, and you can also use a
script recover_beagle.sh which is part of the tgz attached.

13 comments:

Unknown said...

> >
> >
> http://groups.google.com/group/beagleboard/browse_thread/thread/d97b2152fe7185dd#
> you may want to give this a shot if mmc recovery is tough...

I have tried the usb & uart recovery under the guide of the link above,
and still failed, so I guess hw of the board has been destructed.

I am still a bit surprised about this, after all x-loader can work
correctly, but u-boot have not been booted successfully and does not
print everything. Maybe I need to dig into u-boot source code to locate
what is wrong about the board.

This is the usb & uart recovery information. Can you give me some
guide?

Thanks!

[lm@linux-lm beagle_recover]$ sudo ./recover_beagle.sh /dev/ttyUSB0
[sudo] password for lm:
NOTE:
When you see the message "Waiting for USB device..", Connect USB Cable
to the board with the switch S1 pressed Keep S1 pressed for 1 second at
least after connecting usb cable. Waiting for USB device
vendorID=0x451and productID=0xD009: Dev #37: Texas Instruments -
OMAP3430
- Serial Number: N/A
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:
lx
^C
[lm@linux-lm beagle_recover]$
[lm@linux-lm beagle_recover]$ sudo ./recover_beagle.sh /dev/ttyUSB0
NOTE:
When you see the message "Waiting for USB device..", Connect USB Cable
to the board with the switch S1 pressed Keep S1 pressed for 1 second at
least after connecting usb cable. Waiting for USB device
vendorID=0x451and productID=0xD009: Dev #39: Texas Instruments -
OMAP3430
- Serial Number: N/A
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:
loadb -f /dev/ram0



## Ready for binary (kermit) download to 0x00000000 offset on /dev/ram0
device at 115200 bps... Match Found. Operation completed!
Downloading file: 100.000% completed(174632/174632 bytes)
File Download completed
Output:
go 0x80000000



## Starting application at 0x80000000 ...
/* not anything printed any longer */

Nishanth Menon said...

ow, this is weird.. yeah board specific debugging is required.. :( I
have a rev C and a rev A board and it worked out of the box.. for both.
log as an example:
$ ./recover_beagle.sh /dev/ttyUSB0
NOTE:
When you see the message "Waiting for USB device..", Connect USB Cable
to the board with the switch S1 pressed
Keep S1 pressed for 1 second at least after connecting usb cable.
Waiting for USB device vendorID=0x451and productID=0xD009:
Dev #8: Texas Instruments - OMAP3430
- Serial Number: N/A
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:
loadb -f /dev/ram0

## Ready for binary (kermit) download to 0x00000000 offset on /dev/ram0
device at 115200 bps...
Match Found. Operation completed!
Downloading file: 100.000% completed(174632/174632 bytes)
File Download completed
Output:
go 0x80000000

## Starting application at 0x80000000 ...

U-Boot 2009.03-00325-gf75a729 (Apr 09 2009 - 13:36:05)

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz

OMAP3 Beagle board + LPDDR/NAND

DRAM: 128 MB

NAND: 256 MiB

*** Warning - bad CRC or NAND, using default environment

In: serial
Match Found. Operation completed!
Output:
0
OMAP3 beagleboard.org #
Match Found. Operation completed!
Output:
nand erase

NAND erase: device 0 whole chip

Erasing at 0x0 -- 0% complete.
---snip---
Erasing at 0xfae0000 -- 98% complete.
Erasing at 0xfd60000 -- 99% complete.
Erasing at 0xffe0000 -- 100% complete.

OK

OMAP3 beagleboard.org #
Match Found. Operation completed!
Output:
nand write.i 80000000 80000 80000

NAND write: device 0 offset 0x80000, size 0x80000

524288 bytes written: OK

OMAP3 beagleboard.org #
Match Found. Operation completed!
Output:
loadb 80000000


## Ready for binary (kermit) download to 0x80000000 at 115200 bps...
Match Found. Operation completed!
Downloading file: 100.000% completed(20392/20392 bytes)
File Download completed
Output:
nandecc hw


HW ECC selected

OMAP3 beagleboard.org #
Match Found. Operation completed!
Output:
nand write.i 80000000 0 80000

NAND write: device 0 offset 0x0, size 0x80000

524288 bytes written: OK

OMAP3 beagleboard.org #
Match Found. Operation completed!
Output:
setenv bootcmd;nandecc sw;saveenv


SW ECC selected

Saving Environment to NAND...

Erasing Nand...

Erasing at 0x260000 -- 100% complete.

Writing to Nand... done

OMAP3 beagleboard.org #
Match Found. Operation completed!
$

Nishanth Menon said...

ok new video updated

Anonymous said...

My beagleboard is bricked and I tried all methods. I run your script and (download seems to happen in a second.why???) this is what I get : -->

NOTE:
When you see the message "Waiting for USB device..", Connect USB Cable to the board with the switch S1 pressed
Keep S1 pressed for 1 second at least after connecting usb cable.
Waiting for USB device vendorID=0x451and productID=0xD009:
Dev #25: Texas Instruments - OMAP3430
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:
loadb -f /d�v/ram0



load����ɹ���with -2


X-load Beagle>

---------------
I cannot proceed afterwards....

Chao said...

I have the following output after running your program:

***************
setup@babaco:~/Desktop/beagle_recover$ sudo ./recover_beagle.sh /dev/ttyS0
NOTE:
When you see the message "Waiting for USB device..", Connect USB Cable to the board with the switch S1 pressed
Keep S1 pressed for 1 second at least after connecting usb cable.
Waiting for USB device vendorID=0x451and productID=0xD009:
Dev #9: Texas Instruments - OMAP3430
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:

*************

There is no output... The usr0 and usr1 lights are off. I am using Rev C4.

Can you help? Thanks a lot.

Unknown said...

Excellent post...extremely helpful...thanks a ton!!

Hasan said...

I tried this script to recover my bb, it worked. But when I want ta recover my friend's bb, it fails and gives this output below then stops forever:

NOTE:
When you see the message "Waiting for USB device..", Connect USB Cable to the board with the switch S1 pressed
Keep S1 pressed for 1 second at least after connecting usb cable.
[sudo] password for hasan:
Waiting for USB device vendorID=0x451and productID=0xD009:
Dev #2: Texas Instruments - OMAP3430
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:

ahmetyunus said...

hi
I followed the Build Steps then Flashing steps but one of the Flashing Step it stops like ;
$./ucmd -p $TTY -c "loadb -f /dev/ram0" -e "bps..."
sh: lsof: command not found
Output:
loadb -f /dev/ram0
loadb returned with -2
X-load Beagle>

after this line no anything else
so I cannot write other steps. What is the problem I can't solve

ahmetyunus said...

hi
I followed the Build Steps then Flashing steps but one of the Flashing Step it stops like ;
$./ucmd -p $TTY -c "loadb -f /dev/ram0" -e "bps..."
sh: lsof: command not found
Output:
loadb -f /dev/ram0
loadb returned with -2
X-load Beagle>

after this line no anything else
so I cannot write other steps. What is the problem I can't solve

Nishanth Menon said...

@ahmetyunus :
check if you have lsof in your machine: e.g. on ubuntu:
sudo apt-cache search lsof
install it using:
sudo apt-get install lsof

ahmetyunus said...

Thanks alot Nishanth :)
after your device I got lsof and continued.
But now it stops here like Ming said;
************************************
Downloading file: 100.000% completed(174212/174212 bytes)
File Download completed
Output:
go 0x80000000



## Starting application at 0x80000000 ...
***************************************
after this line no anything else it waits. In your reply to Ming, you said that board specific debugging required. My BB is Rev C4. How can I do this debugging. Is the application in different addrress instead of 0x80000000 ? Thanks again for you help

Unknown said...

I am stuck at "Output:" prompt.Please help !!
sanket@sanket-ub:~/c4/nmenon/beagle-recover$ sudo ./recover_beagle.sh /dev/ttyUSB0
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/sanket/gvfs
Output information may be incomplete.
NOTE:
CRITICAL: USB MUST BE CONNECTED ON PC PORT directly (NOT THROUGH AN HUB)!!!!
CRITICAL: POLLING MODE USED - try NOT TO have CPU intensive tasks going on in background
Keep S1 pressed for 1 second at least after connecting usb cable.
When you see the message "Waiting for USB device..", Connect USB Cable to the board with the switch S1 pressed
Waiting for USB device vendorID=0x451and productID=0xD009:
Dev #28: Texas Instruments - OMAP3430
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output:

Unknown said...

I am stuck at "Output:" prompt.Please help !!
sanket@sanket-ub:~/c4/nmenon/beagle-recover$ sudo ./recover_beagle.sh /dev/ttyUSB0
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/sanket/gvfs
Output information may be incomplete.
NOTE:
CRITICAL: USB MUST BE CONNECTED ON PC PORT directly (NOT THROUGH AN HUB)!!!!
CRITICAL: POLLING MODE USED - try NOT TO have CPU intensive tasks going on in background
Keep S1 pressed for 1 second at least after connecting usb cable.
When you see the message "Waiting for USB device..", Connect USB Cable to the board with the switch S1 pressed
Waiting for USB device vendorID=0x451and productID=0xD009:
Dev #28: Texas Instruments - OMAP3430
Downloading file: 100.000% completed(38960/38960 bytes)
./target_files/u-boot-v2.bin downloaded successfully to target
Output: