Cross toolchains and build systems
Compling cross-toolchain for embedded system, say based on ARM or MIPS, is not so easy. Why reinvent the wheel and fight with compiler and libc versions mismatches? Please use the following script based tools which generate working cross toolchain:
- crosstool by Dan Kegel (http://kegel.com/crosstool) to build glibc based toolchain
- buildroot by Erik Andersen (http://buildroot.uclibc.org) to build uclibc based toolchain + filesystem
- openembedded (http://www.openembedded.org/) to build glibc based toolchain + filesystem
Crosstool:
Crosstool provides plain text *.dat files where one can easily specify required gcc, binutils and glibc versions. Here is an example of such dat file gcc-3.4.3-glibc-2.3.4.dat:
BINUTILS_DIR=binutils-2.15
GCC_DIR=gcc-3.4.3
GLIBC_DIR=glibc-2.3.4
LINUX_DIR=linux-2.6.8
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.4
Buildroot:
Buildroot uses modified kconfig utility (used in linux kernel) for parameters configuration almost the same as in linux - make menuconfig , make V=1, options are saved in .config file
Buildroot is more sophisticated because it provides a lot of recipes to build packages and as result a filesystem image. Plenty of options to select particular uclibc, bintuls, gcc, kernel version. Very easy to learn and add support for your custom board. To add your package you have to write down a simple your_package.mk file.
Openembedded:
OpenEmbedded is a full-featured development environment suited mostly for release of large repository base of packages. It uses bitbake build utility and monotone for version control. To add your package you have to write *.bb recipe. Quite slow overall operation because of using python (bitbake is written in Python and *.bb files are some kind of Python files). From my own impression it is too huge for everyday use: you have to download 120MB of monotone metadata comparing to 8M of buildroot source, setup bitbake, psycho - python’s interpreter accelerator, git - too much of setup work. Only recommended when you intend to make a distro with repository of ipk packages, most often such huge distribution is not needed, for example if you want just do board bring-up and make basic filesystem with some applications for demo purposes - better stick to buildroot in this case.