Linux From Scratch (LFS) Version 8.1 Overview

Choosing to use Linux means approaching a door through which is a deeper understanding of how computers work. In my opinion, completing a LFS project, or at least understanding what happens in a LFS project, is like a capstone to the sentiment in the first sentence.

The general idea is, from a host Linux system of some sort, to create a minimal GNU/Linux system and then use that to create your new LFS system (which is basically another GNU/Linux system, but probably with more functionality — it’s up to you).

Page 34, Chapter 5.1, Introduction:

“The first step is to build a new and host-independent toolchain (compiler, assembler, linker, libraries, and a few useful utilities). The second step uses this toolchain to build the other essential tools.”

The third step is to build the final system from this toolchain and other essential tools.

It’s like using your own hammer to build a specific second hammer, and then using the second hammer to create a new final hammer that is whatever you want. There are reasons for creating a second minimal GNU/Linux system and then using that to make the final system. An offered reason from the book is that using known-good tools makes solving any problems-along-the-way easier.

LFS Teaches You:

Aside from learning how to create a Linux system, LFS teaches some useful ancillary skills. These include: non-volatiles preparation (preparing HDD’s or SDD’s to be worked on), Bash good practices, practical explanations of configuration-file and Bash-command flags, and what system tools are and what they do.

These are all skills and knowledge which help any Linux user either use a Linux system or set up even heavily-assisted Linux installs. It’s all good stuff, and I recommend at least a read through, even if you don’t intend to pursue your own project. Another good read along the same vein is the Gentoo installation guide. I tried Gentoo before attempting Linux From Scratch; it is a process I would recommend.

Multiple Passes, Compiling Software I Already Have?

The kernel abstracts a hardware architecture in a certain way. Software such as the Glibc C library allows compilers such as the GNU C Compiler (GCC) to translate C programming language syntax into the ‘certain ways’ that the kernel abstracts the hardware. This is one way to create a program/software/tool for your specific computer (in this example, from a C program). This is a toolchain.

A lot of useful system software is written in C programming language syntax. Choosing to write software in C as opposed to directly for the hardware being used means the developers only have to know C as opposed to having to know the architectures for all of the possible hardwares that their program may run on. Compilers are convenient. A C compiler is super convenient because C is used by a lot of developers for software at this level. LFS requires this sort of toolchain for this sort of software.

(This is an oversimplification.)

Building a new LFS system is done with the aforementioned toolchain (there is much more to it than those three components). When you build a new LFS system, from your GNU/Linux minimal system, you are re-building new versions of these tools into that new system (plus more). You can compile a new Linux kernel, a new Glibc library, and a new GCC compiler with an existing Linux kernel, Glibc library, and GCC compiler. LFS is partially about creating a system from a system — creating a toolchain from a toolchain, and then more.

(Resolving the ‘chicken or the egg’ line of reasoning for compilers can be intellectually rewarding. How can a C compiler be written in C?)

Just the Surface

This is just the broad strokes in my own words. Of course, the devil is in the details, which you should read about in the book itself. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *