The art of cross-compiling
Having a working cross toolchain is the starting point of a journey, not the end of it. At some point, you will want to begin cross-compiling the various tools, applications, and libraries that you need on your target. Many of them will be open source packages, each of which has its own method of compiling and its own peculiarities.
There are some common build systems, including the following:
- Pure makefiles, where the toolchain is usually controlled by the
make
variableCROSS_COMPILE
- The GNU build system known as Autotools
- CMake (https://cmake.org)
Both Autotools and makefiles are needed to build even a basic embedded Linux system. CMake is cross-platform and has seen increased adoption over the years especially among the C++ community. In this section, we will cover all three build tools.
Simple makefiles
Some important packages are very simple to cross-compile, including the Linux kernel, the U-Boot bootloader, and BusyBox...