Open Source Market Segment LS
Open Source Market Segment RS
Tuesday, 26 June 2007 09:18

Roll your own Linux distro


There's no denying Linux is a popular operating system and is genuinely seen by many as a viable alternative to Microsoft's market domination.

However, once having decided to go with Linux, the next question is which Linux distribution to use? Fans wax lyrical about their favourite "distro". Understandably, this can cause further anxiety to newcomers keen to make the right choice.

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.

You should also consider the default programs you would like to supply. For instance, is your preferred command-line interpreter the bash shell? Or do you prefer csh? Will you opt for sendmail for e-mail management, or do you prefer exim? Are you a vi or a pico person? One advantage of a customised Linux distribution is that it can work exactly how you want. If your aim is to provide a distro for many people to use then you will want to be flexible with your choices.

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 ...

The second option is to target Crystal ROCK and customise it. In this case you do not actually build your own Linux as such but begin with a perfectly fine distro and tweak it to more suit your needs.

Commence by downloading the ROCK source tree from its Subversion repository. 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 and holds basically just a label for your distro that can be used to reference 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 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 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.

As mentioned earlier, your distro-building exploits will begin on a stable version of Linux with up-to-date libraries and tools. Linux from Scratch have constructed a list of what they deem essential to such an undertaking, along with minimum versions required. A script is provided on that page to list the installed versions of these tools; you can compare the script's output to the list to determine what needs upgrading or installation.

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.

Read 21597 times

Please join our community here and become a VIP.

Subscribe to ITWIRE UPDATE Newsletter here
JOIN our iTWireTV our YouTube Community here


Thoughtworks presents XConf Australia, back in-person in three cities, bringing together people who care deeply about software and its impact on the world.

In its fifth year, XConf is our annual technology event created by technologists for technologists.

Participate in a robust agenda of talks as local thought leaders and Thoughtworks technologists share first-hand experiences and exchange new ways to empower teams, deliver quality software and drive innovation for responsible tech.

Explore how at Thoughtworks, we are making tech better, together.

Tickets are now available and all proceeds will be donated to Indigitek, a not-for-profit organisation that aims to create technology employment pathways for First Nations Peoples.

Click the button below to register and get your ticket for the Melbourne, Sydney or Brisbane event



It's all about Webinars.

Marketing budgets are now focused on Webinars combined with Lead Generation.

If you wish to promote a Webinar we recommend at least a 3 to 4 week campaign prior to your event.

The iTWire campaign will include extensive adverts on our News Site and prominent Newsletter promotion and Promotional News & Editorial. Plus a video interview of the key speaker on iTWire TV which will be used in Promotional Posts on the iTWire Home Page.

Now we are coming out of Lockdown iTWire will be focussed to assisting with your webinars and campaigns and assistance via part payments and extended terms, a Webinar Business Booster Pack and other supportive programs. We can also create your adverts and written content plus coordinate your video interview.

We look forward to discussing your campaign goals with you. Please click the button below.


David M Williams

David has been computing since 1984 where he instantly gravitated to the family Commodore 64. He completed a Bachelor of Computer Science degree from 1990 to 1992, commencing full-time employment as a systems analyst at the end of that year. David subsequently worked as a UNIX Systems Manager, Asia-Pacific technical specialist for an international software company, Business Analyst, IT Manager, and other roles. David has been the Chief Information Officer for national public companies since 2007, delivering IT knowledge and business acumen, seeking to transform the industries within which he works. David is also involved in the user group community, the Australian Computer Society technical advisory boards, and education.

Share News tips for the iTWire Journalists? Your tip will be anonymous




Guest Opinion

Guest Interviews

Guest Reviews

Guest Research

Guest Research & Case Studies

Channel News