LINUX FROM SCRATCH
Like to get your hands dirty? Aaron Peters is your man, as we get deep into building Linux.
Did you read “Linux From Scratch” in the title of this article and didn’t run away screaming into the night? Then you were either intrigued by the premise presented in the last issue of Linux Format, or are a very special Linux fan indeed. But as the title says, we’re going to get right to it in this follow-up article. So get ready for the nuts, bolts, and other assorted components of Linux From Scratch. In the sake of efficiency, you should have the following prepared before diving into the following sections:
> Lots of patience.
> A steady hand for copying and pasting terminal commands.
> A love of reading (plain black text on white or grey backgrounds).
> High bravery levels in the face of compilation errors.
> An i386-or x86_64-based PC with a modern(ish) distribution installed.
> Hard disk space to spare. Or even better, a blank partition. Even better still, a spare hard drive.
> A copy of https://linuxfromscratch.org/lfs/downloads/stable.
Output of the
check-versions.sh script showing that everything is working well on the host system.
This article will follow along with, and frequently reference, the Linux From Scratch (hereafter also LFS) book. Since the LFS book is an actual book, it can’t reasonably be condensed to the size of an article here. So while we’ll highlight some early parts of the LFS build process, when you embark on this you should follow the book exactly. Its authors took great care in putting together some very fine instructions, so take advantage of them.
Preparing the host
The first thing you’ll need to do when preparing the /host/ system (in other words, the existing Linux system on which you’ll build LFS) is installing the prerequisite software. This consists primarily of development tools such as the GCC compiler, Make and Patch, as well as the stalwart open source languages Perl and Python. On a recent version of a Debian-based system, the following command should get you everything you need (note a fair number of these will already be present, but it doesn’t hurt to include them):
Part Two
Did you misspart one? Gethold of it onpage 62
Next, check that they’re all the right version. Section 2.2 of the LFS book provides a convenient script that will check to see if all the required versions of software are present, and confirm the ability to build source packages. Once you copy its contents into a text file and add execute permissions, you’ll find all you need to make sure the system is ready with the following command: