BYOL: Build Your Own Linux From Scratch
December 31st, 2017
Senior Vice President of Content
By the end of this course, you will have built an understanding of how the Linux kernel interoperates with glibc (and the rest of the binary toolchain). This, in turn, will enlighten your understanding of how various software packages rely on the kernel and glibc to provide interfaces and services, as well as the “why” behind many of the features and idiosyncrasies of the Kernel and glibc.
Part 1: Intro
In this video, we discuss what is required to complete this course successfully, what subjects will be covered, and what can be learned.
Part 2: Configuring the Build Environment
Setting Up Our VirtualMachine
Partitioning hard disks, setting up the 'byol' user, and configuring environment variables for the build process.
Obtaining Source Code
In this video, we obtain the source code files (as compressed TAR files) necessary to build a Linux distribution from scratch.
Stage 1: Building a Temporary Toolchain
In this section, we execute the work necessary to create a temporary toolchain, which we need to build our compiler, linker, and libc implementation natively.
Compiling binutils from source, Stage 1.
Compiling GCC from source, Stage 1.
Installing the Kernel Header Files
Installing the Kernel Header files, which define the API for interacting with the kernel.
Our Stage 1 compile of glibc, the GNU implementation of the Standard C Library.
Sanity Check: DO NOT SKIP
In this video, we run a quick check of our toolchain as installed so far. If your toolchain doesn't pass the checks as demonstated in this video, something has gone wrong!
Here we compile the C++ compiler package of GCC. This is the only time we have to compile this package.
Stage 2: Building a Native Toolchain
Stage 2: Building bintuils
In this video, we undertake the Stage 2 build of binutils, using the toolchain we compiled in Stage 1.
Stage 2: Building GCC
Now we build GCC, again using the temporary toolchain built in Stage 1.
Stage 2: Sanity Check
This video walks through the performance of a check which ensures our toolchain is built properly.
Stage 2: Test Suite Dependencies
We step through the installation of the software needed to run the tests embedded with the binutils, GCC, and glibc packages in this video.
Stage 2: Preparing for Stage 3
We make the final changes in preparation for undertaking our Stage 3 builds in this video, including changing file ownership and permissions.
Stage 2: Backing Up Before Stage 3
This is a good place to backup your work, using the export utility of your virtualization suite, or another method (if you're using hardware).
Stage 3: Building the Distro
Stage 3: Preparing the Environment
We execute most of the Stage 3 build in a chroot jail. In this video, we prepare that environment, inclusive of creating devices nodes and mounting pseudo and virtual filesystems.
Stage 3: Installing glibc
We complete the Stage 3 build and install of glibc in this video.
Stage 3: Adjusting the Toolchain
We modify our toolchain to use local libraries, instead of relying on the temporary toolchain we've built in previous build stages.
Stage 3: binutils
In this video we cover the Stage 3 installation of binutils.
Stage 3: GCC
We perform our final installation of GCC in this video.
Stage 3: Building the Userland
In this video, we demonstrate the process required to build and install the software packages which will form our userland.
Stage 4: Configuration
In this video, we execute the post-build configuration, and boot into our new distro.
Wondering where to go next? Check out this video!