Skip to main content

BYOL: Build Your Own Linux From Scratch


Intro Video

Photo of Terrence Cox

Terrence Cox

Senior Vice President of Content

A veteran of twenty years in Information Technology in a variety of roles. He has worked in development, security and infrastructure well before they merged into what we now call DevOps. He provides training in Linux, VMWare, DevOps (Ansible, Jenkins, etc) as well as containers and AWS topics. He now leads the Training Architects to produce the courses and content we all know and love!







Course Details

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



Lesson Description:

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


Lesson Description:

Partitioning hard disks, setting up the 'byol' user, and configuring environment variables for the build process.

Obtaining Source Code


Lesson Description:

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

Compiling binutils


Lesson Description:

Compiling binutils from source, Stage 1.

Compiling GCC


Lesson Description:

Compiling GCC from source, Stage 1.

Installing the Kernel Header Files


Lesson Description:

Installing the Kernel Header files, which define the API for interacting with the kernel.

Compiling glibc


Lesson Description:

Our Stage 1 compile of glibc, the GNU implementation of the Standard C Library.

Sanity Check: DO NOT SKIP


Lesson Description:

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!

Compiling libstdc++


Lesson Description:

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


Lesson Description:

In this video, we undertake the Stage 2 build of binutils, using the toolchain we compiled in Stage 1.

Stage 2: Building GCC


Lesson Description:

Now we build GCC, again using the temporary toolchain built in Stage 1.

Stage 2: Sanity Check


Lesson Description:

This video walks through the performance of a check which ensures our toolchain is built properly.

Stage 2: Test Suite Dependencies


Lesson Description:

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


Lesson Description:

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


Lesson Description:

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


Lesson Description:

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


Lesson Description:

We complete the Stage 3 build and install of glibc in this video.

Stage 3: Adjusting the Toolchain


Lesson Description:

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


Lesson Description:

In this video we cover the Stage 3 installation of binutils.

Stage 3: GCC


Lesson Description:

We perform our final installation of GCC in this video.

Stage 3: Building the Userland


Lesson Description:

In this video, we demonstrate the process required to build and install the software packages which will form our userland.

Stage 4: Configuration

Post-build Configuration


Lesson Description:

In this video, we execute the post-build configuration, and boot into our new distro.

What's Next?


Lesson Description:

Wondering where to go next? Check out this video!

Take this course and learn a new skill today.

Transform your learning with our all access plan.

Start 7-Day Free Trial