BeagleBoard Ubuntu & DSP From Sources

From eLinux.org
Jump to: navigation, search


This page is under construction and will be ready on May 7, 2010

Introduction

The purpose of this page is to demonstrate how to build and run a DSP enabled (ARM EABI) Ubuntu distribution for the BeagleBoard. We will build two variants of the Ubuntu distribution: an xfce GUI-based version and a minimal console-based version. The following guidelines apply.

  • Build everything from sources when possible.
  • Be on the "bleeding edge", be it compilers, source code, whatever.

This page is not meant to duplicate any previous work and I will link to existing work whenever possible. I used the page BeagleBoardUbuntu that is hosted at this site as my main reference.

This page was written on a generic Intel Core2 running a fresh installation of 64-bit Xubuntu 10.04 Lucid Lynx. My BeagleBoard is a rev C3 version.

Please note that along the way, you will need to install any dependencies that are not present on your machine. This is a straightforward process. In cases where a script dies without warning due to a missing dependency, I will warn you ahead of time.

Compilers

We will need three cross-compilers for the OMAP 3530. We will use both the ARM GNU/LINUX and the ARM EABI versions of the latest GNU compiler collection from CodeSourcery for the ARM Cortex A8 general purpose microcontroller. We will use the latest TI C6000 Code Generation Tools for the C64x digital signal processor.

ARM Cross Compiler

CodeSourcery is one of the leading contributors to the ARM GCC cross-compiler. They regularly push their updates upstream for inclusion into the main branch. They provide a LITE version of their ARM GCC cross-compiler for free. They provide 32-bit binaries, but the sources are available. It would be an interesting project to compile 64-bit binaries, but we'll save that for another day.

Take care to install the two CodeSourcery versions into separate directories.

ARM GNU/LINUX

We will need the ARM GNU/LINUX cross-compiler to compile the kernel, modules, and user-space applications and libraries. At the time of this writing, the latest version is Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux. All previous versions are also available.

ARM EABI

We will need the ARM EABI cross-compiler to compile the U-Boot bootloader. At the time of this writing, the latest version is Sourcery G++ Lite 2010q1-188 for ARM EABI. All previous versions are also available.

Other Compilers

I have used two other cross compilers with good results. If you prefer, these will work too:

TI DSP Compiler

Good news for open source fans! On April 17, 2010, CodeSourcery announced that they are partnering with TI to create a C6000 GNU Toolchain.

CodeSourcery is working with Texas Instruments to port the GNU Toolchain to TI's C6000 family of processors.

TI's proprietary compiler has been in use for a long time and is the standard for C6000 DSPs. At the time of this writing, the latest version is C6000 Code Generation Tools v7.0.1. You will need to register with TI before you can access the downloads.


SD Card Boot

We will boot the Beagleboard from an SD card. A great tutorial exists and doesn't need any further explanation. I named my boot partition "boot" and my root file system partition "rootfs".


BootLoaders

The OMAP 3530 boots in three stages. The first stage is the ROM boot vector. This stage then jumps to the X-Loader that comes pre-installed in the onboard Flash memory. The X-Loader will then jump to a U-Boot bootloader that is installed in Flash or to a U-Boot bootloader that is on a properly configured SD card if present. The second and third stage bootloaders can be replaced or configured as needed.

X-Loader

I have not had a need to modify or replace the X-Loader that comes stock with the rev C3 BeagleBoard. The x-load-omap3 page will get you started if you choose to do so.

U-Boot

There are several U-Boot trees for the BeagleBoard. I chose to use the mainline tree from Denx because its support for the BeagleBoard is already included and works well enough.

A great example of how to build the omap3 branch of the mainline U-Boot can be found here. But there is a problem. The example indicates that we should use the ARM GNU/LINUX cross compiler. This may work with cross-compilers from other providers, but will fail when using the CodeSourcery cross-compiler. The CodeSourcery ARM EABI compiler works just fine.

git clone git://git.denx.de/u-boot.git u-boot-main
cd u-boot-main
git checkout --track -b omap3 origin/master

make CROSS_COMPILE=$(YOUR_PATH)/arm-none-eabi- distclean
make CROSS_COMPILE=$(YOUR_PATH)/arm-none-eabi- omap3_beagle_config
make CROSS_COMPILE=$(YOUR_PATH)/arm-none-eabi-

