Tuesday, March 8, 2016

Beaglebone Black Boot Only From SD Card

After my unpleasant experience with the BBB crashing and corrupting it's own OS in eMMC, I decided that to use BBB in my application I have to ensure its reliability by forcing it to boot from SD card like the original Beaglebone. After a bit of a scare where it seemed as though this always required the boot button to be pressed on the board itself (it does not always require this, only when there is a viable OS in eMMC), I uncovered various sources which explained which configuration file on the BBB to lobotomize to make it boot from SD card every time without having to push any buttons on the board.

This link is typical of most instructions for booting from SD in that it mentions holding the boot button on the card without explaining any further. Also it includes the usual instructions for using the SD card to load the OS into the eMMC. Despite not being what I was looking for, this was notable for being one of the clearest guides to getting started with upgrading the BBB to Debian outside of BeagleBone's own web pages: http://thethingsystem.com/dev/Bootstrapping-the-BeagleBone-Black-with-Debian.html

The BeagleBone:Debian wiki is a maze of poor documentation, I'm afraid. Here is the map through the maze that I've developed as a result of feeling my way through it multiple times:

Here is the top-level wiki page for how to install Debian. It makes mention of an image "that can run from a microSD card" but that link just goes to another wiki page. It's actually easier just to get the SD image from the BeagleBoard.org page; through trial and error I've verified that the same image works fine on both the original BeagleBone and BBB. Further down the page, it mentions having to hold the boot button and provides a link to a FAQ that supposedly answers how to boot from SD every time. That FAQ is just a link to yet another page. http://elinux.org/Beagleboard:Debian_On_BeagleBone_Black

Here's where the link to "an image that can run from a microSD card" goes. It's a confused tangle of a whole pile of different images, from ones for eMMC, stripped down ones, ones for other Beagle products, and in there is a prebuilt image for SD card. Again, easier just to go to BeagleBoard.org. http://elinux.org/BeagleBoardDebian#BeagleBone.2FBeagleBone_Black

Here is a different page on the wiki for an image for SD card. In a block quote, it has the first clue about what modifications on the eMMC to cause it to go to the SD card by default. The hint has us deleting the MLO file (which apparently can only be accessed by mounting the BBB as a thumb drive). However, other instructors mention just renaming the file which is clearly a wiser method. http://elinux.org/Beagleboard:Updating_The_Software#Image_For_Booting_From_microSD

Here is one of those corroborating links for the method of deleting/renaming the MLO file: http://perf.tamu.edu/perftech/beaglebone-black-boot-from-the-minisd-card/

In my case, since the eMMC had been fully corrupted, I didn't have to touch the MLO file. I was able to move the SD card from my BeagleBone to the BBB and everything worked exactly the same, except that now I can hook up an HDMI monitor (more on that later). In fact, when I connected the BBB to my PC via USB, nothing mounted, so I never got a chance to try out this hint. I might go through the steps for flashing the OS to the eMMC just to see if I can restore my BBB to factory settings so I can rehearse this hint!