Use of a Linux initramfs to fully automate the bootstrapping process
Go to file
rick-masters c19ca08f15 Use alias to build Fiwix and make checksums work. 2023-04-03 18:10:23 +00:00
.github/workflows Only run on master branch 2023-03-16 19:09:13 +11:00
.reuse Implement kernel bootstrap up to building Linux. 2023-03-31 18:08:50 +00:00
LICENSES Update to xz-5.4.1. 2023-03-02 22:08:43 +00:00
kernel-bootstrap Use alias to build Fiwix and make checksums work. 2023-04-03 18:10:23 +00:00
lib Pylint fixes. 2023-02-01 22:17:57 +00:00
sysa Use alias to build Fiwix and make checksums work. 2023-04-03 18:10:23 +00:00
sysb Truncate .env file when writing to it 2023-01-29 00:06:57 +02:00
sysc Implement kernel bootstrap up to building Linux. 2023-03-31 18:08:50 +00:00
.gitignore Variety of improvements 2022-05-05 17:44:47 +10:00
.gitmodules Use the new repository URL for stage0-posix. 2021-06-22 21:18:42 +01:00 Implement kernel bootstrap up to building Linux. 2023-03-31 18:08:50 +00:00
README.rst Small addition of bubblewrap mode to documentation 2023-01-13 10:52:12 +02:00 Add `--fail` flag to curl download commands 2023-03-19 12:28:09 +01:00
parts.rst Implement kernel bootstrap up to building Linux. 2023-03-31 18:08:50 +00:00 Fix criteria for kernel bootstrapping. 2023-04-03 18:07:24 +00:00 Fix source_manifest pylint 2023-01-28 16:51:00 +11:00 Implement kernel bootstrap up to building Linux. 2023-03-31 18:08:50 +00:00 Rework tmpdir & associated a bit. 2023-01-28 16:51:00 +11:00


<html xmlns="" xml:lang="en" lang="en"> <head> </head>


An attempt to provide a reproducible, automatic, complete end-to-end bootstrap from a minimal number of binary seeds to a supported fully functioning operating system.

Get me started!

  1. git clone
  2. git submodule update --init --recursive
  3. Provide a kernel (vmlinuz file) as the name kernel in the root of the repository. This must be a 32-bit kernel.
  4. ./ --qemu - ensure your account has kvm privileges and qemu installed.
    1. Alternatively, run ./ --chroot to run it in a chroot.
    2. Alternatively, run ./ --bwrap to run it in a bubblewrap sandbox. When user namespaces are supported, this mode is rootless.
    3. Alternatively, run ./ but dont run the actual virtualization and instead copy sysa/tmp/initramfs to a USB or some other device and boot from bare metal. NOTE: we now require a hard drive. This is currently hardcoded as sda. You also need to put sysc/tmp/disk.img onto your sda on the bootstrapping machine.
    4. Alternatively, do not use python at all, see "Python-less build" below.
  5. Wait.
  6. If you can, observe the many binaries in /usr/bin! When the bootstrap is completed bash is launched providing a shell to explore the system.


This project is a part of the bootstrappable project, a project that aims to be able to build complete computing platforms through the use of source code. When you build a compiler like GCC, you need another C compiler to compile the compiler - turtles all the way down. Even the first GCC compiler was written in C. There has to be a way to break the chain…

There has been significant work on this over the last 5 years, from Jeremiah Orians stage0, hex2 and M2-Planet to jannekes Mes. We have a currently, fully-functioning chain of bootstrapping from the 357-byte hex0 seed to a complete GCC compiler and hence a full Linux operating system. From there, it is trivial to move to other UNIXes. However, there is only currently one vector through which this can be automatically done, GNU Guix.

While the primary author of this project does not believe Guix is a bad project, the great reliance on Guile, the complexity of many of the scripts and the rather steep learning curve to install and run Guix make it a very non plug-and-play solution. Furthermore, there is currently (Jan 2021) no possible way to run the bootstrap from outside of a pre-existing Linux environment. Additionally, Guix uses many scripts and distributed files that cannot be considered source code.

(NOTE: Guix is working on a Full Source Bootstrap, but Im not completely sure what that entails).

Furthermore, having an alternative bootstrap automation tool allows people to have greater trust in the bootstrap procedure.

Comparison between GNU Guix and live-bootstrap

Item Guix live-bootstrap
Total size of seeds [1] ~30MB (Reduced Source Bootstrap) [2] ~1KB
Use of kernel Linux-Libre Kernel Any Linux Kernel (2.6+) [3]
Implementation complete Yes No (in development)
Automation Almost fully automatic Optional user customization

[1]: Both projects only use software licensed under a FSF-approved free software license. Kernel is excluded from seed. [2]: Reiterating that Guix is working on a full source bootstrap, although that still uses guile (~12 MB). [3]: Work is ongoing to use other, smaller POSIX kernels.

Why would I want bootstrapping?

That is outside of the scope of this README. Heres a few things you can look at:

Specific things to be bootstrapped

GNU Guix is currently the furthest along project to automate bootstrapping. However, there are a number of non-auditable files used in many of their packages. Here is a list of file types that we deem unsuitable for bootstrapping.

  1. Binaries (apart from seed hex0, kaem, kernel).
  2. Any pre-generated configure scripts, or Makefile.ins from autotools.
  3. Pre-generated bison/flex parsers (identifiable through a .y file).
  4. Any source code/binaries downloaded within a softwares build system that is outside of our control to verify before use in the build system.
  5. Any non-free software. (Must be FSF-approved license).

How does this work?

For a more in-depth discussion, see parts.rst.


sysa is the first system used in live-bootstrap. We move to a new system after a reboot, which often occurs after the movement to a new kernel. It is run by the seed Linux kernel provided by the user. It compiles everything we need to be able to compile our own Linux kernel. It runs fully in an initramfs and does not rely on disk support in the seed Linux kernel.


sysb is the second 'system' of live-bootstrap. This uses the Linux 4.9.10 kernel compiled within sysa. As we do not rely on disk support in sysa, we need this intermediate system to be able to add the missing binaries to sysc before moving into it. This is executed through kexec from sysa. At this point, a SATA disk IS required.


sysc is the (current) last 'system' of live-bootstrap. This is a continuation from sysb, executed through util-linux's switch_root command which moves the entire rootfs without a reboot. Every package from here on out is compiled under this system, taking binaries from sysa. Chroot and bubblewrap modes skip sysb, as it is obviously irrelevant to them.

Python-less build

Python is no longer a requirement to set up the build system. The repository is almost completely in a form where it can be used as the source of a build.

  1. Download required tarballs into sysa/distfiles and sysc/distfiles. You can use the script.
  2. Copy sysa/stage0-posix/src/* to the root of the repository.
  3. Copy sysa/stage0-posix/src/bootstrap-seeds/POSIX/x86/kaem-optional-seed to init in the root of the repository.
  4. Copy sysa/after.kaem to after.kaem
  5. Create a CPIO archive (eg, cpio --format newc --create --directory . > ../initramfs).
  6. Boot your initramfs and kernel.

chroot builds

For chroot based bootstraps you can skip creation of initramfs and instead start bootstrap with

sudo chroot . bootstrap-seeds/POSIX/x86/kaem-optional-seed

It is also recommended to copy everything to a new directory as bootstrapping messes up with files in git repository and cannot be re-run again.