These days, I am working on building my own Linux operating system. Here I would like to share with you some of my experiences.
I have been learning, using and loving for over four years. Early from mid-2005, I was instantly attracted by the beauty of this operating system, though not very famous around the area where I was living, I fell in love with it. I love its philosophy of openness and more importantly collaboration with people no matter where you are from. I was trying to collect videos, books and blogs about linux just in order to love it more. And along the way of loving this operating system, I also have been building my own skills of using and working with Linux. I have learned in depth on system administration either by watching videos or by reading books and hands on experience with this lovely OS. Back in August 2006 to January 2007, I even had the opportunity to work as a intern software programmer using Linux, which is one of the most important linux skill trying till now. At that time, I learned programming using c/c++ under linux, script programming and a lot. Here I would like to thank that precious opportunity.
As time went by, I met bottle neck in learning Linux. I have been telling myself to join the big community of Linux, try to help the community and do something, but things are not always that easy, although, I have been trying to do so by applying for positions such as translators or system administrators, I was always beat off. There were so much enthusiastic people in this community. Documents are translated in a timely fashion at least in my language - Chinese. Still, I also want to do something else to help the open source world, I always find myself lack enough competition. So I told myself to build my Linux skills even further and deeper.
About half a year a ago, I first heard of Linux From Scratch from one of my colleagues who is now still working in that company - state street corporation. But at that time, due to a lot of reasons I left it into the corner of my memory. As I need to earn my bread. As time went by, I gradually find the importance of deepening my own linux skills, and thanks to the free time these days, I can pickup the left from the corner and do it from scratch. I have never been doing such kind of things before, which means this experience log to some extent shows the core steps and some of the trouble shooting skills along the way of building my own linux operating system, and there will be upcoming updates with my new experience. So, if you like this post please make a comment, I just want to make it better and better. Thanks!
Building linux from scratch needs a lot of skills, shell scripting and system administration is a must. There are generally three big steps in all. First, build your own compiling tool-chain. Second, build the core system softwares using the self sustained tool-chain and last, build the kernel and make the operating system bootable. In order to make the system flexible enough I put my system onto a usb stick thus I can make a usb-pen based operating system.
Core steps of building Linux from scratch.
First, building the tool-chain from scratch. Tool chain are like food production factories, you put in your code and get the program to make the whole system work. So, it is the basis of all the softwares that are going to appear on the new operating system. The steps of building the tool-chain for the new system is also the most time-consuming, we need to go through several steps in order to make the tool-chain self-sustainable. First, we need to compile our new compiler using the compiler residing on the host operating system. Then, the compiler will have to build itself several times to make it independent of the host operating system. Along with the compiler, we also need to compile the basic libraries on which most of the upcoming to be compiled programs will depend. Thus far, we have build our own libraries and compilers, we can go on with building the essential programs for the system to work.
Second, building core softwares for the new system. The essential point we have to consider in building the system core softwares are dependency, which determines the sequence of how these softwares are built. Another important thing we need to be careful of is to be sure of using the newly build compiler and libraries rather than the old ones on the host operating system.
Third, build the new kernel and make the new system bootable. Building kernel is one big topic which you need to try on your own, it is common that there are several failures such as "Kernel panic." and "VFS: cannot find the partition". Anyway we need to trouble shoot all of these problems. Additionally, building your system onto a usb stick may bring about problems that will not exist otherwise. In a word, problems are almost inevitable, so don't panic when meeting them, consult with your friends or use google, anyway we can it through.
Thus far, we have finished all the steps, now enjoy your new system.
Note, one very important issue that I have met in the procedure of building my own operating system is the kernel. How to compile the kernel to make it work is trouble prone.
For details about every steps please visit the official website of Linux From Scratch.