Software // Enterprise Applications
News
1/23/2008
09:28 AM
Connect Directly
Google+
Twitter
RSS
E-Mail
50%
50%

How To Roll Your Own Linux Distro

Whether you want to customize Knoppix, respin an existing distribution of the open-source operating system, like Puppy Linux, or are intent on creating your own package from scratch, we'll walk you through the process.

Puppy Unleashed involves taking a large (1.5 GB) archive of all the available packages for Puppy and using that to build a custom distribution. Obviously, the downside to this approach is that it requires that you download the whole package archive and know a fair amount about what you're tinkering with. Another possible starting point with Puppy is Empty Crust, a heavily stripped down version of Puppy Linux 1.0.7. It's admittedly several revisions behind the current version of Puppy when you take it out of the box, but still useful for this sort of work.

I've used Puppy as the major example for remastering/respinning Linux because it's one of the simplest, but there are many other major distributions that have similar functions. The ever-useful Knoppix, the live-CD distribution from which many others are commonly built, has a walk through that describes how to customize Knoppix quite thoroughly, from adding or removing packages to customizing the look-and-feel of the system. And Ubuntu, too, has a method for customizing its install CDs, although the tutorial in question isn't very automatic -- there are, however, community-written scripts to make the job that much easier.

As a side note, I should mention a clever online tool I encountered for creating your own custom distribution: the Custom NimbleX CD builder, which generates a custom-assembled .ISO of the tiny-but-useful NimbleX distribution. It's not as flexible as actually assembling a distribution by hand, but it's still quite useful.

Linux From Scratch

The next step up for those who are a little more ambitious about rolling their own distribution is Linux From Scratch.

LFS (as I'll abbreviate it herein) is both a distribution and an online guidebook for creating your own Linux distribution. The LFS LiveCD, which gives you a thoroughly spec'd-out environment for building your own Linux installation, includes a full copy of the book itself on the CD, and contains the sources you'll need to perform all the builds. It's to Linux what Heathkit was to radios and early personal computers.

LFS assumes that you already have a fair amount of working knowledge of Linux. At the very least, you should be able to find your way around the command line and follow directions. That said, one of the beauties of the LFS approach is that every single command you use to build the whole distribution is documented from the inside out, so you aren't just blindly following a set of instructions. The implications of everything you're doing -- every command, every syntax switch -- are made clear to you all along.



(click image for larger view)


Preparing a Linux From Scratch session via one of the automation scripts. This isn't a substitute for knowing how to build a distribution in LFS; you still need to know how to conduct the build process from beginning to end.

View the image gallery.

The actual creation of the new LFS Linux system is done by using an existing Linux installation, a "host," as an environment in which to do the work. Most of the time, you can just grab the LFS Live CD and use that, since it includes an environment that's been specifically tailored for this kind of work and reduces the number of variables that might crop up.

There' some parallels between erecting a building from scratch and using LFS to build a Linux distribution, and since it's a metaphor that the LFS authors also have employed throughout their book I'll also use that as a metaphor when it’s convenient.

1. Preliminaries. The first several steps are sort of like breaking ground and pouring the foundation for a new building. You'll be walked through setting up a file system (4 GB or so -- I'd say devote 8 GB or more; space is cheap), grabbing the basic set of packages needed to get things running, and setting up a few other prefatory bits like the user account you'll be using for most of the LFS work.

2. The Temporary System. The temp system is a little like the scaffolding for the building you're putting up -- it's not the building itself, but is essential to erecting it, and it will be removed when we no longer need it. The temp system consists mainly of the tool chain -- a set of utilities that you build that will in turn be used to build the distribution proper, such as the GCC compiler. The tools in the tool chain are themselves compiled from source -- a nice way to get some crash-course exposure to the concept of compiling from source, which is pretty indispensable when dealing with Linux and open-source software as a whole.

3. Building And Booting The System Itself. Here we actually get to begin constructing the distribution proper -- i.e., raising the building. As before, all this work -- like creating the directories most commonly used by the system -- will be done "by hand," with details along the way about what everything is and why it's implemented in this particular fashion. Then comes creating the boot scripts, which control the system startup process, making the system bootable, and (finally!) starting up your newly created LFS system.

Previous
3 of 5
Next
Comment  | 
Print  | 
More Insights
Building A Mobile Business Mindset
Building A Mobile Business Mindset
Among 688 respondents, 46% have deployed mobile apps, with an additional 24% planning to in the next year. Soon all apps will look like mobile apps and it's past time for those with no plans to get cracking.
Register for InformationWeek Newsletters
White Papers
Current Issue
InformationWeek Tech Digest, Nov. 10, 2014
Just 30% of respondents to our new survey say their companies are very or extremely effective at identifying critical data and analyzing it to make decisions, down from 42% in 2013. What gives?
Video
Slideshows
Twitter Feed
InformationWeek Radio
Archived InformationWeek Radio
Join us for a roundup of the top stories on InformationWeek.com for the week of November 16, 2014.
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.