We are going to build a Linux Kernel based System with GNU Components by configuring, compiling and installing source tarballs. Mount a new ext3 disk on
/mnt/lfs without partitioning. Create
Most of these steps are described in ‘Linux From Scratch 7.3’ book. But I will describe you how I build this system on an Ubuntu host with further explanations where applicable.
Finding the New Disk, Formatting and Mouting
sudo lshw. Find your disk logical name. e.g. I found my disk at ‘core’ > ‘pci’ > ‘storage’ > ‘disk2’.
logical name: /dev/sdc
1 2 3
GNU BinUtils 2.23.1 Installation
The GNU Binutils are a collection of binary tools. The main ones are:
ld – the GNU linker.
as – the GNU assembler.
Download the ‘GNU BinUtils’ (21.5MB) using
tar -jxvf binutils-2.23.1.tar.bz2. j option is for bzip2 archives. (154MB)
configure command with the relevant arguments. Now
The time to compile BinUtils is called 1SBU. For me 1SBU ~ 2.5min.
‘binutils-build’ ~ 85MB.
Time to install.
make install. This will install the BinUtils in ‘tools’ directory.
GNU Compiler Collection 4.7.2 Installation
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc++, libgcj,…). GCC was originally written as the compiler for the GNU operating system.
The GNU Multi Precision Library (MPC) 5.1.1
Arithmetic without limitations – The GNU Multiple Precision Arithmetic Library
GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface.
The GNU MPFR Library 3.1.1
MPFR is based on the GMP multiple-precision library (MPC).
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding. The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has a well-defined semantics. It copies the good ideas from the ANSI/IEEE-754 standard for double-precision floating-point arithmetic (53-bit significand).
GNU MPC 1.0.1
Gnu Mpc is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result. It extends the principles of the IEEE-754 standard for fixed precision real floating point numbers to complex numbers, providing well-defined semantics for every operation. At the same time, speed of operation at high precision is a major design goal.
IEEE Standard for Floating-Point Arithmetic (IEEE 754).
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). Many hardware floating point units use the IEEE 754 standard. The current version, IEEE 754-2008 published in August 2008, includes nearly all of the original IEEE 754-1985 standard and the IEEE Standard for Radix-Independent Floating-Point Arithmetic (IEEE 854-1987). The international standard ISO/IEC/IEEE 60559:2011 (with identical content to IEEE 754) has been approved for adoption through JTC1/SC 25 under the ISO/IEEE PSDO Agreement and published.
GNU MPC and GNU MPFR are base on IEEE 754 Standard.
Linux Kernel 3.8.1
The Linux API Headers expose the kernel’s API for use by Glibc.
The Linux kernel needs to expose an Application Programming Interface (API) for the system’s C library (Glibc in LFS) to use. This is done by way of sanitizing various C header files that are shipped in the Linux kernel source tarball.
The GNU C Library 2.17
Any Unix-like operating system needs a C library: the library which defines the “system calls” and other basic facilities such as open, malloc, printf, exit…
The GNU C Library is used as the C library in the GNU systems and most systems with the Linux kernel.
The GNU C Library is primarily designed to be a portable and high performance C library. It follows all relevant standards including ISO C11 and POSIX.1-2008. It is also internationalized and has one of the most complete internationalization interfaces known.
Second Pass - BinUtils and GCC
After installing above programs, BinUtils and GCC needs another pass. Recompile and Reinstall both.
Toolchain Remaining Tools
Install the rest of the tools required to actually build the System From Source Tarballs.
Next Read the post about Building the System Software From Scratch.