Back to Projects

Custom Linux OS (LFS)

Linux From Scratch
Linux From Scratch GCC 15.2.0 Systemd Custom Kernel Glibc 2.43 GRUB

Overview

I built a fully custom Linux operating system entirely from source code using the Linux From Scratch (LFS) 13.0-systemd book. This project goes far beyond installing a pre-built distribution — I compiled the kernel, toolchain, system libraries, networking stack, services, and every core utility by hand. The result is a minimal, purpose-built Linux system that I designed, compiled, and configured from the ground up.

Build Verification

The following output was captured directly from the finished system:

# /etc/os-release
NAME="Linux From Scratch"
VERSION="13.0-systemd"
ID=lfs
PRETTY_NAME="Linux From Scratch 13.0-systemd"
VERSION_CODENAME="kieran First"
RELEASE_TYPE="stable"
# /etc/lsb-release
DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="13.0-systemd"
DISTRIB_CODENAME="Kieran Gillott"
DISTRIB_DESCRIPTION="Linux From Scratch"
# uname -a
Linux customLFS 6.18.10 #1 SMP PREEMPT_DYNAMIC Mon May 11 20:17:40 BST 2026 x86_64 GNU/Linux
# Toolchain versions
gcc (GCC) 15.2.0
GNU ld (GNU Binutils) 2.46.0.20260210
ldd (GNU libc) 2.43

Key Features

  • Custom Linux kernel 6.18.10 compiled with PREEMPT_DYNAMIC scheduling
  • systemd 257 as the init system replacing SysV init
  • GCC 15.2.0 toolchain with full C and C++ support
  • GNU C Library (glibc) 2.43
  • GRUB 2 bootloader configured for BIOS boot
  • Dual-disk setup with separate /boot and EFI System partitions
  • systemd-networkd for DHCP-based networking
  • systemd-resolved for DNS resolution
  • OpenSSH for secure remote access
  • Python 3.14, Perl 5.42, and other development tools
  • No package manager — every component compiled and configured manually

Build Process

Following the LFS 13.0-systemd book, I compiled over 85 packages in a structured build order. The process began with a temporary toolchain built against the host system, then a chroot into the new environment to compile the final system. Key build phases included:

  • Toolchain — Cross-compilation of binutils, GCC, and glibc to break dependency on the host
  • Core Utilities — Bash, coreutils, findutils, grep, sed, awk, tar, and dozens more
  • Libraries — OpenSSL, zlib, bzip2, xz, pcre2, readline, ncurses, and others
  • System Services — systemd, udev, dbus, timedated, resolved, networkd
  • Development Tools — Python 3.14, Perl 5.42, autoconf, automake, meson, ninja
  • Networking — OpenSSH server and client, wget, curl, dhcpcd
  • Kernel — Linux 6.18.10 kernel configured for the target hardware
  • Bootloader — GRUB 2 installation and configuration

The entire build was performed inside a Proxmox virtual machine, giving me safe isolation while still requiring careful hardware-aware configuration for the final system.

Challenges Overcome

  • Bootloader Recovery — Accidentally overwrote the host's bootloader by running GRUB on the wrong disk. Had to identify the host's boot mode (BIOS vs UEFI) and reinstall the correct bootloader before rebooting to prevent host downtime.
  • Multi-Disk Boot Configuration — Set up a two-disk system with separate /boot and root partitions, requiring careful GRUB device mapping and BIOS boot priority configuration.
  • Chroot Environment Limitations — Many tests failed during the build because the chroot has no DNS, no systemd as PID 1, and limited kernel capabilities. These included Python networking tests, systemd namespace tests, and filesystem capability tests — all expected and harmless.
  • Toolchain Complexity — The multi-stage GCC and glibc bootstrap process requires precise ordering. Package versions must be compatible, and test suite expectations differ between chroot and full system environments.
  • Kernel & GRUB Configuration — Had to carefully match the kernel filename to GRUB entries, configure framebuffer settings for early console output, and handle the absence of initramfs by using appropriate root mount options.

Technologies Used

Linux 6.18.10 GCC 15.2.0 Glibc 2.43 Binutils 2.46 systemd 257 GRUB 2 Python 3.14 Perl 5.42 OpenSSH OpenSSL dbus Proxmox

Related Projects