Recent Changes - Search:



Deprecated

Software

Prev Edit this page to change styles

--- Boxes and outlines ---

--- Headers beyond ordinary "!" level headers

--- Stegi specific stylings ---

--- Text warnings, notices, hilights ---

--- Directory paths ---

--- Calendar specific ---

BeagleBox: Embedded distribution for BeagleBoards - Bx/Cx, xM, BeagleBone

Note: Currently, this only support the C4. I intended to integrate information for the other models as I come across it. I don't actually have the other boards (at least not yet) so it's harder to validate the information for them.

Repositories and External Information

The information on this page describes how to compile and create your own software distribution for a BeagleBoard. It forms the basis for the BeagleBox build system.

Basic System Build Process

  1. Configure the shell environment
  2. Build or acquire a toolchain
  3. Build the 1st and 2nd stage bootloaders
  4. Build a Linux kernel, its associated driver modules and required firmware
  5. Builds the SGX packages
  6. Build a root file system
  7. Copy SGX files to root file system
  8. Copy driver modules to root file system
  9. Copy firmware files to root file system
  10. Format an SD card with FAT16 and ext2 partition
  11. Copy bootloaders, configuration files and kernel image to first SD partition
  12. Copy rootfs to second SD partition
  13. Boot the board with the SD card

Build System Basics

To use the build system, you should load the cdtools shell function.

Configure environment for BeagleBox builds
cp docs/bashsetup.sh ~/bin/env/bb
vi ~/bin/env/bb
<edit lines as appropriate>
source ~/bin/env/bb
rpi

If you don't already have the source tree cloned then you can grab the shell function directly from gitorious' raw blob data.

To get help with the build system and the many available targets, use the help target

Configure environment for BeagleBox builds
make help

All software components have identical (or nearly identical) sets of targets of the following format.

Configure environment for BeagleBox builds
make <component>
make <component>-pkg
make <component>-clean
make <component>-clobber

Build system prerequisites

BeagleBox is designed to be built on Linux systems. It is not supported on Windows, Cygwin or Macs. *BSD users can contact me about adding support for their platforms.

Linux Distribution Version Status Prerequisites
Fedora 16 Working

Configure the following repositories:

  • RPMFusion

Required package groups

  • Development Tools
  • Development Libraries

Other Packages

  • gperf texinfo glibc-static redhat-lsb perl-Switch libstdc++-static
CentOS 6.3 Working

Configure the following repositories:

  • EPEL (See RPMFusion site)
  • RPMFusion

Required package groups

  • Development Tools
  • Development Libraries

Other Packages

  • gperf texinfo glibc-static redhat-lsb perl-Switch libstdc++-devel
Ubuntu 12.10 Working

Other packages

  • build-essential git bison flex gperf texinfo libtool automake ncurses-dev gawk libexpat-dev python-dev gettext subversion cmake

Notes

  1. installation of gawk may cause issues with system scripts that use mawk. Fix this with
    sudo update-alternatives --config awk
  2. You must have /bin/sh point to /bin/bash, not the default shell (dash). Use this command:
    sudo dpkg-reconfigure dash


If you plan on using BeagleBox as the core platform for XBMCBox, you're build system should be a 32bit platform. Building BeagleBox on a 64bit system and then building XBMCBox to use with it will fail because Python dependencies in XBMC require the build system to have the same bitness as the target system (the OMAP processors of the BeagleBoard line, which is 32bit).

Cross Toolchain

You can use available toolchains such as CodeSourcery's. However, if you want to build your own, using tools such as Crosstool-NG, you should note the following.

  1. Architecture Level: arm
  2. Endianess: Little Endian
  3. Bitness: 32-bit
  4. Architecture-Level: armv7-a
  5. Emit Assembly for: cortex-a8
  6. Tune for: cortex-a9
  7. FPU: softfp
  8. Use MMU: yes
  9. Kernel: 3.2.16
  10. Binutils version: 2.21.1a
  11. GCC version: Linaro 4-7-2012.07
  12. GCC core extra config: --with-fpu=neon --with-float=softfp
  13. GCC extra config: --with-fpu=neon --with-float=softfp

BeagleBox currently uses Crosstool-NG version: 0.15.2

