.. SPDX-FileCopyrightText: 2021 Andrius Štikonas andrius@stikonas.eu .. SPDX-FileCopyrightText: 2021 Paul Dersey pdersey@gmail.com .. SPDX-FileCopyrightText: 2021 fosslinux fosslinux@aussies.space
.. SPDX-License-Identifier: CC-BY-SA-4.0
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.
Quick start:
See ./rootfs.py --help
and follow the instructions given there.
This uses a variety of userland tools to prepare the bootstrap.
(Currently, there is no way to perform the bootstrap without external preparations! This is a currently unsolved problem.)
Without using Python:
git clone https://github.com/fosslinux/live-bootstrap
git submodule update --init --recursive
./download-distfiles.sh
, and copy:
seed/stage0-posix
into that directory.seed
into that directory.steps/
and distfiles/
into that directory.
steps/pre-network-sources
must be
copied in. All other files will be obtained from the network./bootstrap-seeds/POSIX/x86/kaem-optional-seed
in the chroot.
(Eg, chroot rootfs /bootstrap-seeds/POSIX/x86/kaem-optional-seed
).
b. QEMU: Create two blank disk images.builder-hex0-x86-stage1.img
from hex0 source:
sed 's/[;#].*$//g' builder-hex0/builder-hex0-x86-stage1-hex0 | xxd -r -p
builder-hex0-x86-stage1.img
to it, followed
by kernel-bootstrap/builder-hex0-x86-stage2.hex0
, followed by zeros
padding the disk to the next sector../download-distfiles.sh
.src <size-of-file> <path-to-file>
, followed by the contents
of the file.
sources
files for build:
steps
manifested before improve: get_network
into this disk.distfiles/
into this disk.-nic user,model=e1000
), and -machine kernel-irqchip=split
.
c. Bare metal: Follow the same steps as QEMU, but the disks need to be
two different physical disks, and boot from the first disk.live-bootstrap's overarching problem statement is;
How can a usable Linux system be created with only human-auditable, and wherever possible, human-written, source code?
Clarifications:
The core of a modern Linux system is primarily written in C and C++. C and C++ are self-hosting, ie, nearly every single C compiler is written in C.
Every single version of GCC was written in C. To avoid using an existing
toolchain, we need some way to be able to compile a GCC version without C. We
can use a less well-featured compiler, TCC, to do this. And so forth, until we
get to a fairly primitive C compiler written in assembly, cc_x86
.
Going up through this process requires a bunch of other utilities as well; the autotools suite, guile and autogen, etc. These also have to be matched appropriately to the toolchain available.
That is outside of the scope of this README. Here’s a few things you can look at:
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.
.y
file).For a more in-depth discussion, see parts.rst.
Firstly, builder-hex0
is launched. builder-hex0
is a minimal kernel that is
written in hex0
, existing in 3 self-bootstrapping stages.
This is capable of executing the entirety of stage0-posix
, (see
seed/stage0-posix
), which produces a variety of useful utilities and a basic
C language, M2-Planet
.
stage0-posix
runs a file called after.kaem
. This is a shell script that
builds and runs a small program called script-generator
. This program reads
steps/manifest
and converts it into a series of shell scripts that can be
executed in sequence to complete the bootstrap.
From this point forward, steps/manifest
is effectively self documenting.
Each package built exists in steps/<pkg>
, and the build scripts can be seen
there.