The Build Process

This section describes the steps that the HitchHiker build tree takes when building itself from source. Note that this is not a list of the commands that must be run by the user, those are actually quite simple. Rather, this page is here because it is both useful and reasshuring to understand what is being done when one does run the commands.

It is expected that certain programs are available on the host system, ie the system that HitchHiker is being built on. In the case that certain programs do not exist, those programs are compiled in the 'bootstrap' portion of the build. HitchHiker puposely keeps this part light and prefers to use the native tools of the host.

In the second half of the bootstrap phase, a sysroot compiler and linker is built and installed under /toolchain. This toolchain may or may not be a cross toolchain, but in either case is of the same version of gcc and binutils as are to be used in the finished system and are built in such a way that they search for headers and libraries under /src/build rather than /.

In the case that we are compiling for an architecture that is different than the one which is being used to build the system, this toolchain is what is known as a cross toolchain. What this means is that the compiler and linker run on our build machine (the machine performing the build) but produce machine code that runs on our host machine (the machine the finished system will in fact run on).

The actual build of the sysroot compiler takes place in several steps:

  1. The binutils package, which contains our linker and assembler.
  2. A temporary and minimally capable gcc compiler is built, which is only capable of building our C library.
  3. The linux kernel headers are installed into our sysroot.
  4. The temporary gcc and binutils built in step 1 are used to build glibc, which is installed into our sysroot.
  5. The final sysroot gcc compiler is built, which is a fully capable C and C++ compiler for our final system.

We then use the toolchain and bootstrap tools that we have built to compile the rest of the final system and install it into our sysroot.