Notes on configuration:

  1. FPU: BeagleBoard supports hardfp but current releases of the SGX libraries only support softfp. If you will be using SGX and you're version of SGX supports hardfp, then set FPU to hardfp.

Which libc you choose for your toolchain is a personal matter. I'm using glibc as opposed to uClibc due to some applications that are sometimes difficult to compile with the latter, such as Connman. I'm using glibc 2.13.

To build with BeagleBox:

Build BeagleBox cross toolchain and install it
make xcc
make xcc-pkg
cdp
sudo rpm -ivh beagleboxToolchain*

Be sure to source the shell function script under docs before running any BeagleBox builds:

 vi docs/bashsetup.sh
 <edit lines as appropriate>
 source docs/bashsetup.sh
 rpi

Also, building the RPM is not required, but recommended if you plan on doing any application development outside of the BeagleBox tree.

The current configuration for the build process can be viewed by using the -showconfig target, as in the following example:

$ make xcc-showconfig
###  2012-11-05 08:21:54 PM Common Configuration
Components           : xcc uClibc uboot kernel busybox sgx buildroot qemu pkg opkg
Packaged Components  : uboot kernel buildroot
ARCH                 : arm
HW                   : beagleboard
SRCDIR               : /home/mjhammel/src/ximba/bb/src/src
ARCDIR               : /home/mjhammel/src/ximba/bb/src/../archive
BLDDIR               : /home/mjhammel/src/ximba/bb/src/../bld
CROSS_COMPILER       : arm-unknown-linux-gnueabi-
XCC_PREFIXDIR        : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install
XCC_PREFIX           : arm-unknown-linux-gnueabi
U-Boot config (USRC) : uboot-org
Kernel config (KSRC) : kernel-org
###  2012-11-05 08:21:54 PM XCC Configurable options
XC            : xcc.beagleboard.1.15.2
UC            : uClibc.beagleboard
XI            :
###  2012-11-05 08:21:54 PM XCC static settings
XCC_VERSION   : crosstool-ng-1.15.2
XCC_PKG_NAME  : crosstool-ng-1.15.2.tar.bz2
XCC_URL       : http://ymorin.is-a-geek.org/download/crosstool-ng/
XCC_JZ        : j
DIR_XCC       : /home/mjhammel/src/ximba/bb/src/src/xcc
DIR_PATCH     : /home/mjhammel/src/ximba/bb/src/src/xcc/patches/beagleboard.1.15.2
XCC_SRCDIR    : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2
XCC_CTNGDIR   : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.ctng
XCC_BLDDIR    : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld
XCC_PREFIXDIR : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install
XCC_WORKDIR   : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/work
XCC_ARCDIR    : /home/mjhammel/src/ximba/bb/src/../archive
XCC_BINDIR    : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/bin
XCC_CONFIG    : /home/mjhammel/src/ximba/bb/src/src/xcc/xcc.beagleboard.1.15.2
XCC_PATH      : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/bin:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin:/home/mjhammel/bin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin
XCC_PREFIX    : arm-unknown-linux-gnueabi
PKGPRJ        : beaglebox

Verification

Check your cross compiler configuration:

Check your cross compiler configuration
$ /opt/beagleboxTC/bin/arm-unknown-linux-gnueabi-gcc --version --verbose
Using built-in specs.
COLLECT_GCC=/opt/beagleboxTC/bin/arm-unknown-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/beagleboxTC/bin/../libexec/gcc/arm-unknown-linux-gnueabi/4.6.4/lto-wrapper
arm-unknown-linux-gnueabi-gcc (crosstool-NG 1.15.2 - BeagleBox 0.6.0) 4.6.4 20120402 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Target: arm-unknown-linux-gnueabi
Configured with: /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/work/src/gcc-linaro-4.6-2012.04/configur
e --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=arm-unknown-linux-gnueabi --pref
ix=/home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install --with-sysroot=/home/mjhammel/src/ximba/bb/src
/../bld/crosstool-ng-1.15.2.bld/install/arm-unknown-linux-gnueabi/sysroot --enable-languages=c,c++ --with-arch=armv7-a -
-with-cpu=cortex-a8 --with-tune=cortex-a9 --with-fpu=neon --with-float=softfp --with-pkgversion='crosstool-NG 1.15.2 - B
eagleBox 0.6.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/home/mjhammel/
src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gnueabi/buildtools --with-mpfr=/home/mjhammel/src
/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gnueabi/buildtools --with-mpc=/home/mjhammel/src/xim
ba/bb/src/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gnueabi/buildtools --with-ppl=/home/mjhammel/src/ximba/b
b/src/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gnueabi/buildtools --with-cloog=/home/mjhammel/src/ximba/bb/
src/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gnueabi/buildtools --with-libelf=/home/mjhammel/src/ximba/bb/s
rc/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gnueabi/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-B
static,-lstdc++,-Bdynamic -lm -L/home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/work/arm-unknown-linux-gn
ueabi/buildtools/lib -lpwl' --enable-threads=posix --enable-target-optspace --disable-nls --disable-multilib --with-loca
l-prefix=/home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/arm-unknown-linux-gnueabi/sysroot --enab
le-c99 --enable-long-long --with-fpu=neon --with-float=softfp
Thread model: posix

