|
| 1 | +# Bootstrapping an environment |
| 2 | + |
| 3 | +Bootstrapping is the process of creating an environment which allows the cross compilation of packages. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The following build steps are required for bootstrapping: |
| 10 | + |
| 11 | +| Package | Host triplet | Target triplet | Notes | |
| 12 | +|---------------------------------------------|--------------|----------------|-------------------------------------------------| |
| 13 | +| **binutils** | A | B | binutils stage 1, used to link by gcc stage 1 | |
| 14 | +| **gcc** (and **libgcc**) | A | B | gcc stage 1, used to compile the next step only | |
| 15 | +| **linux headers** | n/a | n/a | required by libc | |
| 16 | +| **musl** | B | n/a | libc, used by gcc stage 2 | |
| 17 | +| **zlib** | B | n/a | zlib, used by binutils stage 2 while running | |
| 18 | +| **libstdc++** | B | n/a | used by gcc stage 2, requires libc | |
| 19 | +| **binutils** | B | B | binutils stage 2 | |
| 20 | +| **gcc** (with **libgcc** and **libstdc++**) | B | B | gcc stage 2, used to cross-compile packages | |
| 21 | + |
| 22 | +> **Note**: one last compilation of gcc (stage 3) will be necessary for a final system, but it is treated as a casual package and not discussed here. |
| 23 | +
|
| 24 | +## Building |
| 25 | + |
| 26 | +First, the `sysroot` directory must be created: |
| 27 | +```sh |
| 28 | +mkdir sysroot/ |
| 29 | +``` |
| 30 | + |
| 31 | +Then, each package has to be built, in the order of the table above. |
| 32 | + |
| 33 | +The command to use for building a package is: |
| 34 | +```sh |
| 35 | +PATH="$(pwd)/sysroot/tools:$PATH" HOST=<host-triplet> TARGET=<target-triplet> blimp-builder --from desc/<pkg>/ --to sysroot/ |
| 36 | +``` |
| 37 | + |
| 38 | +Once this is done, the second **gcc** can be used to cross compile packages (autoconf, make, etc...) on the target. |
0 commit comments