Freelance Projects

Upeksha Wisidagama

Building a Linux System From Scratch

62 Tarballs were downloaded. Then compiled one-by-one.

‘Source Tarballs (/sources)’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-rw-r--r--  1 uw   uw    1214744 Apr 25  2012 autoconf-2.69.tar.xz
-rw-r--r--  1 uw   uw    1425080 Jan  1  2013 automake-1.13.1.tar.xz
-rw-r--r--  1 uw   uw    7009201 Feb 14  2011 bash-4.2.tar.gz
-rw-r--r--  1 uw   uw   21455321 Nov 13  2012 binutils-2.23.1.tar.bz2
-rw-r--r--  1 uw   uw    1776640 Dec 12  2012 bison-2.7.tar.xz
-rw-r--r--  1 uw   uw     782025 Sep 20  2010 bzip2-1.0.6.tar.gz
-rw-r--r--  1 uw   uw     602679 Oct 22  2012 check-0.9.9.tar.gz
-rw-r--r--  1 uw   uw    5357988 Feb 14 22:36 coreutils-8.21.tar.xz
-rw-r--r--  1 uw   uw     576269 Mar 11  2011 dejagnu-1.5.tar.gz
-rw-r--r--  1 uw   uw    2023539 Sep  2  2011 diffutils-3.2.tar.gz
-rw-r--r--  1 uw   uw    5981006 Jan 22 09:09 e2fsprogs-1.42.7.tar.gz
-rw-r--r--  1 uw   uw     628808 Nov 10  2010 expect5.45.tar.gz
-rw-r--r--  1 uw   uw     641632 Jul 11 10:50 file-5.13.tar.gz
-rw-r--r--  1 uw   uw    2149838 Jun  6  2009 findutils-4.4.2.tar.gz
-rw-r--r--  1 uw   uw    1303313 Aug  4  2012 flex-2.5.37.tar.bz2
-rw-r--r--  1 uw   uw    1626808 Dec 27  2012 gawk-4.0.2.tar.xz
-rw-r--r--  1 uw   uw   82884636 Sep 20  2012 gcc-4.7.2.tar.bz2
-rw-r--r--  1 uw   uw     655599 Nov 13  2011 gdbm-1.10.tar.gz
-rw-r--r--  1 uw   uw   15697875 Dec 25  2012 gettext-0.18.2.tar.gz
-rw-r--r--  1 uw   uw   10981956 Dec 26  2012 glibc-2.17.tar.xz
-rw-r--r--  1 uw   uw    1812988 Jul 11 20:52 gmp-5.1.1.tar.xz
-rw-r--r--  1 uw   uw    1195640 Aug 20  2012 grep-2.14.tar.xz
-rw-r--r--  1 uw   uw    4019913 Feb  7 17:50 groff-1.22.2.tar.gz
-rw-r--r--  1 uw   uw    5136412 Jun 28  2012 grub-2.00.tar.xz
-rw-r--r--  1 uw   uw     720956 Jun 18  2012 gzip-1.5.tar.xz
-rw-r--r--  1 uw   uw     205618 Mar  5  2008 iana-etc-2.30.tar.bz2
-rw-r--r--  1 uw   uw    1987928 Jan  6  2012 inetutils-1.9.1.tar.gz
-rw-r--r--  1 uw   uw     407608 Feb 21 22:14 iproute2-3.8.0.tar.xz
-rw-r--r--  1 uw   uw    1730719 Dec  6  2012 kbd-1.15.5.tar.gz
-rw-r--r--  1 uw   uw    1275028 Dec  5  2012 kmod-12.tar.xz
-rw-r--r--  1 uw   uw     310144 Jul 22  2012 less-451.tar.gz
-rw-r--r--  1 uw   uw      33692 Mar  4 21:17 lfs-bootscripts-20130123.tar.bz2
-rw-r--r--  1 uw   uw     750489 Sep 18  2012 libpipeline-1.2.2.tar.gz
-rw-r--r--  1 uw   uw    2632347 Oct 18  2011 libtool-2.4.2.tar.gz
-rw-r--r--  1 uw   uw   70981756 Feb 28 19:27 linux-3.8.1.tar.xz
-rw-r--r--  1 uw   uw    1258362 Mar  2  2011 m4-1.4.16.tar.bz2
-rw-r--r--  1 uw   uw    1242186 Jul 28  2010 make-3.82.tar.bz2
-rw-r--r--  1 uw   uw    1388944 Sep 18  2012 man-db-2.6.3.tar.xz
-rw-r--r--  1 uw   uw    1134180 Feb 12 09:26 man-pages-3.47.tar.xz
-rw-r--r--  1 uw   uw     624125 Sep  6  2012 mpc-1.0.1.tar.gz
-rw-r--r--  1 uw   uw    1071688 Jul  4  2012 mpfr-3.1.1.tar.xz
-rw-r--r--  1 uw   uw    2826473 Jul 11 11:11 ncurses-5.9.tar.gz
-rw-r--r--  1 uw   uw     675896 Sep 28  2012 patch-2.7.1.tar.xz
-rw-r--r--  1 uw   uw   13725101 Nov  1  2012 perl-5.16.2.tar.bz2
-rw-r--r--  1 uw   uw    1931203 Jan 24 19:17 pkg-config-0.28.tar.gz
-rw-r--r--  1 uw   uw     535796 Jan  8  2013 procps-ng-3.3.6.tar.xz
-rw-r--r--  1 uw   uw     432501 Sep 20  2012 psmisc-22.20.tar.gz
-rw-r--r--  1 uw   uw    2277926 Feb 14  2011 readline-6.2.tar.gz
-rw-r--r--  1 uw   uw    1059414 Dec 22  2012 sed-4.2.2.tar.bz2
-rw-r--r--  1 uw   uw    2193325 May 26  2012 shadow-4.1.5.1.tar.bz2
-rw-r--r--  1 uw   uw      86557 Jul 29  2007 sysklogd-1.5.tar.gz
-rw-r--r--  1 uw   uw    2054644 Jan  8  2013 systemd-197.tar.xz
-rw-r--r--  1 uw   uw     105551 Apr 14  2010 sysvinit-2.88dsf.tar.bz2
-rw-r--r--  1 uw   uw    2339773 Mar 12  2011 tar-1.26.tar.bz2
-rw-r--r--  1 uw   uw    8636908 Dec 20  2012 tcl8.6.0-src.tar.gz
-rw-r--r--  1 uw   uw    3782636 Feb 17 07:54 texinfo-5.0.tar.xz
-rw-r--r--  1 uw   uw     214075 Jan  5  2013 tzdata2012j.tar.gz
-rw-r--r--  1 uw   uw      17129 Jan 12 00:40 udev-lfs-197-2.tar.bz2
-rw-r--r--  1 uw   uw    3100832 Dec 13  2012 util-linux-2.22.2.tar.xz
-rw-r--r--  1 uw   uw    9080692 Jul 11 11:18 vim-7.3.tar.bz2
-rw-r--r--  1 uw   uw     915048 Jun 22  2012 xz-5.0.4.tar.xz
-rw-r--r--  1 uw   uw     505085 Jul 11 19:55 zlib-1.2.7.tar.bz2

