Using Slackware Linux as a Live CD Toolbox

Linux Live CD’s are very popular these days, especially since the inception of Knoppix. Live CD’s are very useful as a plug and play Linux systems for schools who want to use Linux beside their normal operating system, but Live CD’s are also useful for demo-ing Linux or to try if Linux works well on some machine. Another advantage of Live CD’s is that it is more difficult to break things, after rebooting the Live CD you will have a completely fresh system.

Warning: This document is based on Slackware Linux
8.1, but the instructions will probably work on Slackware Linux 9.0
without a hassle

Introduction

Those who bought an official Slackware Linux CD set already have a
Slackware Live CD. However, it is often more useful to make a custom
Live CD, which is tuned for some purpose. You can, for example, make
a CD-ROM which contains a live system and Open Office (a full-featured
office suite). In this document I will try to explain the basics of
making a Live CD. This is what you will need:

  • A system that runs Slackware Linux.
  • The Slackware Installation CD-ROM (CD1 of the Slackware CD set).
  • The Slackware “Ready-To-Boot Linux Disc” (CD 2 of the Slackware
    CD set).
  • A CD writer and the cdrecord and mkisofs programs.
  • Sufficient disk space.

If you do only have the installation CD you have to get hold of the
initrd.img file of the Live CD. The initrd.img file
contains a basic system that sets up the live system using some
initialization scripts.

Constructing the system

The first phase of making a Live CD is constructing the Slackware
installation that initrd is going to use. From now on I will presume
that you will construct the Live CD in the /root/livecd
directory. The first step is making the directory structure for
the Live CD:

mkdir /root/livecd
cd /root/livecd
mkdir isolinux
mkdir kernels
mkdir live

The isolinux/ directory will contain the files used to boot the
system (e.g. the isolinux bootloader for booting the CD), the kernels
that have to be available will be placed in the kernels/ directory,
and the live/ directory will be used to hold the Linux installation
of the Live CD. After creating the directory structure you can start
with installing the necessary parts of Slackware on the Live CD. For
this you will need the Slackware installation CD-ROM. Put the CD-ROM
in your drive, mount it and go to the slackware/a/ directory
on the CD. It is a good idea to install the complete “a” diskset,
because it is the base of the system, besides that the “a” packages
are not really big. You can install the “a” packages using the following
command:

installpkg -root /root/livecd/live *.tgz

Installpkg will show a short message for each package and after installpkg
is finished you have a basic Slackware system in /root/livecd/live.
Now you can add all packages you need (as long as it fits on a CD) by
executing “

installpkg -root /root/livecd/live

“.
Please be aware that many packages need extra libraries which also need
to be installed. Let’s look at an example. A while ago I made a special
browser live CD and installed the following packages beside those in
the “a” diskset:

libungif-4.1.0b1-i386-3
mozilla-1.0-i386-1
dhcpcd-1.3.22pl1-i386-3
glib-1.2.10-i386-1           
tcpip-0.17-i386-13
gtk+-1.2.10-i386-2
windowmaker-0.80.0-i386-2
xfree86-4.2.0-i386-5
xfree86-fonts-100dpi-4.2.0-i386-1
xfree86-fonts-misc-4.2.0-i386-1
xfree86-fonts-scale-4.2.0-i386-1

During the next step you will need to check some things and make some
minor adjustements to the system. It is a good idea to do this by using
the new system. First of all you need to make sure symbolic links for some libraries are in
place by executing “ldconfig -r /root/livecd/live/“.
Go to the /root/livecd/live/ directory and execute
chroot .“. After executing chroot the shell of the Live CD system
is started and the Live CD system is the / directory. This is
a good moment to check if you have all the required libraries. You can
do this by executing ldd /path/to/binary and look if there are
any libraries missing. Beware! This does not work for shell scripts.

If you gave installed XFree86 and want to use the kernel virtual framebuffer
execute “cp /etc/X11/XF86Config-fbdev /etc/X11/XF86Config“. If you
want to use your own XF86Config copy it to /root/livecd/live/etc/X11/
after exiting the chroot environment. Of course, it is also possible to
configure which window manager you want to use by executing the
xwmconfig” command.

When everything is set up as you like it you can exit the chroot
environment by typing “exit“.

Making the system ready to boot

To make the system ready to boot you will need the Slackware “Ready-To-Boot
Linux Disc”. Mount the CD and copy all files from the isolinux/
directory to /root/livecd/isolinux/ and the kernel you want to use
from kernels/ to the /root/livecd/kernels/ directory. In
this example I will use the bare.i kernel (use kernels/bare.i/bzImage
on the Slackware Slackware “Ready-To-Boot Linux Disc”) and rename it to
bare.i (/root/livecd/kernels/bare.i).

After that the /root/livecd/isolinux/isolinux.cfg needs to
be configured. The original file provides a good example how isolinux
can be configured. For the browser Live CD I only use the bare.i
kernel without a boot prompt for entering extra parameters. This
is my isolinux.cfg file:

default /kernels/bare.i initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 ramdis
k_size=16384 rw root=/dev/ram SLACK_KERNEL=bare.i vga=ask
prompt 0

The “vga=” is een important parameter. This parameter allows you to
specify which graphical mode you want to use. Read the
Documentation/fb/vesafb.txt file in the kernel source directory
for more information and a summary of the VESA modes.

Toasting the CD

At this point isolinux and the system are ready to be used. The only
things which are left to do is to create an ISO image and burning the
CD. An ISO image can be created by executing the following command in
the /root/livecd/ directory:

mkisofs -o /root/livecd.iso -R -J -hide-rr-moved -v -d -N -no-emul-boot -boot-lo
ad-size 32 -boot-info-table -sort isolinux/iso.sort -b isolinux/isolinux.bin -c 
isolinux/isolinux.boot .

This will create the ISO image /root/livecd.iso. The “-b” parmeter
specifies which file has to be used as boot program for the CD. Normally
this is used to specify a floppy image for BIOS floppy emulation. Isolinux
does not need floppy emulations, so the “-no-emul-boot” parameter is also
specified.

Last, but not least, you have to burn the ISO image to an empty CD. This
case does not differ from burning another CD. E.g., if you have a 24
speed CD writer which is SCSI device 0,0,0 (you can get the device
number by executing “

cdrecord -scanbus

“), you can burn
the ISO by executing

cdrecord -v speed=24 dev=0,0,0 /root/livecd.iso

“. After that
you can boot your Live CD to see if it works.

Some final remarks

It can be annoying to test you Live CD’s. First of all, it can cost
you a few CD’s, so it is a good idea to test the live system with CD-RW
discs. Besides that it takes a lot of time to make an ISO image, burn
the CD, reboot, etc. Some virtual machines (VMWare, Bochs?) support
booting from ISO images. When using a virtual machine you only have to
recreate the ISO after making modifications.

If an ISO image is larger than 650 or 700 MB it does not fit on a
normal CD-R disc. Linux kernel 2.4.14 and newer versions support
transparant decompression which allows you to fit to 1500MB on a
single CD-ROM in some situations. Have a look at the mkisofs
and mkzftree manual pages for more information.

Some parts of the systems can not be tuned by modifying files in the
live/ directory, like modifying initializations files or other
/etc files, like /etc/motd, because they are included
in initrd.img. initrd.img is a compressed disk image
which can be decompressed with gunzip, after that you can mounted
using the loopback interface (

mount -o loop "image"
"mountpoint"

).

6 Comments

  1. 2003-06-09 5:05 pm
  2. 2003-06-09 5:46 pm
  3. 2003-06-09 6:29 pm
  4. 2003-06-09 6:58 pm
  5. 2003-06-09 8:55 pm
  6. 2003-06-12 4:42 pm