Besides wearing his underwear outside, SuperMan is also a good competitor of the most powerful man in the universe. The other competitors being Batman, Sipderman, He-Man, Phantom, Arnold Schwarzenegger and George Bush. Everybody wants to have supernatural powers to push themselves a bit more that what ordinary men like you and me. The legendary researcher Mr. Shivapratap once said “Speeds Kills, But Thrills". All super powers are fast, stable, wise and strong (no comments here on George Bush though).
The operating System world is no different. It has it own share of He-Man, Phantom, Arnold Schwarzenegger and George Bush. And ofcourse it also has Linux, The SuperMan in the OS world. Linux is stable, secure, fast and . . . . . . it's free. What's more we get the code too. Interestingly most of the articles on the benefits of Linux mostly focus on one point - the code is free. And yet only a handful would have ever seen the code or modified it ever. Most of the Linux articles are about how great the GNU revolution is and the rest are on which distro is better.
This article focuses on just one point making your own Linux distro. Until some years back to most of us ordinary mortals making a Linux distro was just a dream but then thanks to Gerard Beekmans, the project leader and initiator of the project Linux From Scratch (LFS), this dream made easy. The first question one would ask is - Why would I want an LFS system?
As taken from the LFS site in Gerard Beekmans own words-
There are a lot of reasons why somebody would want to install an LFS system. The question most people raise is “why go through all the hassle of manually installing a Linux system from scratch when you can just download an existing distribution?". That is a valid question which I hope to answer for you.
The most important reason for LFS's existence is teaching people how a Linux system works internally. Building an LFS system 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 taste and needs.
One of the key benefits of LFS is that you are in control over your system without having to rely on somebody else's Linux implementation. You are in the driver's seat now and are able to dictate every single thing such as the directory layout and boot script setup. You will also know exactly where, why and how programs are installed.
Another benefit of LFS is that you can create a very compact Linux system. When you install a regular distribution, you end up installing a lot of programs you probably would never use. They're just sitting there taking up (precious) disk space. It's not hard to get an LFS system installed under 100 MB. Does that still sound like a lot? A few of us have been working on creating a very small embedded LFS system. We installed a system that was just enough to run the Apache web server; total disk space usage was approximately 8 MB. With further stripping, that can be brought down to 5 MB or less. Try that with a regular distribution.
If we were to compare a Linux distribution with a hamburger you buy at a supermarket or fast-food restaurant, you would end up eating it without knowing precisely what it is you are eating, whereas LFS gives you the ingredients to make a hamburger. This allows you to carefully inspect it, remove unwanted ingredients, and at the same time allow you to add ingredients to enhance the flavor of your hamburger. When you are satisfied with the ingredients, you go on to the next part of putting it together. You now have the chance to make it just the way you like it: broil it, bake it, deep-fry it, barbecue it, or eat it raw.
Another analogy that we can use is that of comparing LFS with a finished house. LFS will give you the skeleton of a house, but it's up to you to install plumbing, electrical outlets, kitchen, bathtub, wallpaper, etc.
Another advantage of a custom built Linux system is added security. You will compile the entire system from source, thus allowing you to audit everything, if you wish to do so, and apply all the security patches you want or need to apply. You don't have to wait for somebody else to provide a new binary package that fixes a security hole. Besides, you have no guarantee that the new package actually fixes the problem (adequately). You never truly know whether a security hole is fixed or not unless you do it yourself.
One of the reasons why Macs perform better than the Intels is that the software is made specifically for the hardware hence one gets all the benefits of the hardware. However with most of the intel based systems everything is written for i386 and because the newer processor is faster one sees better performance but never the peak performance that these modern processors are capable of. LFS can change this one aspect to a great extent. Generally LFS is compiled on the target system. This means that the software can be compiled for the particular hardware thus resulting in maximum performance. Until I was exposed to LFS I used to use the fastest processors with the maximum amount of RAM I could afford. But now I am happy with a PIII 800. I run the latest kernel as well as KDE and most of the heavy apps that one can think of and yet I feel good about the computer. And in this case Speed thrills and yet it doesn't kill. Or maybe it kills the other distros. ;-)
Now that we are all convinced that LFS is the way to go, we'll talk about how to go about implementing LFS. To make our own distro we would first need to have a good Linux system in place. For that matter we can have any system which can compile the Linux code i. e. a GNU system with a GNU C++ compiler should do the trick. This is called the host system. The host system can be any flavor of Linux such as Redhat, Fedora, Debian , Slackware etc. or any Unix such as FreeBSD, NetBSD etc. . The host system should have a compiler, linker and shell to build the new system. The host system should also be able to read and write on a file system which is recognized by the Linux kernel such as ext3, ReiserFS, XFS etc.
Once a good host system with the required development environment is installed, the next step is to create an empty native linux partition where LFS would be compiled. This partition needs to be formatted with the required file system. A number of packages are then installed which would form the basic development suite or the toolchain. The toolchain is a temporary system which is then used to build the actual distro. The toolchain is built in two stages - first a host-independent statically built toolchain is installed with a compiler, assember, linker, libraries and other useful utilities. The other essential tools are then built on this first stage system.
The chroot (change root) program is then used to enter a virtual environment and start a new shell whose root directory will be set to the LFS partition. The LFS packages are then compiled inside this chrooted environment after which the boot scripts are installed. Finally the kernel and the bootloader are installed and the machine is rebooted to the all new custom Linux distro.
The process may look a bit complicated but it is fun all the way and the results are really wonderful.
I had taken a workshop in the beginning of 2004 in our office on this subject. I am quoting mine as the views of the team that attended the workshop.
Amarjyoti Krishnan heads bobcares.com, a tech support company for webhosts and ISPs. He is the co-founder of Poornam Info Vision Ltd. , a software and IT services company which specializes in Linux based solutions for Webhosts and ISPs. Poornam Info Vision is an ISO 9001:2000 certified company with a team of over 100 engineers.
Amarjyoti is a Computer Engineer based in India and has over 7 years of experience in the hosting industry. He has spoken and written extensively on the subject. His articles have been published both online as well as in print in magazines.