September 26, 2016

Flashing Debian and SD card booting

If you have an older BBB running Angstrom, you should drop everything and follow this procedure to flash a Debian system onto your unit. The Debian release has numerous things working right right out of the box that I spent days trying to get straightened out on Angstrom. So back up your files and get to it.

You will need a "flasher" image. I flash the console flavor since I have absolutely no intention of running X windows on the HDMI. In fact I would be perfectly happy if the HDMI was not there at all. The console image fits just fine into 2G of eMMC.

These are files I have from back in 2015 (and what I am currently running). The file with "lxde" in the name runs some kind of "lightweight" window system. Note that it is 44M compressed as compared to 5M compressed for the console images. I am going to delete it right now.
-rw-r-----  1 tom tom  53019200 Nov  2  2015 bone-debian-7.9-console-armhf-2015-10-30-2gb.img.xz
-rw-rw-r--  1 tom tom  53008176 Mar 18  2016 BBB-eMMC-flasher-debian-7.9-console-armhf-2015-10-30-2gb.img.xz
-rw-r-----  1 tom tom 436301260 Nov  2  2015 BBB-eMMC-flasher-debian-7.9-lxde-armhf-2015-10-30-2gb.img.xz
The other two images with the word "console" in them are what you want. The one named "bone-debian-*" will boot and run from the SD card. This is not what you want. The other one, named "BBB-eMMC-flasher-debian-7.9-console-armhf-2015-10-30-2gb.img.xz" is what you want. You put this on a micro-SD card, boot it, let it run its course, and it puts debian onto your on board eMMC, annihilating whatever is currently there.

I am providing my copy of this flasher image (see link above) since it has been incredible useful to me and may also help others. I am not seeing 2G console images in the current offerings.

More recent images are available. Not all will fit into 2G eMMC. Be careful to get an image for the BBB and not just a "beaglebone" or "X15" or something. You are on your own. Take care.

Find a micro-SD card someplace (I use an 8G, because that is what I have laying around). Put this into an SD card reader and plug it into your linux desktop. Pay careful attention to what device it mounts up as. It will be something like /dev/sdb or /dev/sdc. Let's say it is /dev/sdc. If your system automounts it, unmount it. Then be darn sure you don't do the following to one of your system disks, or it will be a really bad day for you. In other words, just to be explicit, if you slip up in the following and type sda instead of sdc, your desktop will be history.

unxz BBB-eMMC-flasher-debian-7.9-console-armhf-2015-10-30-2gb.img.xz
dd if=BBB-eMMC-flasher-debian-7.9-console-armhf-2015-10-30-2gb.img of=/dev/sdc

Doing the flashing

A strong recommendation is to use an actual power supply (like one that supplies 5 volts and 2 amps) and plug it into the jack for the barrel connector. If you have a BBG, there ain't no barrel connector, so you have to figure out something else. The word is that if you try to flash while just being powered from USB (with its 500 mA limit) it may or may not work right.

Once you get your power supply ready, insert the compact SD card, hold down the boot button and apply power. It is handy, but not essential to have a serial console hooked up to watch the show. Just watch the LED's as soon as they start moving back and forth you can release the button. Keep your hands off until it powers off (all the lights go out). Mine took about 2 minutes. Add an extra minute because it is booting the kernel and trying to do DHCP before it finally shuts down for good. Remove the flash card and boot it up. With a network cable connected so that it can do DHCP it takes only seconds!!

Debian boots very fast. It also nicely shuts down if you just hold the power button down, maybe for 10 seconds. All the lights go out letting you know it is safe to unplug the unit.

For the record, after the install on a 2G rev B board, the df command shows:

rootfs     1812668 192424   1526500  12% /

Extra notes on booting from SD

Images are available that run from the SD card without installing onto eMMC. These are fine for testing or for the timid (or for disaster recovery). For regular use though, remember you have to hold down that boot button every time you power cycle. Interestingly enough you do not have to hold down the boot button when you do a reset.

The reason (as I understand it) is this. That boot button just tells the onboard boot ROM what device to fetch U-Boot from. Aparently a reset just goes back to U-Boot. You can read more about this here:

There may be a way to get around the BOOT button. If you have a version of U-boot on eMMC that you like and if you know where to find the uEnv.txt file that that U-boot uses, you should be able to edit that file to instruct U-boot to boot from the SD card. This is an exercise for the reader.

Feedback? Questions? Drop me a line!

Tom's Computer Info /