Setting up a cross-compilation toolchain

From SamyGO
Revision as of 20:58, 22 October 2009 by Marcelru (talk | contribs) (Created page with 'Actually, we are still in the testing phase, for now, check out the forum discussion (topic: cross-compilation []).…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Actually, we are still in the testing phase, for now, check out the forum discussion (topic: cross-compilation [1]).

Toolchains 101

A toolchain is a set of executable programs that enables you to build (assemble, compile and link) your own executable programs from source code (typically C, C++, fortran or other programming languages). To build these executables, the source code needs to be translated into machine-readable code. This is what a toolchain does. The translation proceeds in three steps (well, you may think of it this way): translation into low-level code (compilation), translation to machine-readable code (assembly), combination with other code libraries (linking). Compilation/assembly mostly proceeds in a single go. So, for a toolchain you need at least three programs: a compiler, an assembler, and a linker. In almost all cases you will also need a C-library to link with.

Unlike source code, executables are machine-specific. That means that executables built for the Intel x86 architecture (the basis for most computers in the world today) will not run on other types of processors, for example the ARM architecture, the basis for many embedded systems. Our Sammys are ARM-based machines. To build executables for a Samsung TV on an x86-based machine, you will need a toolchain that runs on the x86-architecture and builds executable code for the ARM-architecture. This procedure is called cross-compilation, and requires a cross compilation toolchain.

Samsung toolchain

The source code for the Samsung ARM toolchain is available on the net, but needs some adjustments before it can be built. We will discuss that later. The main parts are:

  • GNU binutils (containing among other things an assembler and a linker)
  • GCC, the GNU C/C++ compiler (and a host of other languages we will not use)
  • Glibc, the GNU C library
  • linux kernel sources, for operating system/processor specific details.

To be continued soon ...