Hacking DSL

From DSL Wiki

In other languages: espaƱol


Hacking DSL

For some of us, extending DSL with MyDSL extensions is simply not enough. Especially when it comes to subtracting stuff. So here's a page dedicated to hacking DSL to make it work the way you want it.


  • This method is applicable mostly to the frugal install users.
  • It involves the modification of KNOPPIX cloop image.
  • Right now.. this is somewhat 'quick and dirty'.

If the system seems to hang while building the cloop, do a sysrq and try removing 'toram' in the kernel command line.

First off locate where your KNOPPIX image is stored, usually in /cdrom/KNOPPIX/KNOPPIX. Setup a loop device to access the compressed loop image.

losetup /dev/cloop1 /cdrom/KNOPPIX/KNOPPIX

mount the cloop:

mkdir -p /mnt/loop
mount /dev/cloop1 /mnt/loop

Copy everything in the loop to a temporary storage:

cp -a /mnt/loop/* $SAND_BOX
rm -rf $SAND_BOX/.rr_moved

Replace <path_to_storage> with an appropriate path. Make sure you have enough space in there. It's going to be around ~255 Mb. Example SAND_BOX=/tmp/my_knoppix where /tmp/my_knoppix has more than around 260 Mb of free space.

You must remove $SAND_BOX/.rr_moved and its content because mkisofs(8) will attempt to recreate it. That attempt will fail if the directory already exists.

Once inside your SAND_BOX, hack to your heart's content.

Here's an example on adding the latest mplayer binary codecs in DSL-n 0.1RC4 (as of Apr-20-2007):

mkdir -p $SAND_BOX/usr/lib/win32/
cd $SAND_BOX/usr/lib/win32/
wget http://www1.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
tar jxvf essential-20061022.tar.bz2
ln -s essential-20061022/* .

When you are done, create a new compressed loop image:

mkisofs -hide-rr-moved -allow-leading-dots -R -l \
  -V "KNOPPIX ISO9660" -v -allow-multidot $SAND_BOX |
    create_compressed_fs - 65536 > <path_to_your_KNOPPIX_directory>/KNOPPIX2

where <path_to_your_KNOPPIX_directory> is where you have your original KNOPPIX image (usually /cdrom/KNOPPIX/); and KNOPPIX2 being the name of our new cloop image.

the create_compressed_fs process can take considerable time to run, especially if your build system is light on processor power. For example, a 233MHz i586 takes around 30 minutes to execute the above pipeline and produce a 1835-block image.

Unmount and detach:

cd $HOME
umount /mnt/loop
losetup -d /dev/cloop1

Alternate method using Ubuntu

Here's a short version of the above directions with a few tweaks to avoid the need for the cloop module (the extract_compressed_fs tool works just fine). I've tested it with Ubuntu 8.04.1. Note: perhaps an error, but this doesn't seem to work on Ubuntu 8.10

$ sudo apt-get install cloop-utils genisoimage
$ sudo mount /media/cdrom
$ cd /path/to/scratch_dir
$ extract_compressed_fs /media/cdrom/KNOPPIX/KNOPPIX > uncompressed-image
$ mkdir mnt1
$ sudo mount -o loop uncompressed-image mnt1
$ cp -a mnt1 extracted
$ rmdir extracted/.rr_moved
$ sudo umount mnt1
$ cd extracted
$ tar xvzf /path/to/addon/whatever.dsl
$ cd ..
$ mkisofs -hide-rr-moved -allow-leading-dots -R -l -V "KNOPPIX ISO9660" -v -allow-multidot $SAND_BOX | create_compressed_fs - 65536 > KNOPPIX2

To inject it into a new ISO:

$ cp -a /media/cdrom/ disc
$ cd disc
$ mkisofs -pad -l -r -J -V MyDSLCore -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o ../dslcore-test.iso .


Since we've named our new image KNOPPIX2 we'll have to modify the kernel command line to make DSL load this new image instead of the original. Add the boot option:


(maybe case insensitive/sensitive depending on your filesystem) in your /etc/lilo.conf or /boot/grub/menu.lst — whichever boot loader you may be using.

Publishing Your Hack (if you wish to)

Enter a new topic in the System section of the DSL Forums. Describe what you've done, the purpose of the hack and how people can contact you to try out your hack.

Please note: These hacks are not part of Damn Small Linux. If the developers like your hack, they may take it up, but that's their choice.

You should also be careful about selling or appearing to sell your hack, especially as "Damn Small" Anything. At the very least, have the decency to offer it back to the DSL developers instead of just forking another DSL.

Desired Hacks

See Desired Hacks if you have a hack you'd like to request.