In this article I describe how to install U-Boot with Android fastboot support on a BeagleBone Black, which means that you can install new Android images onto the internal eMMC memory over a USB cable using the normal “fastboot” command-line tool.
If you want some background on fastboot and so on, you might be interested in a presentation I created a little while ago that describes the Android early boot process, how boot images are formatted and how to use the fastboot command:
http://www.slideshare.net/chrissimmonds/android-bootslides20
Mainline U-Boot does not support fastboot. Various vendors have added it to their own versions, including the Rowboat project for the BeagleBone Black (and other devices). However, even this version does not work out of the box and has a few annoyances, so I have cloned it and made some changes to make it easier to use. It is this version that I am going to describe here.
The steps are
I tested using BeagleBone Black rev A5c and rev 6 and Ubuntu 12.04 on my PC.
As well as the BeagleBone and a micro SD card, you will need a serial-to-USB cable and it is recommended that you use an external power supply
because the current used when writing to the eMMC chip may exceed that supplied by a typical USB port. See this page for examples: http://elinux.org/Beagleboard:BeagleBone_Black_Accessories.
For those in a hurry, you can use the pre-compiled binaries from http://2net.co.uk/downloads/u-boot-bbb-fb/u-boot-am335x-v2013.01.01-bbb-....
Or you can compile them from source following the instructions further down.
In essence, this is very easy. Just copy the two files from the tar file onto a partition of a micro SD card. The partition must be
There are many ways of formatting a card like this. Here is one that uses command-line tools and so can be put in a script.
Take a micro-SD card and connect it to your PC by:
Now type the command below to partition the micro-SD card, assuming that the card is seen as "/dev/mmcblk0"
sudo sfdisk -D -H 255 -S 63 /dev/mmcblk0 << EOF
,9,0x0C,*
,,,-
EOF
Format the first partition as FAT32
sudo mkfs.vfat -F 32 -n boot /dev/mmcblk0p1
Remove the card and insert it again. It should automatically be mounted as "/media/boot" (or "/media/[user]/boot" if you are using Ubuntu 12.10 or later).
Now, copy the files to this partition:
cp MLO u-boot.img /media/boot
Finally, umount it.
WARNING: this will erase everything in the eMMC storage. If you want to restore the the factory default installation later, follow the instructions
here: http://elinux.org/Beagleboard:Updating_The_Software
1. With no power on the BeagleBone board, insert the micro-SD card.
2. Plug in the serial cable. A serial port should appear on your PC as /dev/ttyUSB0.
3. Start a suitable terminal program such as gtkterm, minicom or picocom and attach to the port at 115200 bps with no flow control:
$ gtkterm -p /dev/ttyUSB0 -s 115200
4. Press and hold the 'Boot Switch' button on the Beaglebone, power up the board using the external 5V power connector and release the button after about 5 seconds. You should see a U-Boot prompt on the serial console
U-Boot#
Ignore the error message "booti: cannot find 'boot' partition", that will be fixed when you load the Android images
5. Type “fastboot” to put U-Boot into fastboot mode.
6. Make sure that you have plugged in the USB cable between the mini USB port on the BeagleBone and the PC. Then, using the fastboot command from
the Android SDK or an AOSP build, check that the BeagleBone has been detected by typing (on the PC)
$ fastboot devices
90:59:af:5e:94:81 fastboot
7. If instead you see
$ fastboot devices
no permissions fastboot
Add this line to /etc/udev/rules.d/51-android.rules
SUBSYSTEM =="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="d022" , MODE="0666"
Then unplug the mini USB cable and plug it back in again. Check that the permissions problem has gone away.
8. Change into the directory where you extracted the MLO and u-boot.img files from the tar archive, or if you compiled U-Boot from source, the u-boot directory. Use fastboot to format the eMMC chip and then flash the files over
$ fastboot oem format
$ fastboot flash spl MLO
$ fastboot flash bootloader u-boot.img
9. Power off the board, remove the SD card and check that you can load the new U-Boot from eMMC and that the prompt is “U-Boot#”. That's it, you are done. Happy fastbooting!
I show how to build Android with a partition layout that matches that encoded in this version of U-Boot in Building Jelly Bean 4.3 AOSP for Beaglebone Black v2.0 - with fastboot
Any time you want to flash new a Android build, boot to the “U-Boot#” prompt and put it into fastboot mode by typing “fastboot”. From then on it will appear just like any other Android device and you load the Android images using commands such as
$ fastboot flash userdata
$ fastboot flash cache
$ fastboot flashall
Get my version of U-Boot like so:
$ git clone https://github.com/csimmonds/u-boot.git
$ cd u-boot
$ git checkout am335x-v2013.01.01-bbb-fb
Since you are likely to be building this along with AOSP, I suggest using the Android cross compiler from prebuilts, but probably any recent arm eabi toolchain will do. If you have sourced build/envsetup.sh and selected the lunch combo the path will be set up already. If not, set it now, substituting ${AOSP} with the place where you installed your AOSP. I used Android 4.3, which has gcc v4.7:
$ PATH=${AOSP}/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin:$PATH
Then configure and build U-Boot:
$ make CROSS_COMPILE=arm-eabi- distclean
$ make CROSS_COMPILE=arm-eabi- am335x_evm_config
$ make CROSS_COMPILE=arm-eabi-
This produces the two files: MLO and u-boot.img which you can use to create a bootable SD card as shown above
I have a training course that will help you: Embedded Android https://2net.co.uk/training/embedded-android