Skip to content
metropt edited this page Feb 18, 2013 · 6 revisions

Linux: Building and Packaging

This page describes the procedures for setting up a Linux machine to compile TauLabs software (GCS, firmware and complete packages).

Prerequisites

Make sure your package manager is up to date

sudo apt-get update

You'll need a host compiler (gcc/g++), build-related tools (make, patch, gdb) and wget for retrieving files from the Internet.

sudo apt-get install build-essential gdb wget debhelper

If you are running a 64-bit version of Ubuntu, you'll also need to install 32-bit compatibility libraries. You can tell if you have a 64-bit version by running this:

uname -m

If it says 'x86_64' then you have a 64-bit install and you need to run this:

sudo apt-get install ia32-libs

Creating a workspace directory

You'll need to chose a directory that will hold your entire workspace. The following instructions assume that you've chosen ~/code as the workspace directory. Your workspace directory can be anywhere but typically you will want to put it somewhere within your home directory for easier access.

Create the workspace directory:

mkdir -p ~/code

Change the current working directory to the workspace directory:

cd ~/code

From here this tutorial assume that your current working directory is ~/code.

Checkout Code

Learn more about git on its official website, the Git Community Online Book, and in the Git Internals book, which best explains how git works.

sudo apt-get install git-core git-doc gitk

Initial clone:

git clone git://github.com/TauLabs/TauLabs.git

Change current directory to ~/code/TauLabs:

cd ~/code/TauLabs

From here this tutorial will assume that your current working directory is ~/code/TauLabs.

To pull the latest changes:

git checkout next
git pull

Display information about your current workspace:

git status --short

or for a graphical history view:

gitk

Installing Build/Debug tools

From here, the top-level makefile in the source tree provides you with short-cuts to download, build, install and configure the remainder of the tools you'll require.

The steps in this section:

  • DO NOT require root (or sudo) permissions since they will be installing only into the ./downloads and ./tools directories within your workspace.
  • DO NOT require you to change your PATH environment variable since paths are all controlled by the Makefile during the build.

Installing these tools only within your workspace (rather than for the entire system) is a design goal. This provides two main features:

  • The tools in your workspace can evolve separately from the versions required by your distribution.
  • Installing tools for TauLabs does not destabilize any of the other tools already installed on your PC.

Installing the QT build tools

The QT tools are a required component for compiling and running the TauLabs software. The Makefile will automatically download and install the required version by running this command from the top of your workspace:

make qt_sdk_install

This will download the large QT installer, and will run it with all of the right defaults to install it into the "tools" directory within your workspace.

Note: You must accept all defaults to get the right things installed in the right place, except for the installation directory - enter the path as prompted by the install script. You don't have to let it run QT Creator at the end.

Installing Extra Dependencies Required by the GCS

Ubuntu 12.04 (Lucid) (and also Mint 12) Installation

Install development libraries and tools:

sudo apt-get install qt4-dev-tools libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev libusb-dev libphonon-dev

This may give a warning that there is no phonon backend, which can be ignored.

Mind needs libusb 1.0.0 instead of libusb 0.1

sudo apt-get install libusb-1.0-0-dev

The GCS software also depends on the Simple DirectMedia Layer (SDL) so you'll need to install the development versions of that set of libraries in order to build the GCS.

sudo apt-get install libsdl1.2-dev

The GCS also depends on JPEG libraries to render the tiles in the map widget.

sudo apt-get install libjpeg8

The GCS software depends on libudev so you'll need to install the development version of this library to pick up the header files.

sudo apt-get install libudev-dev

builing GCS

you can do make gcs or run make to get a list of possible targets to build. also make all will produce almost everything you ever need (or may not need)

before running, you would need to configure udev so you don't need to run as root.

sudo cp package/linux/deb_common/taulabs.udev /etc/udev/rules.d/99-taulabs.rules

running: build/ground/gcs/bin/taulabsgcs

ARM Cross-Compiler Toolchain

This step is only required if you plan to build new firmware for one of the flight controllers or modems. It might also come in handy if you want to test any modifications made to code shared between the GCS and the boards.

In order to produce binaries for the embedded ARM core in the STM32 SoC that is on the flight controller boards, you'll need a cross-compiler. We'll download and install a prebuilt cross-compiler into the "tools" directory of our development workspace.

Install ARM tools:

make arm_sdk_install

Android GCS Tools

This step is only required if you plan to build the TauLabs Android GCS app.

First, we need to install a java compiler and ant build tool. We use the default for your distribution:

sudo apt-get install default-jdk ant

Then, install the Android Development Kit (ADK) into the "tools" directory within your workspace:

make android_sdk_install
make android_sdk_update

If you run the following command you should see the target "Google Inc.:Google APIs:14" listed.

./tools/android-sdk-linux/tools/android list targets