Long Preamble
Acknowledgements: I mastered remastering by following a guide posted on the DSL
forums. I recently discovered the guide is also available
here. It is, however, very compact, and
does not readily show up on Google searches. My purpose in writing this article
is to offer additional instructions for those who find a raw list of terminal
commands intimidating, to demonstrate why remastering CDs is useful, and to
partially explain what those console commands are actually doing. If all you
want to know is how to remaster a DSL CD, skip to the last section, or just
click on the link above. You don't need to hear me blather on about things that
are, for the most part, inconsequential trivialities. On the other hand, maybe
you have never encountered DSL before. Or perhaps you have, but are not sure
what the benefits of remastering a CD are. Or maybe, just maybe, I'm itching for
an excuse to wax lyrical about my new-found pride and joy. But you know, context
is important.
And now we begin...
I am studying post-graduate Computer Science. We are expected, encouraged and
graded on our ability to understand and work with Unix systems. However, many of
the labs run Windows, and although they do provide an X server, it chugs along
painfully slow. Those of us who wish to use Linux with any degree of speed and
stability are expected to supply our own. So, for a time, I did. I borrowed my
girlfriend's laptop and installed Ubuntu and Sun's JDK. That was me set, and for
a time, all worked well. But the laptop was due for repairs, and when it was
sent away I needed to find some other solution.
I thought about USB flash drives. I doubted the lab PCs would be able to boot
from USB. And even if they could, I did not wish to trust my data to a flash
drive. I've been burned before. I decided a live CD would be the way to go. I
could boot up in the lab, or on my office PC during lunch, and work in my
preferred environment. No need for a hard-drive, or even a flash drive. I could
work on the RAM disk, then back up to the University's server via SSH.
There are many, many Live CD distributions. But I needed the Sun JDK, and as the
licence1 makes redistribution a chore, it seemed I would have to roll my own.
For that, I wanted something lightweight. Aside from the JDK, all I needed was
GCC, Vim and a simple web-browser. I decided the way to go would be to start
with the absolute basics, and add on what I needed. A Debian-based system would
also be a bonus. When you're venturing into the unknown, it always helps to
start the journey on familiar ground.
With these things in mind, I chose
DSL as the basis for my new toy. For those
unfamiliar with the Distro, DSL is a severely stripped down version of
Debian/Knoppix. The distribution aims to include as many useful applications as
possible while remaining under 50MB. It uses a 2.4 series kernel, busybox, a
tiny little Xserver, Fluxbox as the default WM, and a host of other microscopic
office, media and Internet applications. It is designed to be easily expandable
by via a system called 'MyDSL'. MyDSL packages come in several flavours and
formats.
By installing the 'dpkg' MyDSL package, you can basically convert DSL into
Debian. However, the advantage of DSL packages is that any DSL package in the
root directory of the boot CD will be installed at boot time. As of DSL 2.3, you
can also place MyDSL packages into an /optional folder on the CD. These will not
be installed, but menu entries will be created allowing you to activate them at
will. DSL now also contains a script that lets you remaster a CD with your
chosen MyDSL extensions. Or you can leave the CD alone and specify at boot time
where DSL should look to find your packages. So if the programs and libraries
you want are in MyDSL, you're pretty much good to go. DSL does have a package
for Sun's JRE. But it does not have one for the JDK. If you, too, wish to
include a program on your DSL CD that there is no package for, we're going to
need to do an old-fashioned remaster after all.
Short HOWTO:
- You will need:
- A reasonably decent machine. 512MB RAM recommended, less may not work, and
obviously a CD burner. OS does not matter, but you will need a Linux-writeable
partition. I.e. Ext2/3, FAT32... whatever.
- A working DSL CD. I used DSL 2.3, but this HOWTO should also work fine with 2.4
- Patience... and preferably some CD-RWs. You probably won't get it right the first time.
- Basic Linux knowledge. I'm going to cover remastering, and installed the JDK,
but assume if you want to something like change the default background or
Firefox bookmarks, that you either know how to or can find out.
- Boot off the DSL CD and do whatever you want to it. Add themes, customise
your .vimrc, download extensions. You know... have fun. Whatever you want to
work, get it working. It's a good idea to take note of where any MyDSL packages
you are downloading are ending up. If you use the MyDSL GUI to grab your
packages, the default is /tmp. So that's what I'll be using in my examples.
Installing the GNU system utilities (to replace Busybox) might be a good idea. .
I also included vim, dpkg, the broadcom57xx network drivers (needed on Dell
computers among others), a bunch of themes and a few small games.
- For Sun's JDK, download the .bin version, not the RPM. Run the .bin file and
then copy the extracted folder somewhere. I put it under /usr/java. But whatever
works for you. Then either set up symlinks, or add the Java directory to your
path. E.g.
$ echo 'PATH=$PATH:/usr/java/jdk1.5.0_06/bin/' >> ~/.bashrc
Then open a new terminal window and type 'java' and 'javac' to make sure it's working.
- From the terminal, mount a local partition. In my case, I had a partition on
a second HDD I'd used to play around with Gentoo. DSL will automatically create
directories in /mnt and fstab entries for partitions it detects, but does not
mount them automatically. So from the terminal, type:
$ sudo mount /mnt/hdb5
...where 'hdb5' is whatever partition you are going to use temporary storage.
- Hop onto that drive, and create the directories we'll need to remaster the
CD. I was using the root partition of a Linux install, so I put these
directories in /tmp. Please adapt these instructions to suit your needs:
$ sudo su
# cd /mnt/hdb5/tmp
# mkdir source newcd newcd/KNOPPIX
- Now we copy the liveCD 'scaffolding' and other needed files into the
appropriate directories. You need to have the DSL CD mounted for this step. Keep
in mind that the 'newcd' directory we created is going to become the top level
directory of the remastered CD, not the root directory of the Linux system
you'll see after you boot the CD.
# cp -Rp /cdrom/boot newcd
# cp -Rp /cdrom/lost+found newcd
# cp -Rp /cdrom/index.html newcd
Next step is to copy the actual Linux system into the source directory.
# cp -Rp /KNOPPIX/* source
# cp -Rp /KNOPPIX/.bash_profile source
- Everything under 'source' will be the new '/' when you boot off the
remastered CD. At the moment your remastered CD is identical to the old one. So
now we have to set up the file system just the way we want. This is the
trickiest step, and the one where the most errors will occur. The actual steps
involved depend on how you want to customise your CD. Here are the instructions
for Sun JDK, and some general guidelines and tips:
- Many MyDSL packaged programs install themselves in /opt. For example, vim63 and Python. So you can type:
# cp -Rp /opt/* source/opt/
to dump recreate your current /opt/ on your remastered CD. However, you'll also
need to make sure there are symlinks in /usr/bin/ pointing to the right places.
E.g. For 'vim63'
# ln -si source/opt/vim63/bin/vim source/usr/bin/
# ln -si source/opt/vim63/bin/vim source/usr/bin/vi
This will save you some time during the boot process, as DSL will not have to search for and extract the packages at boot-time.
- MyDSL packages that don't put themselves in completely in /opt/ are probably not
self-contained, and will have files all over the place. If you're not sure what
it's put where, or how it works, you're probably better off just copying the
package to the root directory of the CD, and letting DSL do the hard work for
you. For example, you can make sure the broadcom57xx drivers are installed on
boot by downloading bcm5700.tar.gz using MyDSL and then:
# cp /tmp/bcm5700.tar.gz newcd
- If you have a DSL extension that might be useful on some machines, but don't
want to waste time installing it on every machine (for example, the game
nethack), make an 'optional' directory on your CD and copy the package there.
# mkdir newcd/optional
# cp /tmp/nethack.dsl newcd/optional
- Most programs that can be personalised will have their configuration file in
your home directory, prefixed by a '.' e.g. .vimrc for Vim. If you're planning
to use DSL as a single user system, then it's fine to just copy all those '.'
files into source/etc/skel/
# cp -Rp /home/dsl/.* source/etc/skel/
- For the Java SDK, (assuming you installed it in /usr/java):
# cp -Rp /usr/java source/usr/
Then make sure your remastered PATH variable will point to the JDK directory.
One way to do that would be to edit /etc/skel/.bashrc and add the following
lines at the bottom
JAVA_HOME=/usr/java/jdk1.5.0_06
PATH=$PATH:/usr/java/jdk1.5.0_06/bin/
- I hope you have CD-RWs, because there's a very good chance you made a mistake
somewhere during the previous step. But don't worry, plough on regardless, and
you can easily go back and clear up anything you missed later.
- Now we need to turn our source directory into a compressed file system
# mkisofs -R source | create_compressed_fs – 65536 > newcd/KNOPPIX/KNOPPIX
- Now we create the complete iso file:
# mkisofs -no-pad -l -r -J -no-emul-boot -boot-load-size 4 – boot-info-table -b
boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o mydsl.iso
newcd
- After that's done, we'll have a 'mydsl.iso' file ready for burning. You
might not be able to burn it from MyDSL unless you used the 'dsl toram' boot
option, or have a second CD drive. But hopefully you can access whichever
partition you created the .iso on from an OS with a good CD-burning program.
Just make sure you choose 'burn CD from ISO', or a similarly named function.
Otherwise, you'll just end up with the .iso file sitting uselessly on a data CD.
- Now try it out! Boot off your newly remastered CD, and see what works, and
what doesn't. Take note of what isn't working, what you forgot to do, then go
back to step 9 and fix it up. Note that you don't have boot off the original DSL
CD at this point. Steps 8 to 10 will work fine off your remastered CD, so long
as it actually boots.
And that's Remastering DSL in, as they say, a nutshell. Remastering might become
a something of a lost art over the next few years, with the decreasing cost of
solid-state storage and PCs that can boot from USB drives. But if you're a
little paranoid about running down a flash-drive by running an OS off it, or
you're working with slightly older hardware that will not easily boot off a
flash-drive, there's nothing like your very own remastered CD, a custom set of
applications and tools that you can carry wherever you go. |