Cross Compile (Ubuntu 12.04) - FREEDM-DGI/FREEDM GitHub Wiki

This article is for Ubuntu 12.04 LTS

Before you start!

Do not install the Ubuntu boost package (libboost-all-dev) on the machine you are cross-compiling on. It makes all sorts of strange things happen.

If you did install it, you can remove it by doing

sudo apt-get remove libboost-all-dev
sudo apt-get autoremove

You can have the same version of boost installed from source: you just can't have the Ubuntu package installed or things get crazy.

Overview of Procedure

  • Install packages
  • Build Crosstool
  • Download Boost 1.49
  • Build Boost
  • Get FREEDM source
  • Build FREEDM
  • Transfer to target.

Install Required Packages

sudo apt-get install flex bison automake libtool ncurses-dev texinfo lzma
sudo apt-get install gawk cvs patch g++ gpref subversion

Installing Crosstool-ng

Crosstool can be downloaded from their website. This guide is for version 1.19.0

Extract the downloaded package:

tar xjvf crosstool-ng-1.19.0.tar.bz2

Then, make crosstool-ng.

cd crosstool-ng-1.19.0
./configure
make
sudo make install

Configuring Crosstool & Building Compilers

Download a copy of the source for the TS7800 folder from this link. For my convience, I will refer to this tarball at 2.6.34.tar.gz. I recommend renaming it to match.

  1. make a ts7800 folder in your home directory. This will serve as the staging area for building the cross compiler. Collecting everything takes about 3.5GB, so keep that in mind.
  2. Put the 2.6.34.tar.gz file (the source tarball for the TS-7800 kernel) in this folder.
  3. Invoke ct-ng menuconfig from inside the ts7800 folder.
  4. Go into the Paths and Misc options menu and select "Try features marked as EXPERIMENTAL"
  5. Go back to the main menu and then into the Target Options menu. Confirm the following settings
    • Target architecture is arm
    • Endianness is Little Endian
    • the Bitness is 32-bit
    • Use EABI is selected
    • Set the architecture Level to be armv5t
    • Select the line that says "Floating Point (hardware)" and select to software.
  6. Operating System Menu
    • Target OS should be set to linux.
    • Select the linux kernel version menu, then scroll to the bottom and choose "Custom Tarball or Directory" enter the path to the 2.6.34.tar.gz file (should be /home/xxxx/ts7800/2.6.34.tar.gz)
    • Select build shared libraries
    • Check installed headers.
  7. Go into the binary utilities menu.
    • Select binutils version 2.22
  8. Go into the C compiler menu
    • Select GCC version 4.5.3
    • Select C++ as an additional language
  9. Go into the C-Libray menu
    • Select glibc version 2.13
  10. Go into Companion libraries (NEW)
    • Set GMP version to 5.0.2
    • Set MPFR Version to 3.1.0
    • Set PPL version to 0.11.2
    • Set CLooG/ppl version to 0.15.11
    • set MPC version to 0.9
    • If available set libelf version to 0.8.13
  11. Exit and save the configuration. Build to toolchain by invoking ct-ng build This part takes awhile.
  12. Unless you changed the prefix from ${HOME}/x-tool/${CT_TARGET} you should add ${HOME}/x-tools/arm-unknown-linux-gnueabi/bin/ to your PATH. You can do this for one session by doing export PATH=$PATH:${HOME}/x-tools/arm-unknown-linux-gnueabi/bin/ adding this to .bashrc or similar will make it permanent.

Building Boost

You can now resume following the original tutorial at Building Boost