Building the ToolChain, Building the System Software and Compiling the Linux Kernel

Building the ToolChain
Building the System Software
Compiling the Linux Kernel

The above posts describe the steps needed to build a basic Linux system from source tarballs. This article is about booting and logging into the new system.

Booting the New Linux System

Remove the host hard disk. Boot with the hard disk with new system. Or you can change the hard drive order to allow booting from our new disk.

Linux System Grub Menu

Linux System Login

Linux System Hard Disk Usage

The entire disk is 10GB. The system files use only 552MB. ‘usr’ alone uses 508MB. The Rest of the system uses 44MB.

Directory Size/KB
tmp 20
srv 4
lib 15360
media 12
boot 12288
opt 4
home 12
run 224
mnt 4
etc 6.5
var 920
root 32
sbin 4812
bin 4915
usr 508M

See the output of the “du“ command.

Linux System Disk Usage

Linux System Random Access Memory Usage

The system has 1GB RAM. But only 31.5MB is used.

Linux System Resource Usage

Many wonder why they should go through the hassle of building a Linux system from scratch when they could just download an existing Linux distribution. However, there are several benefits of building Linux from sources.

Building LFS teaches you about all that makes Linux tick, how things work together and depend on each other. And most importantly, how to customize it to your own tastes and needs.

If you are wondering why you would want a highly secured system, just read any number of articles dealing with hackers and script kiddies breaking into systems and destroying them or stealing from them. Now, you can know the security hole, inspect the patches and fix it yourself immediately.

You don’t have to wait for someone else to provide a new binary package that (hopefully) fixes a security hole. Often, you never truly know whether a security hole is fixed or not unless you do it yourself.

Thank you, Project Leader: Gerard Beekmans, Project Co-leader: Matthew Burgess and Project Co-leader: Bruce Dubbs of ‘Linux From Scratch’.

Visit ‘Linux From Scratch’ today and experience the freedom and power. Don’t forget to run the gcc tests using make -k checkApproximate build time: 53.5 SBU !