Beaglebone black USB boot

Booting the Beaglebone black from USB

In the past I was under the impression that booting from USB on the Beaglebone black was not possible. Where I picked up this impression, I am not sure, but I thought it was from a couple of beagleboard google group messages by two separate people. Needless to say, it seems I was either remembering wrongly, support has since changed, or the two people I was thinking of were both wrong. Looking back now, I figure the first possibility is probably most likely the case. Perhaps even the second case. Whichever case is true, I do now know that booting from a USB hard drive is possible. Which means that it is very likely that booting from a USB flash memory stick is also very likely. However for my own purposes, booting from a flash memory stick makes far less sense, and as such will not be covered here.

With the above said, I feel compelled to say that without the help of Alexander Holler from the freenode #beagle IRC channel: I would not have realized this was possible. Alexander assured me that USB boot was in fact possible, and has been possible for the last couple of years. Alexander even provided me with a nearly complete / working uEnv.txt file, that I only had to slightly modify for my own purposes to get working. Now, looking back I feel a bit silly I did not realize this on my own. Since an mmc device uses the same u-boot environment variables. Hind-sight is usually 20/20 though . . .


Having been struggling for the last few days on how to write up this blog post. I have decided to keep things simple for myself. With that said, and in the context of the Beaglebone black, we only need a few things. Be sure to read these guidelines fully before proceeding however.

Requirement – MMC media

An SD card, or the on-board eMMC with the MLO, u-boot.img, and uEnv.txt files on the first partition. This partition should be marked boot-able, and of type vfat. This step, is necessary so the Beaglebone black knows where to boot from. Technically, you should be able to get MLO, and u-boot.img from any working boot media. Such as from the on-board eMMC, or for example by following Robert C. Nelson’s instructions. Of course we are not limited to just these two options. We should be able to strip these files from any working Linux media. So long as that media is meant for the Beaglebone black, and we stay consistent. uEnv.txt we should create on a use by use basis. This will be covered later.

Requirement – USB hard drive

A USB hard drive that is self powered( can not be USB powered only ), that contains a kernel image, the root file system, and the am335x-boneblack.dtb device tree file. Again, the kernel image file, and root file system ( also known as rootfs ), can be taken from any known working media meant for the Beaglebone black. Also, it would behoove us to make sure both the kernel image, and rootfs are consistent with where we got our MLO, and u-boot.img files. That is to say, we do not want to mix files from one boot / rootfs media, with another. Further, as far as I know, the Linux image file must be of type uImage. With the correct tools however, we should be able to convert any zImage kernel image into an uImage kernel image. am335x-boneblack.dtb I believe to be mostly neutral, although I suppose the file could change from time to time.

A working example

Setting up the USB HDD was relatively easy, but did give me pause for thought for a few minutes. Once I thought this through, I started by partitioning, and formatting the USB drive. Of course after I made sure which drive my USB drive was.


sudo dd if=/dev/zero of=/dev/sdc bs=1024 count=1024
sudo parted –script /dev/sdc mklabel msdos

sudo fdisk /dev/sdc << __EOF__


sudo parted --script /dev/sdc set 1 boot on
sudo mkfs.ext4 /dev/sdc1 -L rootfs

Next I needed to move my existing netboot rootfs onto the USB drive.

sudo mkdir /media/rootfs
sudo mount /dev/sdc1 /media/rootfs/

cd ~/rootfs/

sudo tar -zcvf ~/rootfs.tar.gz .
sudo tar xzvf ~/rootfs.tar.gz -C /media/rootfs/

Finally I needed to edit fstab on the USB HDD.

sudo nano /media/rootfs/etc/fstab

A working SD card which was already setup from the net-boot installation I had. The only thing that needed modifying was uEnv.txt. This was easiest to do from the Beaglebone black while the SD card was inserted.

nano /boot/uboot/uEnv.txt

A few points of interest

I covered how to convert an zImage kernel image to an uImage kernel image in my Beaglebone Black Network boot post. In the interest of keeping things together, and hopefully clearer . . .

sudo mkimage -A arm -O linux -T kernel -C none -a 0×80008000 -e 0×80008000 -n “Linux” -d ./3.8.13-bone21.zImage ./uImage

is how I achieved this.

Also the files uImage, and am335x-boneblack.dtb were located in my ~/rootfs/boot/ sub-directory. As indicated by the uEnv.txt file above. Once the rootfs directory was copied / extracted onto the USB drive, these file were also included.

The files MLO, and u-boot.img were already on the first ( and only ) partition of the SD card.

Additionally if you wish to mount the SD card’s boot partition at boot time, you may wish to to add the following lines to the USB drive /etc/fstab file.

The directory /boot/uboot must exist on the USB drive for this to work correctly.

Finally, in order to boot off this USB device, insert the uSD card into the uSD card slot, plug the USB drive into the normal USB port, then power up the drive and finally the Beaglebone black. Assuming everything was done correctly ( and I did not miss any steps ), you should shortly be booted off your USB drive. Good luck, and happy beagling !