This is the scripts that builds the system from source. We'll use these for now until we have a package manager that can just install the packages. You probably shouldn't run any of these unless you're familiar with bash as there are some things which are still hardcoded which makes using them tedious if you don't have the same system as me :).
- sources: tarballs with source code in them.
- build-critical variables: variables such as PATH, TARGET_TRIPLET etc.
Here's what a full build roughly looks like:
get_sources --> create_filesystem --> start_toolchain_build --> cross_compile_programs --> spider-chroot --> finalise_toolchain_build
The sources/
directory holds all of the source code needed to be compiled to
create the system. There are a few scripts that manage this directory for you,
namely clean_sources
and get_sources
, which clean up the program-specific
directories and get the sources from their repositories respectively. For now
it is a good idea to create this directory within the scripts/
directory as
we do not have an automated way to do that yet. I could add it in but I haven't
got around to it.
The env_vars_etc
script contains various build-critical variables and functions
to make the experience a lot easier to write and perform. It gets sourced at
the start of every script. Variables defined here are things such as, but not
limited to:
- CFLAGS/CXXFLAGS
- JOBS (make -jN)
- path to base directory
- path to sources directory
The varcheck
script checks to see if system variables have been set. It is
somewhat obsolete now because we use env_vars_etc
which sets the build-critical
variables for us.
The get_sources
script grabs all of the needed sources to build the system
from their respective code repositories. It also decompresses them into the
sources/
directory once it has downloaded them.
The clean_sources
script will go through the sources/
directory, remove all
the program-specific directories, then untar the existing tarballs thus
emulating a clean build.
The hard_clean
script will clean both the sources/
directory and will
remove the toolchain/
directory.
The create_filesystem
script goes into the base/
directory and creates a
filesystem which will eventually become the root (/
) filesystem of the
distro. It creates various directories such as /usr
, /root
and /dev
to
name a few,
The start_toolchain_build
script will build the GCC toolchain using binutils,
gcc/libstdc++, glibc and kernel headers. This is the first important step in
building programs for the system.
The cross_compile_programs
script will cross-compile programs for the system.
These programs will then be used to finalise the system.
The spider-chroot
script will mount the required virtual filesystems in
/sys
, /dev
and /proc
then chroot
into the root filesystem in base/
.
The finalise_toolchain_build
script builds the final programs for the system.