The advantage to building U-Boot this way is that you end up with a binary that was compiled for the Cortex A8.

The result is a u-boot.bin in the main directory. Copy this to the boot partition of your SD card.

U-Boot Parameters

Once booting from the SD card, I halt the auto-boot to the kernel and set these parameters. This only needs to be done once.

setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rootwait rootfstype=ext3'
setenv bootcmd 'mmc init 0; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000'


Build & Prepare the Kernel

Kernel Source

Using the recommendation found here, I have chosen to use the kernel source provided by the BeagleBoard Kernel project. They have several branches. In keeping with being on the "bleeding edge", I have chosen to use the 2.6-dev branch.

bzr branch lp:~beagleboard-kernel/+junk/2.6-dev
cd 2.6-dev
bzr merge

Build the Kernel

We will be using rootstock to build the root file system. In order to include the kernel, modules, and associated kernel headers into the root file system, rootstock requires that the kernel and associated files be bundled into a .deb package that is served from a webserver. The Ubuntu kernel has a facility for this, but it is spread among a couple of files. The following patch will modify the kernel.sh script to include support for .deb bundling.

--- build_kernel.sh.prev	2010-05-07 13:27:13.566813697 -0400
+++ build_kernel.sh	2010-05-07 15:09:53.216816791 -0400
@@ -112,6 +112,13 @@
 	cd ${DIR}
 }
 
+function make_deb {
+	cd ${DIR}/KERNEL/
+	fakeroot make ARCH=arm CROSS_COMPILE=${CC} KDEB_PKGVERSION=${BUILDREV}${DISTRO} deb-pkg
+	mv ${DIR}/*.deb ${DIR}/deploy/
+	cd ${DIR}
+}
+
 if [ -e ${DIR}/system.sh ]; then
 	. system.sh
 	. version.sh
@@ -134,6 +141,7 @@
 	make_menuconfig
 	make_uImage
 	make_modules
+	make_deb
 else
 	echo "The LINUX_GIT variable is not definted in system.sh"
 	echo "Follow the git clone directions in system.sh.sample"

You will need to copy the file "system.sh.sample" to "system.sh" and the modify it as follows.

--- system.sh.prev	2010-05-07 15:19:05.106817451 -0400
+++ system.sh	2010-05-07 14:19:04.566815012 -0400
@@ -9,19 +9,19 @@
 #Use CodeSourcery: http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite (GNU/Linux)
 #Just download and extract...
 
-CC=/OE/angstrom-dev/cross/armv7a/bin/arm-angstrom-linux-gnueabi-
+CC=$(YOUR_PATH)/arm-none-linux-gnueabi-
 
 #USE git for downloading source
 #To minimize bandwidth, clone this in a directory of your choice
-#git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git
+git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git
 
-#LINUX_GIT=~/git_repo/linux-2.6-stable
+LINUX_GIT=$(YOUR_KERNEL_SOURCE)/2.6-dev/linux-2.6-stable
 
 #Enable ability to do a full patch bisect
-#BISECT=1
+BISECT=1
 
 #Use with Caution, mount locations can change... This define's SD/MMC card mount location for load_uImage.sh script.
 #MMC=/dev/sde
 
 #For lucid we need a specific defconfig not compatible with squeeze/jaunty/karmic..
-#IS_LUCID=1
+IS_LUCID=1

Modify the file "patch.sh" to include support for DSP as follows.

--- patch.sh.prev	2010-05-07 15:13:25.286816453 -0400
+++ patch.sh	2010-05-07 13:23:16.036814263 -0400
@@ -116,7 +116,7 @@
 rcn
 dss2
 vfp
-#dsp
+dsp
 igep
 #clksource
 #spidev

Warning: You will need to ensure that the following apps & libraries are present or the script will die without warning:

  • mkimage
  • ccache
  • libncurses5
  • libncurses5-dev
  • git

To build the kernel, simply enter:

./build_kernel.sh

At the menuconfig stage, include the following changes:

System Type
TI OMAP Implementations
*Mailbox framework support
Turn off unused board types
Drivers
*DSP Bridge Driver



Userspace File System