Guix—like other GNU/Linux distributions—is traditionally bootstrapped from a set of bootstrap binaries: Bourne shell, command-line tools provided by GNU Coreutils, Awk, Findutils, ‘sed’, and ‘grep’ and Guile, GCC, Binutils, and the GNU C Library (see 引导). Usually, these bootstrap binaries are “taken for granted.”
Taking the bootstrap binaries for granted means that we consider them to be a correct and trustworthy “seed” for building the complete system. Therein lies a problem: the combined size of these bootstrap binaries is about 250MB (see Bootstrappable Builds in GNU Mes). Auditing or even inspecting these is next to impossible.
x86_64-linux, Guix now features a
full-source bootstrap. This bootstrap is rooted in hex0-seed
from the Stage0 package.
The hex0 program is minimalist assembler: it reads space-separated
hexadecimal digits (nibbles) from a file, possibly including comments, and
emits on standard output the bytes corresponding to those hexadecimal
numbers. The source code of this initial hex0 program is a file called
and is written in the
Hex0 is self-hosting, which means that it can build itself:
./hex0-seed hex0_x86.hex0 hex0
Hex0 it is the ASCII-equivalent of the binary program and can be produced by doing something much like:
sed 's/[;#].*$//g' hex0_x86.hex0 | xxd -r -p > hex0 chmod +x hex0
It is because of this ASCII-binary equivalence that we can bless this initial 357-byte binary as source, and hence ‘full-source bootstrap”.
The bootstrap then continues:
hex1 and then on to
mescc-tools and finally
M2-Planet. Then, using
M2-Planet we build
Mes (see GNU Mes Reference Manual in GNU Mes, a Scheme
interpreter and C compiler in Scheme). From here on starts the more
C-based bootstrap of the GNU System.
Another step that Guix has taken is to replace the shell and all its utilities with implementations in Guile Scheme, the Scheme-only bootstrap. Gash (see Gash in The Gash manual) is a POSIX-compatible shell that replaces Bash, and it comes with Gash Utils which has minimalist replacements for Awk, the GNU Core Utilities, Grep, Gzip, Sed, and Tar.
Building the GNU System from source is currently only possible by adding
some historical GNU packages as intermediate steps39. As Gash and Gash Utils mature, and
GNU packages become more bootstrappable again (e.g., new releases of GNU Sed
will also ship as gzipped tarballs again, as alternative to the hard to
xz-compression), this set of added packages can hopefully
be reduced again.
The graph below shows the resulting dependency graph for
gcc-core-mesboot0, the bootstrap compiler used for the traditional
bootstrap of the rest of the Guix System.
Work is ongoing to to bring these bootstraps to the
aarch64-linux architectures and to the Hurd.
Packages such as
tar-1.22, and some others. For details, see