At heart, what we mean by "Linux" is two fundamental items: the kernel and the non-kernel parts. The kernel is the central component of most operating systems which manages resources and communications with hardware. It typically makes the lowest-level computer components available to software applications. This is the heart of any operating system. When people speak of Linux being created by Linus Torvalds, it is specifically the kernel that is meant; it was this which provided the basis and framework for all other applications.
The "non-kernel" therefore is everything else. This is software like the raft of networking tools for which Linux is well-known - web servers like Apache, programming language compilers and interpreters like Java, GNU C++, Perl and Python - and more.
The reason why Linux distributions are called "distributions" in the first place is that each distro is a collection of the kernel plus any of a number of software packages, distributed together. These packages are largely drawn from the GNU free software project. All distros provide facilities for managing the installation, removal and upgrading of discrete software packages.
What makes one distro different from another is generally the audience for which it is targetted. Some distros contain commercial enterprise-level applications, particularly for security and backup purposes. Some are designed more for servers than desktops. Some are targeted at power users more than home users. Additionally, although Linux distributions are freely available, commercial vendors can derive income through paid support for their distro.
So, what do you do if there's no distro which meets your specific needs? Or, what if you want a distro that doesn't bother you with any pesky prompting but just sets itself up exactly how you like it? In these cases - or even just for the fun of it - you can always make your own distro. And here's how.
The first thing to do is away from the keyboard. First, you must consider what you wish to achieve. What will be the aim of your distro? Possible reasons are to optimise for, or to target, a particular CPU. Alternatively, you may wish to create a highly specialised system for specific purposes.
With these decisions over, the real work can begin!
The starting point to making your own Linux distro is, rather ironically, from within an existing Linux distro. This way you have all the tools you need at hand. You will also need up-to-date libraries and supporting utilities.
You may choose to use a distribution building kit - like ROCK - or you may wish to start directly from scratch. The advantage of the former approach is much of the laborious work is taken away and results can be achieved faster. However, the advantage of the latter is that the distro can be customised to far more depth and that you will have a much finer-grained understanding of the processes that have taken place.
Let's see what is involved in both of these approaches walking through both. When we considered this article, we had detailed instructions in mind. However, the full steps required are not trivial: the Linux from Scratch project, for instance, have an entire 253-page book devoted to the exercise! Therefore, we will instead give pointers to further reading and to the tools necessary - but more than that, what this article aims to do is instil in you both the inspiration to create a distro and the confidence to do it.
ROCK Linux is a flexible distribution build kit. It offers three broad options. The first is to simply use Crystal ROCK as your Linux distro of choice, and not actually do anything yourself. Obviously, this defeats the purpose of what we wish to do in this article, but it leads us nicely into ...
Commence by downloading the ROCK source tree from its Subversion repository. https://www.rocklinux.net/svn.html Change directory into the top-level scripts directory and execute the Config script. This presents the ROCK's build menu, to modify the Crystal trunk. You have options to specify the target hardware architecture, included languages and a variety of other options. Once your chosen options are set, a long wait begins: ROCK needs to download the sources for the packages you elect to include, and then compile them. It will opt for the fastest mirror it can find but both the download and subsequent compile can take anyware between hours and days to longer depending on your options and the power of your system.
You now have your very own Linux distro! However, although it exists on your hard disk, it's not easily deployed. To make a bootable CD or DVD run the Config script again any select the bootdisk target. Build this and finally run the Create-ISO script to make your target media.
The third option is to build your own Linux distro, doing with it as you wish.
You begin this way the same as above, by downloading the ROCK source tree. Before executing any scripts, you must create configuration files called preconfig.in and config.in. preconfig.in holds basically just a label for your distro that can be used to reference in. config.in is much more detailed. This contains a list of every package your distribution will supply, and whether it is to be included by default.
You next must make your own build script to actually compile all the necessary packages. As this reads from preconfig.in you really do not need to modify the build script to make your distro work, but here you really can employ all your creative powers to tailor the compilation and packaging of your distro however you wish. Any conceivable option can be implemented so long as you can imagine it and you can code it. A variety of build.sh scripts are provided to give inspiration. It is worthwhile reading through these and tinkering with them.
Finally, build with the bootdisk target and execute the Create-ISO script as above to send your custom distro to a bootable CD or DVD.
That's ROCK in a nutshell. We've been brief, but really there is little more to the process. Besides having loads of hard disk space spare and the patience to wait for your distro to build, ROCK really simplifies the job. Whichever method you choose, you'll find easy instructions with precise commands at the ROCK Linux web site.
For the hard core, the Linux From Scratch project gives far more low-level detail describing and explaining every single step necessary to build a custom distro without any existing code or basis.
Some items on the list may be a point of debate; for instance, while the bash shell is common and well-regarded, other shells - csh, ksh, and zsh being three - have their advocates. Nevertheless, the Linux from Scratch list is an extremely useful starting point. Any would-be distro builder would do well to ensure compliance with the tools and libraries and versions recommended.
Next, a recommended suite of source codes is presented. The total size of these come to about 180Mb. These items are not the final list of packages your distro will supply - not yet - but rather those deemed necessary for making a minimal Linux system. They will be used to construct a temporary system. When ready you should actually be able to boot your computer into this temporary, bare-bones, system and complete work here, free from any debris or detris.
A final critically important package is presented later by Linux for Scratch, but is worth mentioning here. This is the LFS-Bootscripts package which provides scripts to check file system integrity, halt the system, start and stop network devices, manage the master run-levels, enable and disable swap space and other functions essential to the well-being of a multi-user multi-tasking operating system.
It has to be said that the team behind Linux from Scratch have put a lot of thought into their instructions. They give sensible and pragmatic advice which helps minimise any risk of disaster: they advocate having an empty disk partition to work with and to have a special non-privileged lfs user account to work from. This avoids corrupting your live system and avoids the potential of inadvertant damage from running as root.
With all this groundwork out of the way, it's time to gather together the packages your distro will supply and which ones it will automatically install. Here is where you can make a major design decision about your distro.
You might opt to make a very specialised configuration - with an ERP system and without a web server, for example. Or you might want to stick it to the man by including the Mono project's .NET framework for Linux and a collection of .NET applications or websites, making them enjoy the liberation of Linux. As an example, SplendidCRM is an open source but Microsoft-centric customer relationship system (CRM) which has been successfully run on Linux. In many ways, it is a better system than the original LAMP system it re-engineers. It's not hard to imagine the worth of a completely open source Linux distro that provides an enterprise CRM with backend database and no reliance whatsoever on - or distribution issues involved with - Microsoft software.
Linux from Scratch does not favour one package manager over another. They give advice on what a good package management system should do but leave the actual selection to the reader. Thus, along with the packages themselves, this is another opportunity to make your distro unique.
It's by no means the final opportunity. Linux from Scratch ends at this point, with a bootable customised Linux operating system on your system - but you can go in many further directions. One thing you will want to do is capture your distro onto CD/DVD as can be done with ROCK. You might wish to make alternative builds of your distro for different system architectures. You might wish to make your distro automate its installation so the user has no, or minimal, prompting. You may desire heightened security. All of these choices are described in depth in Beyond Linux from Scratch - and other advanced subprojects. That should be your next port of call.
No matter which method of distro-building you choose to employ, the ultimate fact is your distro can be whatever you wish it to be. The only limiting constraint is what you can imagine. And we at ITWire wish you the best.