Monday, October 12, 2009

Beagle Board Recovery

These instructions were derived from
1. http://code.google.com/p/beagleboard/wiki/BeagleboardRevCValidation
2. http://www.sakoman.com/OMAP3/preparing-a-bootable-sd-card.html

FIXING BEAGLE BOARD (restore to factory setting)
------------------------------------------------
1) Make a partition in the mmc card. Use these commands. Make sure that you
have unmounted the SD card before continuing.
$ sudo fdisk /dev/sde
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p

Disk /dev/sde: 2032 MB, 2032664576 bytes
64 heads, 63 sectors/track, 984 cylinders
Units = cylinders of 4032 * 512 = 2064384 bytes
Disk identifier: 0x00aa8e5c

Device Boot Start End Blocks Id System

NOTE: In order to calculate the # of cylinders, take the # of bytes reported above and use this formula: 2064384/#ofHeads/#ofSectors/bytes_per_sector and round the result

Command (m for help): x
Expert command (m for help): h
Number of heads (1-256, default 4): 255

Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity

Expert command (m for help): c
Number of cylinders (1-1048576, default 984): 247
Expert command (m for help): r

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-247, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 15): +247M
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p

Disk /dev/sde: 2032 MB, 2032664576 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00aa8e5c

Device Boot Start End Blocks Id System
/dev/sde1 * 1 5 40131 c W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
# sudo mkfs.vfat -F 32 /dev/sde1 -n FAT
mkfs.vfat 2.11 (12 Mar 2005)


2) Download the files listed below and save them to a working directory. For these steps assume /home//temp. NOTE: replace with your user
account.
$ mkdir /home//temp
FILES to Download
1. MLO as MLO
2. u-boot as u-boot.bin
3. u-boot for flash as u-boot-f.bin
4. ramdisk image as ramdisk.gz
5. Kernel (uImage) as uImage.bin
6. reset.scr as boot.scr
7. x-loader image as x-load.bin.ift
8. Regular script file as normal.scr

3) Mount the SD card partition. i.e.
$ sudo mkdir /media/card
$ sudo mount /dev/sdb1 /media/card

4)Copy the following files in correct order: MLO, u-boot.bin, u-boot-f.bin, ramdisk.gz, uImage.bin, boot.scr, x-load.bin.ift, normal.scr
$ cd /home//temp
$ sudo cp MLO /media/card/
$ sudo cp u-boot.bin /media/card/
$ sudo cp u-boot-f.bin /media/card/
$ sudo cp ramdisk.gz /media/card/
$ sudo cp uImage.bin /media/card/
$ sudo cp boot.scr /media/card/
$ sudo cp x-load.bin.ift /media/card/
$ sudo cp normal.scr /media/card/

5) Un-mount the SD Card
$ cd /media
$ sudo umount /media/card

6) While power is not connected to the beagleboard insert the SD card.

7) Press and hold the USER BUTTON (the one closest to the edge of the board)
and connect the power to the board while still holding the user button.

8) Once the board boots and you see the boot delay you can release the user
button. Continue to let the board boot. The scripts on the SD card
should restore the NAND flash.

9) Once the restore has finished you should be able to power off the
beagleboard, remove the SD card, and power the board back on. You
should see the board boot into u-boot from NAND.

NOTE: I did see some errors when writing the uImage and ramdisk.gz files to the NAND. Inspite of those error messages, beagle board is restored to factory settings.

Additional Resources can be found at:
http://www.elinux.org/BeagleBoardRecovery

No comments: