The DistRogue

Monday, May 07, 2007

How to make a Live CD

Linux is a completely open-source family of operating systems (Linux itself isn't really an OS, but rather, a kernel), and so anyone can make their own distribution (in theory) and join in the action. But why do that? There are already hundreds of existing distributions, and odds are, one of them is right for whatever niche you have. This isn't a tutorial for making your own distro- that requires time, money, and m4d-1337 technical 5k!11z. This is how to make a Live CD for an application of your choice.

==Why have a Live CD?==

  • Portability. A program would normally have to be installed several times in order for it to be able to be used wherever you go, so why not put it on a CD?
  • Speed. Newsflash: If you dedicate an entire OS to just running one program, it'll run faster, and be more reliable.
  • It looks cool on a resumé. Wouldn't you like to say to a would-be employer, "I made my own Linux CD"?
Take a pick. The last one's especially important. It will get you unquestioned authority in computing.

==Choosing a base system==

There are a few options for a base system. Here are the best choices:
  • SLAX: The original remasterable Live CD. It runs a Slackware-based operating system with KDE. Only 200MB to start out.
  • Wolvix: An extremely feature-rich OS that uses XFCE and a ton of programs. I recommend the 1.1.0-beta series. The "Cub" edition is about 240MB, yet is a complete OS.
  • Myah: The version 2.0 series is pretty much the same as SLAX; however, the tech demos of the yet-unreleased Version 3 are i686-optimized (they run faster) and use XFCE. About 500MB.
Download the CD image (a .iso file) and extract it to a temporary folder in your home directory called "image".

==Adding the program==

SLAX 6-RC, Myah 3-TD1, and Wolvix 1.1.0 beta all use version 6 of the Linux-Live scripts. SLAX 5.1, Myah 2.2, and Wolvix 1.0.5, the stable versions, use version 5. This wouldn't be a big issue, except that the module format changed between those versions. It's probably a better idea to choose the newer versions of these distributions, because the new format makes smaller modules.
Make another folder called "program". Extract the file tree of the program to the folder. Inside, it should resemble a traditional Linux file system, with bin, etc, usr, or other folders (most of the time, it's just usr) in it.
Open up a terminal and type this:

cd image/name/tools

where name is either slax (for SLAX), wolvix (for Wolvix), or linuxcd (for Myah). Type the following commands:

chmod 755 *
mkdir ../modules
./dir2lzm ~/program ../modules/program.lzm

The first command makes all the tools for building LZM images (linux-live 6 modules) executable, so you can use them. The second makes a modules folder- this stores modules that are used at boot time. The third takes the program you made and turns it into an LZM file.

==Rebuild and burn==

You now have a file structure that you need to burn onto a CD. To do this, you need to make an ISO file.

cd ..
chmod 755 *.sh
./make_iso.sh

It will then prompt you for a name for the image. Hitting ENTER is usually fine.
In your home directory, there will be a CD image, ready to burn. Do so, but don't waste a CD-R on it, just use a CD-RW. It should fit, easily.

==Cut and try==

A Live CD usually doesn't come out right on the first try. Experiment with the image a bit. Here are some useful commands:

-lzm2dir: extracts an lzm file to a directory.
-chroot: allows you to run commands from inside another system. You can chroot to an extracted LZM file, for instance, and add or remove programs within the module itself.
-removepkg: This program comes with Myah OS, and allows you to cut down on the bloat that comes with it. ;)
-mo2dir: If you happen to have some old modules lying around, this convert them to LZM format.

==Examples==

The SuperTux Live CD is based on SLAX. The ThinkTanks Server Disk is based on Wolvix.

From Xubuntu 7.04,
The DistRogue.

Labels: , , , ,

3 Comments:

Anonymous devnet said...

You could also use PCLinuxOS...which allows you to customize the install you have and use the mklivecd command from the shell...creating your own customized LiveCD based on PCLinuxOS. It's always been able to do this since 2003 as well :)

6:02 AM  
Anonymous Anonymous said...

with MCNLive it is even easier. no need of a Hd installation, no command line. you just create your own live system while running the live cd, a few clicks :-)

11:27 AM  
Blogger DJ Gentoo said...

@devnet:
This, in my opinion, is an easier way of doing it. With PCLOS, you need an entire hard-disk installation, and the ISO file tends to be a ton bigger.

12:50 PM  

Post a Comment

<< Home