And then test the compiler by building the following Hello World example, copying it to the rootfs of an existing distribution (such as Raspbian) and running it.

Hello World test program
#include <stdio.h>
int main() { printf("Hello, world!\n"); return 0; }
Compile test program
/opt/beagleboxTC/bin/arm-unknown-linux-gnueabi-gcc -o test test.c

Bootloader

The BeagleBoard uses a first stage bootloader called MLO. This bootloader is stored in flash memory on the board. It's purpose is to load the second stage bootloader, u-boot. MLO used to be a separate software package, but it has been replaced by the SPL image built by Das U-Boot, more commonly called u-boot. The default configuration is named omap3_beagle_config.

To build with BeagleBox:

Build BeagleBox bootloaders
make XI=/opt/beagleboxTC uboot
make XI=/opt/beagleboxTC uboot-pkg

Package file will be stored in the package directory.

The current configuration for the build process can be viewed by using the -showconfig target, as in the following example:

$ make uboot-showconfig
###  2012-11-05 08:22:54 PM Common Configuration
Components           : xcc uClibc uboot kernel busybox sgx buildroot qemu pkg opkg
Packaged Components  : uboot kernel buildroot
ARCH                 : arm
HW                   : beagleboard
SRCDIR               : /home/mjhammel/src/ximba/bb/src/src
ARCDIR               : /home/mjhammel/src/ximba/bb/src/../archive
BLDDIR               : /home/mjhammel/src/ximba/bb/src/../bld
CROSS_COMPILER       : arm-unknown-linux-gnueabi-
XCC_PREFIXDIR        : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install
XCC_PREFIX           : arm-unknown-linux-gnueabi
U-Boot config (USRC) : uboot-org
Kernel config (KSRC) : kernel-org
###  2012-11-05 08:22:54 PM U-Boot Common Configuration
Available configs:  org
UBOOT_PATH       : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/bin:/home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/usr/bin:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin:/home/mjhammel/bin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin
UBOOT_SCRIPT     : /home/mjhammel/src/ximba/bb/src/src/uboot/bootscripts/boot-sd.txt
###  2012-11-05 08:22:54 PM U-Boot Configuration for org
UBOOT_CONFIG_SUFFIX: org
UBOOT_URL          : git://git.denx.de/u-boot.git
UBOOT_BRANCH       : v2011.09
DIR_UBOOT          : /home/mjhammel/src/ximba/bb/src/src/uboot
UBOOT_SRCDIR       : /home/mjhammel/src/ximba/bb/src/../bld/uboot-org
UBOOT_BLDDIR       : /home/mjhammel/src/ximba/bb/src/../bld/uboot-org.bld
UBOOT_ARCDIR       : /home/mjhammel/src/ximba/bb/src/../archive/uboot
UBOOT_DIR          : /home/mjhammel/src/ximba/bb/src/../bld/uboot-org
MKIMAGE            : /home/mjhammel/src/ximba/bb/src/../bld/uboot-org/tools/mkimage
UBOOT_CLONEDIR     : uboot-org
UBOOT_CONFIG       : omap3_beagle.h
UBOOT_CONFIG_SRC   : omap3_beagle.h-org
UBOOT_PATH         : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/bin:/home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/usr/bin:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin:/home/mjhammel/bin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin
UBOOT_XCC          : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.ctng
REPOSITORY         : DENX.DE

