For the last few months I have working in an environment which has required me to create Angstrom linux images for use on the Beaglebone Black. This post documents the procedure I have used to create a basic starting Angstrom Linux image on an SD-card.
I imagine this will be useful for those who prefer to use a source-based linux distribution on the Beaglebone white and black, targeting embedded use.
If you intend using the Beaglebone as a miniature, low-cost, arm personal computer it might be more convenient to stick with one of the many binary distributions, such as arch, emdebian, etc …
Angstrom Master Build
Master Branch: v2013.06-yocto1.4
This guide details the process of building a Angstrom linux console image from source on an Xubuntu 12.04.3 32-bit Linux host. Your computer must be connected to the Internet. The build will take a number of hours and more than 600 MB of data and source code will be downloaded.
The angstrom console image includes boot loader components, compressed kernel image, device tree and overlays, device drivers, udev, systemd, connman, ofono, ppp, busybox and some package management tools. It is a good starting point to evaluate Angstrom linux for use in embedded systems.
We need some host development tools:
sudo apt-get install sed wget cvs subversion git-core coreutils unzip texi2html texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath
/bin/sh (ls -l /bin/sh) is symbolically linked to dash. “dash” is a POSIX compliant shell that is much smaller than “bash”. Some broken shell scripts still make use of bash extensions while calling into /bin/sh. To work around this issue call “sudo dpkg-reconfigure dash” and select No when it asks you to install dash as /bin/sh.
Download Angstrom Distribution and Build
To download the master branch of the distribution and configure for the beaglebone (both white and black) , enter the following commands:
cd ~/Projects (or your preferred directory)
git clone git://github.com/Angstrom-distribution/setup-scripts.git
MACHINE=beaglebone ./oebb.sh config beaglebone
And to compile the console image:
The previous command creates the root file system archive, modules, kernel and boot files in the deployment directory (~/Projects/Angstrom/setup-scripts/deploy/eglibc/images/beaglebone):
Angstrom-console-image-eglibc-ipk-v2013.06-beaglebone.rootfs.tar.gz (the root filesystem)
Angstrom-console-image-eglibc-ipk-v2013.06-beaglebone.rootfs.tar.xz (the root filesystem)
MLO-beaglebone-2014.01 (first stage of the boot loader)
modules–3.8.13-r23z.2-beaglebone-20140116020947.tgz (device modules; the exact filename is dependent upon date)
u-boot-beaglebone-2014.01-r0.img (second stage of the boot loader)
zImage–3.8.13-r23z.2-beaglebone-20140116020947.bin (compressed kernel image; the exact filename is dependent upon date)
SD Card Creation
Installing on SD card.
Use the gnome disk utility application to create the partitions on a blank micro SD card and mount them.
Create DOS Partition with following:
Size: 4.000 MB
Then edit the DOS partition with the following:
Type: W95 FAT32 (LBA) (0x0c)
Bootable: Check this tickbox
Create a Linux partition to fill the rest of the SD card:
Size: 7.880 GB (for my 8 GB card)
Take Ownership of filesystem: Not checked
Encrypt underlying device: Not checked
Mount both partitions. The dos partition will be mounted at /media/boot and the Linux partition will be mounted at /media/rootfs
Copy the Angstrom distribution files to the SD card:
cp MLO-beaglebone-2014.01 /media/boot/MLO
cp u-boot-beaglebone-2014.01-r0.img /media/boot/u-boot.img
sudo tar zxv -C /media/rootfs -f Angstrom-console-image-eglibc-ipk-v2013.06-beaglebone.rootfs.tar.gz
sudo tar zxv -C /media/rootfs -f modules–3.8.13-r23z.2-beaglebone-20140116020947.tgz
The SD card now is ready for the Beaglebone. Unmount the partitions.
Of course it is possible to write a script to duplicate this procedure, if you want it.
When you power up the Beaglebone Black with the new SD card inserted, make sure you are holding down the boot switch for the first second or so. This ensure the boot loader components on the SD card are loaded and run in preference to the eMMC.
Make sure when the system boots for the first time to run:
A few comments
Unless there is a specific requirement, there is no need to include the kernel image or compiled device tree in the dos boot partition. The second stage of the boot loader u-boot.img will attempt to load the compressed kernel image from the boot directory in the ext4 partition. Also, I have no current need for a uEnv.txt file.
It is possible to include development tools in the image by modifying some of the image recipe files. I prefer to keep Angstrom as a source based distribution and not download binary packages.
There is quite a bit of on-going development with Angstrom and the underlying Yocto build system. Hopefully these changes will be available for use on the Beaglebone soon. The sample yocto project for Beaglebone is already using Kernel version 3.12. It is surprisingly functional.
An alternative is to use Yocto to create your own embedded linux distribution for the Beaglebone.