Cross-Compiler / Toolchain erstellen

Das Erstellen eines Cross-Compilers ist mit Freetz denkbar einfach:

  1. make menuconfig Hier unter Advanced options → Compiler options die Optionen für den Cross-Compiler wählen. Soll der Compiler Programme für eine mit Freetz erzeugte Firmware kompilieren, so ist in der Regel nichts zu ändern. Soll der Compiler hingegen für eine originale Firmware kompilieren können, so solltest du bei “uClibc config” die entsprechende Konfiguration auswählen.

    ACHTUNG: Im zweiten Fall sollte diese entpackte Instanz von Freetz nicht mehr zum Erstellen von Images verwendet werden, sondern nur noch der Cross-Compiler selbst.

  2. Benötigt wird gcc, binutils, make, bison, flex und texinfo: make toolchain
    Eine ganze Weile und ca 2 GB später wurden zwei Cross-Compiler erstellt:
    • ./toolchain/kernel/bin/*-unknown-linux-gnu-gcc : Cross-Compiler für die Kernel Sourcen
    • ./toolchain/target/bin/*-linux-uclibc-gcc : Cross-Compiler für Userspace Programme
  3. make libs Erstellt alle im menuconfig ausgewählten Libraries und installiert deren Header.

Eigene Download-Toolchain erstellen

Aus und seit Changeset r9983:

From now on one can build his own toolchains and use them as download toolchains by overriding the corresponding options under “Override options/Override precompiled toolchain options”:

  1. activate “Toolchain options/Build own toolchains”
  2. set toolchain related options to the desired ones under “Toolchain options”
  3. (optional) make your own modifications under $(freetz_root)/toolchain
  4. call “make KTV=freetz-${MY_VERSION}-${MY_SUFFIX} TTV=freetz-${MY_VERSION}-${MY_SUFFIX} toolchain”
  5. wait the build to complete
  6. (optional) upload created download toolchain files to some site

The toolchains created in steps above can then be reused:

  1. activate “Toolchain options/Download and use precompiled toolchains”
  2. activate “Override options/Override precompiled toolchain options”
  3. set version/suffix/md5/download-site values to the values used in the steps above
  4. adjust gcc/uClibc versions under “Toolchain options”, set them to the same values as in step 2

Target/Native-Compiler-Toolchain erstellen

Some times it is easier to use a native development tools and compiler on the FritzBox directly by calling ./configure and build dependent libraries, test the according binaries directly on the box and find out configure options for packages which do not work for cross-compiling. Compiling can already be done for an 7270 box, performance-wise.

There are some general pre-requisite to meet:

Now you have only to create the according target compiler and libraries

This is already enough for writing and testing hello world programs.

Using the linux configure mechanism on the box needs some further things to do

There you are, now configuring and making perl or other complex linux packages from source should be fine.

Using the dev-tools package to install compiler and tools