Linux From Scratch (LFS) – Make Your Own Operating system

Linux from scratch hackreveal.com

Linux From Scratch (LFS) is a type of a Linux installation and the name of a book written by Gerard Beekmans. The book gives readers instructions on how to build a Linux system from source.

Benefits of having a system that is truly your own.

Gerard Beekmans
Linuxfromscratch
Audience
There are many reasons why you would want to read this book. One of the questions many people raise is, “why go
through all the hassle of manually building a Linux system from scratch when you can just download and install an
existing one?”
viiiLinux From Scratch – Version 10.1
One important reason for this project’s existence is to help you learn how a Linux system works from the inside out.
Building an LFS system helps demonstrate what makes Linux tick, and how things work together and depend on each
other. One of the best things that this learning experience can provide is the ability to customize a Linux system to
suit your own unique needs.
Another key benefit of LFS is that it allows you to have more control over the system without relying on someone else’s
Linux implementation. With LFS, you are in the driver’s seat and dictate every aspect of the system.
LFS allows you to create very compact Linux systems. When installing regular distributions, you are often forced to
install a great many programs which are probably never used or understood. These programs waste resources. You
may argue that with today’s hard drive and CPUs, such resources are no longer a consideration. Sometimes, however,
you are still constrained by size considerations if nothing else. Think about bootable CDs, USB sticks, and embedded
systems. Those are areas where LFS can be beneficial.
Another advantage of a custom built Linux system is security. By compiling the entire system from source code, you are
empowered to audit everything and apply all the security patches desired. It is no longer necessary to wait for somebody
else to compile binary packages that fix a security hole. Unless you examine the patch and implement it yourself, you
have no guarantee that the new binary package was built correctly and adequately fixes the problem.
The goal of Linux From Scratch is to build a complete and usable foundation-level system. If you do not wish to build
your own Linux system from scratch, you may nevertheless benefit from the information in this book.
There are too many other good reasons to build your own LFS system to list them all here. In the end, education is by
far the most powerful of reasons. As you continue in your LFS experience, you will discover the power that information
and knowledge truly bring.
LFS Target Architectures
The primary target architectures of LFS are the AMD/Intel x86 (32-bit) and x86_64 (64-bit) CPUs. On the other hand,
the instructions in this book are also known to work, with some modifications, with the Power PC and ARM CPUs.
To build a system that utilizes one of these CPUs, the main prerequisite, in addition to those on the next page, is an
existing Linux system such as an earlier LFS installation, Ubuntu, Red Hat/Fedora, SuSE, or other distribution that
targets the architecture that you have. Also note that a 32-bit distribution can be installed and used as a host system
on a 64-bit AMD/Intel computer.
For building LFS, the gain of building on a 64-bit system compared to a 32-bit system is minimal. For example, in a
test build of LFS-9.1 on a Core i7-4790 CPU based system, using 4 cores, the following statistics were measured:
Architecture Build Time
32-bit
239.9 minutes
64-bit
233.2 minutes
Build Size
3.6 GB
4.4 GB
As you can see, on the same hardware, the 64-bit build is only 3% faster and is 22% larger than the 32-bit build. If you
plan to use LFS as a LAMP server, or a firewall, a 32-bit CPU may be largely sufficient. On the other hand, several
packages in BLFS now need more than 4GB of RAM to be built and/or to run, so that if you plan to use LFS as a
desktop, the LFS authors recommend building on a 64-bit system.
The default 64-bit build that results from LFS is considered a “pure” 64-bit system. That is, it supports 64-bit executables
only. Building a “multi-lib” system requires compiling many applications twice, once for a 32-bit system and once
for a 64-bit system. This is not directly supported in LFS because it would interfere with the educational objective of
providing the instructions needed for a straightforward base Linux system. Some LFS/BLFS editors maintain a fork
of LFS for multilib, which is accessible at http://www.linuxfromscratch.org/~thomas/multilib/index.html. But it is an
advanced topic.
ixLinux From Scratch – Version 10.1
Prerequisites
Building an LFS system is not a simple task. It requires a certain level of existing knowledge of Unix system
administration in order to resolve problems and correctly execute the commands listed. In particular, as an absolute
minimum, you should already have the ability to use the command line (shell) to copy or move files and directories, list
directory and file contents, and change the current directory. It is also expected that you have a reasonable knowledge
of using and installing Linux software.
Because the LFS book assumes at least this basic level of skill, the various LFS support forums are unlikely to be able
to provide you with much assistance in these areas. You will find that your questions regarding such basic knowledge
will likely go unanswered or you will simply be referred to the LFS essential pre-reading list.
Before building an LFS system, we recommend reading the following:
• Software-Building-HOWTO http://www.tldp.org/HOWTO/Software-Building-HOWTO.html
This is a comprehensive guide to building and installing “generic” Unix software packages under Linux. Although
it was written some time ago, it still provides a good summary of the basic techniques needed to build and install
software.
• Beginner’s Guide to Installing from Source http://moi.vonos.net/linux/beginners-installing-from-source/
This guide provides a good summary of basic skills and techniques needed to build software from source code.
LFS and Standards
The structure of LFS follows Linux standards as closely as possible. The primary standards are:
• POSIX.1-2008.
• Filesystem Hierarchy Standard (FHS) Version 3.0
• Linux Standard Base (LSB) Version 5.0 (2015)
The LSB has four separate standards: Core, Desktop, Runtime Languages, and Imaging. In addition to generic
requirements there are also architecture specific requirements. There are also two areas for trial use: Gtk3 and
Graphics. LFS attempts to conform to the architectures discussed in the previous section.
Note
Many people do not agree with the requirements of the LSB. The main purpose of defining it is to ensure
that proprietary software will be able to be installed and run properly on a compliant system. Since LFS
is source based, the user has complete control over what packages are desired and many choose not to
install some packages that are specified by the LSB.
Creating a complete LFS system capable of passing the LSB certifications tests is possible, but not without many
additional packages that are beyond the scope of LFS. These additional packages have installation instructions in BLFS.
Packages supplied by LFS needed to satisfy the LSB Requirements
LSB Core:Bash, Bc, Binutils, Coreutils, Diffutils, File, Findutils, Gawk,
Grep, Gzip, M4, Man-DB, Ncurses, Procps, Psmisc, Sed,
Shadow, Tar, Util-linux, Zlib
LSB Desktop:None

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply