../
2016-05-31: The /* Programming Comments */ documents have moved, and will no longer be updated or maintained at this location! Please update your bookmarks: http://www.ccoderun.ca/programming/.

Summary

I received my first credit-card size Beagle Bone Black a few days ago. Took some digging, but I figured out how to install Ubuntu for ARM7 on it.

(Check out AdaFruit for their selection of Beagle Bone Black devices and accessories.)

I have since (November 2015) tested the latest images and steps from this document with the smaller (and less expensive) Beagle Bone Green, purchased from Seeed.

Setting it up

There are several Ubuntu solutions for these tiny computers, such as Ubuntu Snappy. But what I wanted was a normal Ubuntu device.

From elinux.org I found instructions for a "flasher image" put together by Robert C Nelson. The image is written to a micro SD card, and when the BBB or BBG boots up, it gets written to the eMMC.

Here is what you do:

Customization

Create some new SSH host keys:

sudo rm /etc/ssh/ssh_host_* sudo dpkg-reconfigure openssh-server

Create a new user account, and modify the default password:

sudo useradd --create-home --shell /bin/bash --user-group --groups sudo stephane sudo passwd stephane sudo passwd ubuntu

Customize the /etc/issue files:

sudo vi /etc/issue*

Configure the timezone (default is UTC):

sudo dpkg-reconfigure tzdata

Install NTP:

sudo apt-get update sudo apt-get install ntp

Change the default hostname:

sudo vi /etc/hostname /etc/hosts

Building on ARM

Like any normal Ubuntu device, turning it into a dev environment is relatively easy:

sudo apt-get install build-essential cmake subversion graphviz doxygen libboost-all-dev libboost-dev libssl-dev

The problem is that with the small amount of memory on the BBB, anything non-trivial will fail to compile with an out-of-memory error. Without wanting to start messing with cross-compiling, the problem may be mitigated by creating a swap file. For example:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576 sudo chown root:root /swapfile sudo chmod 0600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile

If the swap file needs to be maintained through a reboot, add this line to /etc/fstab:

/swapfile none swap sw 0 0

Cross compiling

The cross compilers needed to build for BBB can be installed easily:

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

However, this gets complicated quickly when dealing with 3rd-party libraries. You must link against the ARM7-HF libraries, not the ones normally installed in a x86/AMD64 environment.

I didn't have the time to figure this out quickly, which is why I chose the route of creating a swap file on the BBB (see above) and using the BBB as a development environment to compile the projects I needed.

I did eventually work out the details of cross-compiling for the ARM-7 BBB and BBG.

Last modified: 2016-03-31
Stéphane Charette, stephanecharette@gmail.com
../