EBC Exercise 22 Recovering

What do you do if you've been working on the kernel or u-boot and now your BeagleBone Black won't boot? Here's what works if you've saven't the .orig files as suggested. If you didn't save the files, goto EBC_Exercise_03_Installing_a_Beagle_OS and reflash the whole thing, see you in 45 minutes.

If you did make backups, follow along, this is much faster.

Getting the SD card image
The first step is to set up an SD that you can boot off. Before, you created an SD card that would copy an image to the on board eMMC. This is different, now you will be booting off the SD card. No need for the 45 minute wait.

Go to the latest images and download the first link (Angstrom Distribution (BeagleBone, BeagleBone Black - 4GB SD) 2013-06-20). Copy it to your SD card like you did for the eMMC image.

Boot off the SD card
Once your SD card is ready, You are now booting off the SD card. Once booted, login and mount the eMMC partition.
 * 1) power off the Bone
 * 2) put SD card in the reader on the Bone
 * 3) hold down the S2 button.  It's the one near pin 45 of P8
 * 4) power up the bone, while still holding S2
 * 5) wait for all the LEDs to light and the release S2.

Mounting the FAT partition
If you are recovering from changing u-boot you need to mount the first (FAT) partition. beagle$ mkdir /media/BONE beagle$ mount /dev/mmcblk1p1 /media/BONE/ beagle$ cd /media/BONE/ beagle$ ls App  Drivers  LICENSE.txt  README.md  autorun.inf  u-boot.img.new   uEnv.txt Docs ID.txt   MLO          START.htm  u-boot.img   u-boot.img.orig

You can now move the original u-boot image back beagle$ rm u-boot.img beagle$ cp u-boot.img.orig u-boot.img beagle$ cd .. beagle$ umount BONE

Mounting the ext4 partition
If it's the kernel you need to recover, you need to mount the second (ext4) partition. It's like before, but you change one digit. beagle$ mkdir /media/BONE beagle$ mount /dev/mmcblk1p2 /media/BONE/ beagle$ cd /media/BONE/ beagle$ ls bin  dev  home  lost+found  mnt   run   sys  usr boot etc  lib   media       proc  sbin  tmp  var beagle$ cd boot beagle$ ls am335x-bone.dtb      omap3-evm.dtb       uEnv.txt am335x-boneblack.dtb omap3-tobi.dtb      uImage am335x-evm.dtb       omap4-panda-a4.dtb  uImage-3.8.13 am335x-evmsk.dtb     omap4-panda-es.dtb  uImage-3.8.13-bone26.1 am335x-tester.dtb    omap4-panda.dtb     uImage-3.8.13-bone27 omap2420-h4.dtb      omap4-sdp.dtb       uImage_bak omap3-beagle-xm.dtb  omap4-var-som.dtb omap3-beagle.dtb     omap5-evm.dtb beagle$ rm uImage beagle$ ln -s uImage-3.8.13 uImage

And then clean up beagle$ cd ../.. beagle$ umount BONE

Rebooting
You can't just run the reboot command at this point. You need to power off the Bone, remove the SD card and then reboot. beagle$ halt One the lights are off, eject the SD card and power up. You should be recovered.