[ Monday, 12 May 2008, Keyto ]
Every free software enthusiast probably already knows that distrowatch.com, created by Ladislav Bodnar, is a great source of information on different open source operating systems. We can pretty much admit that every respected distribution based on Linux or BSD is at least mentioned on his website. You can find there descriptions of systems, starting from those small and fast ones, to the enormous distributions filled with packages that even the actual creators of those systems wouldn’t even think of. For instance, lets take DSL which “weights” only 49 megabytes or the newest DVD version of Slackware that that takes up to 3.7 gigabytes. Debian, well, that’s definitely a biggie. It takes up 3 DVD’s, which adds up to 12.9 gigabytes of packages ready to get installed. GoboLinux – fits on one CD, “weighing” 640 megabytes and finally Linux From Scratch Distribution – one PDF file, with over 250 pages….
One who decides to start his adventure with GNU/Linux system, usually goes with popular distributions. Then, after downloading the image and burning it, finally installs the system, in which the installation and configuration process was made easy by the authors. This allows the user to comfortably perform and finish the installation. More experienced users often decide to go with distributions built from source. Those include: Gentoo, and its less popular “fellas”: Lunar, T2 SDE, Sorcerer or Source Maga. These distributions, unlike the popular ones, allow you to build your own system from source. Knowing this fact, we can definitely say that Linux From Scratch counts as a special edition here. It’s a book (actually a few books) on how to create your own GNU/Linux distribution. Right now, there are 20 people working on this project. And of course, mentioning Gerad Beekman, the creator of this project, is a must.
The main parts of this projects are:
- Linux From Scratch (LFS) main book, includes the procedure of creating the base system.
- Beyond Linux From Scratch (BLFS) shows you how to enhance your system.
- Automated Linux From Scratch (ALFS) tool used to optimize the work in LFS and BLFS.
- Cross Linux From Scratch (CLFS) info about creating systems for different architectures.
- Hardened Linux From Scratch (HLFS) describes the process of securing our system.
As mentioned above, LFS shows us how to successfully compile a working system, but what does a working system actually mean? Well, it’s a complex environment that allows us to compile and install software. We basically get our own GNU/Linux distribution, working only in command line mode, that includes basic applications, such as a gcc compiler, primary editors (vim, sed), perl interpreter , and the manuals.
What’s next? We’ll talk about that in few moments, but first, you’re probably asking yourself: How much does it cost to create such a system? Well obviously, there’s no money involved, although time will play a big part here. It usually depends, on the speed of our machine, and the person working on the system. As a matter of fact, compiling will not even take half of time of the whole process, but even though, finding out more precise timing for this project wouldn’t be a bad idea. This will help you decide whether to go with it, or just let it go. To give you an overall image of this process, on a P4 / 3GHz / 1GB RAM computer, it will take about 10 hours, where about half of this time will be used up by the compiler. So on a rainy day, during a weekend, why not just give it a shot? Although, don’t forget that thanks to LFS you will only get the base system. This means, no GUI, no Firefox, and of course no OpenOffice.org. To make our system more functional you can use the second tome of LFS book, which is BLFS.
At first, you might think that LFS is a set of books created only for computer geeks and IT professionals. It is pretty much ensured that a regular PC user will not go with building a system from scratch, if he has many other, ready to use distributions. This is understandable, but if it comes to LFS, the whole concept just changes, because it’s a guide written for everyone, who would want to expand their knowledge about GNU/Linux systems. It’s not an easy way though, therefore it’s not the best thing for beginners, but on the other hand, this type of “exercise” is much easier than you might think. You don’t really have to know how to program or how systems are built. All you’ll need is some good knowledge of system administration, basics in compiling programs, couple megabytes on your hard drive, some free time, and the will of learning the system inside out.
We have to remember though, that there might be times were someone’s help could be needed. But if building the system form scratch will be only for learning purposes, than whole process doesn’t really have to be a success. You can learn a lot by going over only certain parts of this guide. That’s why even an unfinished project will help out in exploring your knowledge. Other than that, there are many other reasons to try out LFS. A good example here is creating a system for a special purpose, (the author, in the beginning of this guide, talks about a 5-megabyte server), embedded system, or for instance a system designed for a given machine and for one’s needs – this type of a system can be really fast and stable.
If we don’t have the time and the will for compiling our own system, downloading the LFS guide still wouldn’t go to waste. By studying this guide, we can learn some general and very valuable information about GNU/Linux, and get the overall basics of any computer system. The book also includes descriptions of packages, scripts, and — the most important thing — components of a system, and their job.
Warning – Construction Area!
OK, we finally decided to build our system, but the question comes: How can we do it the easiest way? First, to build our own system using LFS, we need an already working GNU/Linux system, since our new OS will be build in Linux environment. It can pretty much be any distribution that satisfies the requirement mentioned in the beginning of the LFS guide. Well, what should we do if we don’t have that kind of a system? Thanks to the authors, we can use an LFS LiveCD. It can be found on the official LFS website, in ISO image, that includes a full, compatible system, LFS and BLFS books in HTML format, source packages, required scripts and basic tools. So basically, after burning the image, we have everything we need to build our own system.
Now, we might still encounter some problems such as: What should we do if we’re not advanced users and we don’t want to damage our current system or maybe what if we don’t have enough space on our hard drive? And, we can’t forget about compiling time, either! When it comes to installing software, many users don’t go the longer way, the “compile from source” way, mostly because they don’t want to, or perhaps they don’t have access to the computer for certain amount of hours. The answer for those problems is — virtualization! As of this moment, there are many good programs for this job, such as: VMware Server, Innotek VirtualBox or Qemu. Now all you gotta do is install one of those programs, get a ISO image of LFS LiveCD, configure your virtual machine, and you can then, safely test your system in a nice, virtual lab. For less advanced users, the easiest program would be VirtualBox. It’s easy to use and available for many different operating systems. The good thing about virtualization is that we can “freeze” our working system pretty much any time. Thanks to that feature, we can compile our system by parts whenever we want. To help you out in dividing your building process into a couple of parts, you can use estimated compile time for required packages. In their books, authors use a made-up unit – SBU. Since they were not able to precisely get the compiling time for every machine (they would probably had to make a huge list of every computer in the entire world to do so), they’ve used the following method. One of the first packages we have to compile is binutils. If the time taken to compile it is equal to 1 unit of SBU, than the timing for other packages will be more or less proportional. So if binutils compiles in 1 minute, then coreutils, which takes about 0.5 SBU, will compile in 30 seconds, etc.
Some goodies for the ending:
GNU/Linux without GNU
The GNU/Linux makes up a Linux OS and GNU software. That’s why we call it that way. You probably know that GNU system was created in 1993 and it was supposed to be a stand-alone system. Although, after all the GNU software became stable, there were many problems with the operating system, and more specifically with the Hurd kernel. If we take a look at the list with software required to build LFS, we can notice that most of those programs come from Free Software Foundation. Anyway, is it possible to build and run LFS without this software? Definitely! Want some examples? Well, there you go: One of the base components of our system is a C compiler. Using it, we can build a fully functional system. Of course, the C compiler and its required libraries are a standard part of the GNU project. Cool Fact: Eric Anderson is developing the base library (libc) for C which also is a part of the GNU project. His library, named uClibc, is used mostly in embedded systems. Why? It is much smaller than its older brother, and works on pretty much every program that cooperates with the “original” libc. An interesting GNU program for a regular user is BusyBox. Its authors call it the “universal penknife for embedded Linux systems”. BusyBox is actually a program that has functionality of almost all the coreutils packages (Coreutils is a collection of the most frequently used command line programs in Linux, like: cat, chown, mv, uname, who, cp, ln). The interesting thing about BusyBox, is that it “knows” what should be used in a given situation. In other words, it knows for example when to become a text editor, and when to copy files. In depends on the actual name that we use to run the program. So for instance, if we change the program name from Busybox to vim – it will become an text editor, if we change it to ln – it will be used to create symbolic links, and the good about this is that we don’t have to create backups. All we need to do is to create a copy of it using the “ln” command, which will allow us to link it to the program we want to use. Just to let you know, the “ln” tool, is one of the most useful and powerful utilities for Unix systems.
GNU/Linux without… Linux
Now, lets think about GNU/Linux without Linux. Is it possible to build a GNU/Linux without Linux? Well, going back to things I mentioned above – the GNU system is supposed to natively works with the Hurd kernel. So it’s kind of a rhetorical question to ask. Anyway, although there’ve been many attempts to run a GNU system, using the Hurd kernel, even a long time after the introduction of Linux, they don’t really work, at least not yet. For those keen on trying the experimental stuff — there’s a Debian GNU/Hurd project going on, that builds a Debian distribution on Hurd, and a couple alpha-stage systems with SunOS (Solaris) kernel in progress, the most important ones being: SchilliX, BeleniX and NexentaOS. But we’ll leave all that for another article
Operating System — the general definition states that it is a program, which constantly works from the moment we start our computer to a complete shutdown (or restart). All other programs are application programs. We can actually put an equals sign between the word “kernel” and the technical meaning of the word “operating system”.
Nowadays, we can also call a working environment by using the term “operating system”. That is why, we can say that Linux counts as a full system, although this name also applies to the kernel. In this article I used the phrase “operating system” to describe a kernel, and a “system” to describe the fully operational environment.
- LFS’ website – http://www.linuxfromscratch.org/
- Distrowatch – http://distrowatch.com/
- VirtualBox – http://www.virtualbox.org/
- GNU – http://www.gnu.org/
- BUSYBOX – http://www.busybox.net/
- uClibc – http://www.uclibc.org/
- Embedded systems – http://en.wikipedia.org/wiki/Embedded_system
- Debian GNU/Hurd – http://www.debian.org/ports/hurd/
Translated by: ColdX