Besides wearing his underwear outside, SuperMan is also a good competitor of the most powerful man in the universe. The other competitors being Batman, Spiderman, 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.
The happy team had a 4 day workshop from 15th to 18th Jan 2004.
My first comment on it would be…. “Wish the workshop was still going on”….
It has been a wonderful experience for me. Going away from my regular work of marketing , management etc… This was a welcome break and a wonderful learning experience. The best part of it was that I had a great team with me. No group activity is successful as long as the team is not good.
Here’s my entire experience. From about X’mas time I have been working on this distro. Like many others here I used to think that Linux is all about the kernel and the rest is all easy. But I learnt quick that it is not so. A OS has a lot of components of which the kernel is just a part. What good would be a car with a 500 bhp engine but no steering wheel , wheels , seats and ….. fuel.
Hence we have to learn about everything. I was a bit nervous when I started because this was the first workshop here and I had with me some of the best kids of Poornam. So my lack of knowledge would have been a poor start. Hence I spent many days and nights with this project. By the end of it I was sure I had something to offer to the kids which they did not know.
My targets was simple –
1) Make my kids think in a disruptive way. Challenge their own knowledge and make them perform beyond their capabilities.
2) Motivate them . I did not need any effort here as the group I got was really cool and positive from day 1
3) Build Linux with a good desktop running . Our distro has a complete development environment with gcc , perl , python. An X-Windows system and KDE. All optimized for performance.
The working system for making one’s own distro is simple. We created the distro with another distro. We had redhat boxes with us and an empty partition. First we create a temporary environment where we put in all the core programs. These are binutils , glib , gcc etc. These are all statically build and hence have no dependency on the parent system (in our case redhat 9) Then we chroot into the new environment and recompile all these programs again. We create the directory structure, we create password and group files etc.. These are all common to all Unix environments.
Now we have an entire environment for us. All that is left then is to install Lilo and the kernel.
Then we reboot the box and get into our Linux and install the X-Windows system , KDE and all the other goodies. The feeling is simply incredible.
Along with all this we had our share of fun.
The patient of the Year award went to Bindya…aaa.
The goalkeeper of the year went to Reshmama …With her wonderful performance we were even thinking of giving her a well deserved life time achievement award.
Shiv got the Mr Spontaneous award
And ofcourse our one and only Tobby has been made the Captain of the happy team without whom I am sure the team would not be what it was…
Reeshma gave us a wonderful treat in Dominos … thanks to shiv we came back in one piece …
I wish I get to hold many more of these workshops.
I am glad that we were able to achieve all three targets and I hope the desire we all have inside us to grow continues and even spreads within the entire Poornam Team.
Reeshma – It was indeed a very good experience that we had the last four days at the workshop. We were really thrilled when we finally came up with our Baby Linux, with the kernel compiled by us and logged in to the KDE setup by us. In fact I could learn a lot of things from the workshop and realized how little I know about Linux.
The four days of workshop has induced a lot of motivation in us to do even more and not just stop with this session…Above all, we five worked together as a great team throughout the workshop and our speaker Amar always made at us ease so that we never felt worn out even after sitting there for about 12 hours each day.
I would really suggest more workshops to be conducted and keenly look forward to our next workshop.
Bindiya – It was very exciting to have compiled a Linux by ourselves.. It gave an insight to what was happening inside a linux system.
The document on “From Power To Bash Prompt” was very good. It was answering the simple and the most vital question any person seeing a computer working would ask.
Compiling our own Linux and setting up a KDE made us understand how things are working and how less we know about the OS.
On the technical side, it gave us a solid base in Operating System and on the emotional side it gave a strong motivation for working more on Linux. I hope we would be soon able to come up with a Distro of our own.
I strongly suggest that more workshops should be conducted. And after the work-shops it would be nice giving a mission to the team (like to create a distro) and a time bound so that the team would be make use of their knowledge and push them to study more on the same.
Tobby – The four days we spend on the workshop was full of
FUN FUN FUN and PASSION :lol:
It really was a great experience.. the first two days It was all childs play, well that was what i thought. But at the end of the workshop I knew i was a frog in the potta kinnaru :roll: (well thats the english version of a malayalm cholu).
It was a really great feelin to work on a linux distro compiled by us and to work on X and kde compiled by us. It was really great to have that feeling. 8)
More than gaining knowledge from the 4 days, I think what the workshop gave us was an urge to learn more rather than just be satisfied with what we have.
But more than all this there was a feelin of a group that was really good and Amar knows how to make that feelin grow. He named us the Happy Team and it really was a HAppy Team.
The HAPPY TEAM WILL BE BACK WITH A BANG.. :idea:
Shiv – I agree with Amar. Building up passion can truly affect the work that we do.
This workshop did exactly that. It showed us how little we knew about Linux. It also made us appreciate the beauty of the operating system and also developed a feeling like ” Wow, this is cool… I should know more about this !!! ”
The workshop is a truly great idea and is a medium for the techs to understand that there are feilds other than ticketing that is a part of server management. It will help all of us to broaden our veiws.
Also Poornam is a growing company. Like Amar said, it is high time we switch to a different feild and start concentrating on another vertical.. like providing custom linux and networking support for corporates, or building our own custom laptops. It would be great to see that we begin our work along these directions once the workshops are over.