Building a Linux cross toolchain
Par Mikeul, Friday 17 June 2005 à 09:04 :: Linux :: #11 :: rss
A very common need during an embedded projet development is to have the set of tools required to compile program for a platform different from the one used for the development itself.
This tool set is known as a cross development toolchain.
Of course, you can use both the available commercial/free pre-compiled toolchains, but you may choose to roll your own...
The toolchain is made up of several packages:
- the kernel headers
- the binutils package, that contains the assembler, the linker and binary handling tools
- the glibc package, containing among other things the standard C library used by all programs
- the gcc (Gnu Compiler Collection) package, at least to provide the C compiler
These packages are not easy to build, as they have cross-dependencies (best known as the "chicken and egg" problem ): in order to compile the C compiler, you need the C library, which in turn requires a C compiler to compile...
Fortunately, the way out of this devil's circle is to build an intermediate limited bootstrap compiler that do not require the full C library, build the C library, then rebuild the full C compiler itself.
As you can see, this is far from a trivial task, and it explains why this is still considered as a complex task.
One usefull tool if you wan to build your own cross-compiling toolchains is the crosstool project, which aims at creating a Shell script that does exactly that.
My only regret is that it is a monolithic Shell script: I would rather have a set of separate Makefile rules... Also, it does not take into consideration building a cross toolchain with the µClibc as a replacement for the (huge) GNU C library.
Commentaires
Aucun commentaire pour le moment.
Ajouter un commentaire
Les commentaires pour ce billet sont fermés.