Kernel

The Linux kernel used on BeagleBoard often comes from a variety of sources. BeagleBox tries to track the Linux kernel mainline tree without patches as much as possible, but also keeps an eye on Robert Nelson's kernel tree. The current kernel version used in BeagleBox is 3.2.30.

The BeagleBox build supports building from the following sources.

  • kernel.org mainline releases
  • git.kernel.org
  • Arago's linux-omap3 git tree
  • linux-omap-dss2 from gitorious.org

The default is kernel.org mainline.

The kernel configuration required can be retrieved by booting any existing distribution for the BeagleBoard and copying the output from

   cat /proc/config.gz

to a file that you can integrate into your own kernel build. Note that not every distribution is required to have /proc/config.gz. An alternative is to use the omap2plus_defconfig configuration for the BeagleBoard Bx/Cx boards and build up your own configuration from there. BeagleBoard xM and BeagleBone have different default configuration files.

After the kernel build completes, you'll need to copy the kernel image to your SD card. The source image to use in this copy is

    <linux source tree>/arch/arm/boot/uImage

This file must be copied to the first partition on the SD card.

To build with BeagleBox:

Build BeagleBox kernel
make XI=/opt/beagleboxTC kernel
make XI=/opt/beagleboxTC kernel-pkg

The -pkg target will copy the kernel image file into the package directory (see cdp in the bashsetup.sh).

The current configuration for the build process can be viewed by using the -showconfig target, as in the following example:

$ make kernel-showconfig
###  2012-11-05 08:36:28 PM Common Configuration
Components           : xcc uClibc uboot kernel busybox sgx buildroot qemu pkg opkg
Packaged Components  : uboot kernel buildroot
ARCH                 : arm
HW                   : beagleboard
SRCDIR               : /home/mjhammel/src/ximba/bb/src/src
ARCDIR               : /home/mjhammel/src/ximba/bb/src/../archive
BLDDIR               : /home/mjhammel/src/ximba/bb/src/../bld
CROSS_COMPILER       : arm-unknown-linux-gnueabi-
XCC_PREFIXDIR        : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install
XCC_PREFIX           : arm-unknown-linux-gnueabi
U-Boot config (USRC) : uboot-org
Kernel config (KSRC) : kernel-org
###  2012-11-05 08:36:28 PM Kernel Common Configuration
Available configs:  org git qemu gitorious arago
KERNEL_PROTOCOL  : http
SGX              : 0
###  2012-11-05 08:36:28 PM Kernel Configuration for org
LINUX_PREFIX     :
LINUX_VERSION    : linux-3.2.30
KERNEL_URL       : http://www.kernel.org/pub/linux/kernel/v3.x/
KERNEL_VERSION   : linux-3.2.30
KERNEL_PKG       : linux-3.2.30.tar.bz2
KERNEL_GIT_ID    :
DIR_KERNEL       : /home/mjhammel/src/ximba/bb/src/src/kernel
KERNEL_SRCDIR    : /home/mjhammel/src/ximba/bb/src/../bld/linux-3.2.30
KERNEL_ARCDIR    : /home/mjhammel/src/ximba/bb/src/../archive/kernel
KERNEL_PATCH_DIR : /home/mjhammel/src/ximba/bb/src/src/kernel/patches/linux-3.2.30
KERNEL_CONFIG    : /home/mjhammel/src/ximba/bb/src/src/kernel/linux-3.2.30.cfg
KERNEL_DEFCONFIG : omap2plus_defconfig
KERNEL_TARGET    : uImage
KERNEL_IMAGE     : uImage
KERNEL_PATH      : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install/bin:/home/mjhammel/src/ximba/bb/src/../bld/uboot-org/tools:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin:/home/mjhammel/bin:/home/mjhammel/bin:/usr/local/bin:/sbin:/usr/sbin

Root File System

The root file system is the collection of files and directories that make up your runtime system. Generally speaking, any root file system can be used for Raspberry Pi as long as it was generated using the same cross toolchain. To build your own, try BusyBox and/or Buildroot.

