Pages

Wednesday, September 28, 2005

Build your own Linux distribution from Scratch.

Hi,

Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code.
Why would I want an LFS system?
LFS teaches me how a Linux system works internally
Building LFS produces a very compact Linux system
LFS is extremely flexible
LFS offers me added security

Today I have finished the installation of LFS on one of the partitions on my PC. But it is only the base linux system. Now I have to start the installation of Beyond Linux from Scratch (BLFS) which will install KDE, Gnome, XFCE desktop (whiever I chose), Firefox browser etc. so that I can use my personally built Linux system and enjoy.

LFS is compiled and installed by following the instructions in the LFS book which one can read online or download The current stable version is 6.1 which is based on Kernel 2.6.11.12.

One can install the system just by following the book. I faced two minor problems one in the begining and other in the middle of the process. The first problem was resolved on LinuxQuestions.org-LFS Forum. You can read my post here. The second problem was resolved by me and I am going to write about both the problems here.

The LFS book says that the host system must be running at least a 2.6.2 kernel compiled with GCC-3.0 or higher. It does not say what software, utilies should be available on the host. When you start building the first package Binutils it says that the installation depends upon 15 packages. This does not mean that these 15 packages are required on the host system. So which ones are required? Without bothering about this I started compiling the Binutils package and got stuck up. I posted on LinuxQuestions.org and got an answer that on Ubuntu 5.04 I require GCC (which I had), Bison and Flex.

LFS is built on a separate partition. During about half way (or may be 30%) you mount the Virtual Kernel File System on this partition and enter into the LFS through what is known as "Chroot environment". At this stage you are isolated from the host system (within the Bash shell) and you build the basic LFS system. This takes 2 days or more and you may have to shutdown the machine. The book says that if for any reason you stop working on the LFS system and start again later, it is important to check that these file systems are mounted again before entering the chroot environment. This is OK. But not only this, you have to mount tmpfs over /dev and create the necessary devices in /dev after entering Chroot.

But I should appreciate the LFS book. It is very thorough and one can actually build his/her own Linux system from the book.

kagashe
Post a Comment