Bootstrap
Disclaimer
- As a regular user, you are not expected to bootstrap glaucus from scratch
- This process is only intended for developers who are interested in building stages 0 through 3 on their systems
- It is important to understand that this process might not always work as your host system and glaucus are moving targets that are hard to pin and while it is likely to work now, it is due to the developers spending most of their time bootstrapping as we have not decided yet on what release to use a seed for future processes; what you mostly use from other distributions is at least stage 2 (see the explanation of stages below) as you are not expected to bootstrap from absolutely nothing and it is highly likely that it’s been ages since anyone attempted to bootstrap a mainstream distribution (even gentoo starts you from stage 2 or 3 as they call it)
Introduction
- To bootstrap
glaucus
is to generate a self-hosting image file capable of rebuilding itself under itself from nothing (or from a minimal seed that may or may not share software with the host system) rad
(glaucus package manager) is the tool used to bootstrap glaucus; some distributions separate the bootstrap logic from the building logic from the package management logic which is understandable, but for the sake of simplicity,rad
is responsible for all of this onglaucus
- The bootstrap process is divided into 4 stages:
- Toolchain Stage: aka stage 0, in this stage
glaucus
leverages existing tools on the host system to build a cross-compilation toolchain that will build the next stage; This stage is not optimized as we want to reach the following stage as soon as possible while keeping things sane and reproducible; This stage runs on the host machine and typically should not take more than 15 minutes to complete on a relatively modern system - Cross Stage: aka stage 1, in this stage
glaucus
uses the toolchain built in stage 0 to cross-compile the core packages needed to build a basic self-hostingglaucus
system; This stage is optimized forx86-64-v3
as it is independant from the host system; This stage runs on the host machine and should typically not take more than 25 minutes to complete on a relatively modern system - Native Stage: aka stage 2, after a successful build of stage 1, an
img
file that is bootable under QEMU can be generated using theimg
script found in glaucus live systembubble
, in this stageglaucus
is truly on its own, it will attempt to rebuild itself under itself performing a fully offline build (as theimg
script would have copied the necessary sources needed to perform such build); This stage is optimized for x86-64-v3 and is not run on the host machine but instead under QEMU, the basic packages and some other useful packages are natively build here; and should typically not take more than 45 minutes to complete on a relatively modern system - Real Native Stage: aka stage 3 (or stage 4 as some distributions that use a 1-based index call it), this stage doesn’t have a full name yet, in this stage you leverage a stage 2
rootfs
oriso
file to perform a native rebuild of the glaucus system upon installation (think gentoo); This stage is optimized fornative
and will only run on your machine, it has not been implemented yet as it is closely tied to the install process which is not yet ready, also the previous 3 stages are enough to validate the sanity of the entire process and its artefacts
- Toolchain Stage: aka stage 0, in this stage
Host System Requirements
- Arch, Fedora and Linux From Scratch (LFS) can be used to bootstrap glaucus
- It is recommended to have a minimum of 4 GB of memory and 10 GB of storage space
Required Packages
autoconf
automake
bash
binutils
bison
(orbyacc
)booster
bzip2
coreutils
(ortoybox
)diffutils
(ortoybox
)dosfstools
erofs-utils
findutils
(ortoybox
)flex
(orreflex
)gawk
(ormawk
)gcc
gettext
(orgettext-tiny
)git
grep
gzip
(orpigz
)libcap
libtool
(orslibtool
)limine
m4
make
meson
(and notmuon
as it does not support--cross-file
)patch
(ortoybox
)perl
pkg-config
(orpkgconf
)sed
(ortoybox
)tar
(orlibarchive
)wget2
xz
zlib
(orzlib-ng
)zstd
Steps
- Clone the
glaucus
repository:
git clone --recursive https://github.com/glaucuslinux/glaucuscd glaucus
- Checkout the
main
branch:
for i in bubble cerata rad s6-boot-scripts; do cd $i git checkout main cd ..done
- Provide missing stubs in case your host system does not provide them (remove
texinfo
):
for i in gtkdocize help2man makeinfo po4a texi2dvi; do sudo cp -fPp cerata/musl/files/true /usr/bin/$idone
- Optional Create symlinks on your host system (assuming you are in
glaucus/
):
sudo ln -fs $PWD/cerata/autoconf/files/glaucus-configure /usr/binsudo ln -fs $PWD/cerata/muon/files/glaucus-meson /usr/bin
sudo mkdir -p \ /var/cache/rad \ /var/lib/rad/clusterssudo ln -fs $PWD/src /var/cache/radsudo ln -fs $PWD/cerata /var/lib/rad/clusters
- Bootstrap toolchain and cross (use
nimble
to buildrad
):
cd rad./rad bootstrap toolchain./rad bootstrap cross
- Create the cross img:
cd bubblesudo ./img
- Boot via QEMU:
qemu-system-x86_64 \ -machine q35,accel=kvm \ -cpu host \ -smp 4 \ -m 4G \ -name glaucus \ -drive file=glaucus-*.img,format=raw \ -nic model=e1000 \ -display gtk,gl=on \ -vga qxl \ -rtc base=localtime \ -bios /usr/share/ovmf/x64/OVMF.4m.fd
- Bootstrap native (use cross-compiled
rad
):
rad bootstrap native
- Create the native iso:
cd bubblesudo ./iso