BeagleBox's Buildroot configuration is designed specifically around building the root file system. It does not use Buildroot to build the cross toolchain or the Linux kernel (although Buildroot can do handle these components as well). The structure and contents of the root file system is specifically targeted at media services, so it contains libraries and files that would be helpful on systems supporting multimedia playback.

To build with BeagleBox:

Build BeagleBox root file system
make XI=/opt/beagleboxTC buildroot
make XI=/opt/beagleboxTC buildroot-pkg

The -pkg target will copy the kernel image file into the package directory (see cdp in the bashsetup.sh).

The current configuration for the build process can be viewed by using the -showconfig target, as in the following example:

$ make buildroot-showconfig
###  2012-11-06 03:53:28 PM Common Configuration
Components           : xcc uClibc uboot kernel busybox sgx buildroot qemu pkg opkg
Packaged Components  : uboot kernel buildroot
ARCH                 : arm
HW                   : beagleboard
SRCDIR               : /home/mjhammel/src/ximba/bb/src/src
ARCDIR               : /home/mjhammel/src/ximba/bb/src/../archive
BLDDIR               : /home/mjhammel/src/ximba/bb/src/../bld
CROSS_COMPILER       : arm-unknown-linux-gnueabi-
XCC_PREFIXDIR        : /home/mjhammel/src/ximba/bb/src/../bld/crosstool-ng-1.15.2.bld/install
XCC_PREFIX           : arm-unknown-linux-gnueabi
U-Boot config (USRC) : uboot-org
Kernel config (KSRC) : kernel-org
###  2012-11-06 03:53:27 PM Buildroot Configuration
SGX                     : 0
BUILDROOT_RELEASE       : 2012.05
BUILDROOT_VERSION       : buildroot-2012.05
BUILDROOT_PKG_NAME      : buildroot-2012.05.tar.bz2
BUILDROOT_URL           : http://buildroot.uclibc.org/downloads
BUILDROOT_JZ            : j
DIR_BUILDROOT           : /home/mjhammel/src/ximba/bb/src/src/buildroot
BUILDROOT_SRCDIR        : /home/mjhammel/src/ximba/bb/src/../bld/buildroot-2012.05
BUILDROOT_BLDDIR        : /home/mjhammel/src/ximba/bb/src/../bld/buildroot-2012.05.bld
BUILDROOT_ARCDIR        : /home/mjhammel/src/ximba/bb/src/../archive/buildroot
BUILDROOT_CONFIG        : /home/mjhammel/src/ximba/bb/src/src/buildroot/buildroot.cfg.2012.05
BUILDROOT_SKELETON      : /home/mjhammel/src/ximba/bb/src/src/buildroot/skeleton
BUILDROOT_BUSYBOX_CONFIG: /home/mjhammel/src/ximba/bb/src/src/busybox/busybox.cfg.1.20.1
MKIMAGE                 : /home/mjhammel/src/ximba/bb/src/../bld/uboot-org/tools/mkimage

SGX

TBD

DSP

TBD

SD Card format

The minimum requirements for the BeagleBoard SD card are as follows:

  1. First partition: FAT16 or FAT32
  2. Second partition: root file system (format depends on what the Linux kernel is configured to support, but EXT2 recommended to avoid journaling issues which can reduce the lifespan of the SD card).

First partition contents

  • MLO
  • boot.scr and/or uEnv.txt
  • u-boot.bin
  • uImage.bin

Notes:

  • The .bin suffixes are not required. They are defined by the boot.scr and/or uEnv.txt files read by u-boot at boot time.
  • uImage.bin is a kernel image that is generated from the kernel's compressed zImage using u-boot's mkimage utility.

Building SD card with BeagleBox

Be sure to have your SD card installed in an SD card slot. I use USB adapters with SD card readers, which makes the SD card show up as device /dev/sdb<1 or 2> or /dev/sdc<1 or 2>. Other systems with built in SD card readers may show the device as /dev/mmcblk0p<1 or 2>.

Build BeagleBox SD Card
make pkg-scripts
cdp
sudo ./mksd /dev/<sd device>
sudo mkdir -p /media/boot
sudo mount /dev/<sd device partition 2> /media/boot
sudo ./mkinstall -b /media/boot -d /dev/<sd device partition 2>
Edit - History - Print - Recent Changes - Search
Page last modified on February 14, 2013, at 10:42 AM