[University of Manchester]   [ISBE]

TINA KNOPPIX logo


menu

Index
 +introduction
 +developers
 +contact
About
 +First run
 +description
 +screenshots
Changelog
 +updates
 +bug fixes
Software
 +TINA libraries
 +iso download
Documentation
 +manuals
 +TINA memos
Remastering info

Remastering Instructions

This section lists the full process used to remaster the KNOPPIX CD to produce TINA KNOPPIX. It draws from a number of sources: mainly the HOWTO at knoppix.net and the O'Reilly guide. Another remastering guide is available here. In addition, the O'Reilly guide Knoppix Hacks by Kyle Rankin contains a wealth of useful information.

KNOPPIX manages to include about 2GB of linux software on a 700MB CD by using a compressed file system. The aim of the remastering process is to produce three copies of the KNOPPIX distro on hard disk: a copy of the compressed file system, which you can later overwrite in order to test your creation; a non-compressed copy of the file system which you can alter during the remastering process, from within your existing linux distribution; and a backup of the expanded verion in case you need to restart the process. In order to set this up, you will need five things:
  • A PC with an existing linux distribution.
  • A working KNOPPIX CD: get an iso file from the KNOPPIX website and burn it to a CD using your favourite burning software (I used Nero under windows).
  • A 1GB partition to hold a bootable KNOPPIX distribution.
  • 5GB of disk space in which to remaster the KNOPPIX distribution and to set up a swapfile
  • A kicklist. This file lists the software packages you want to remove in order to create space for your own software (in this case TINA and related files).
Make sure that you back up any important data on your PC before you start.

The hardware I used for this process was an AMD Athlon 64 3500+ on an ASUS A8V Deluxe motherboard, with 1GB of RAM and two Maxtor 160GB hard disks, partitioned as follows:
hd0,1 70GB FAT32 Windows ME
hd0,2 10MB Ext2 Suse Linux 9.1 32 bit /boot
hd0,3 2GB Swap Suse Linux 9.1 32 bit swap
hd0,4 88GB Reiser Suse Linux 9.1 32 bit /
hd1,1 50GB FAT32 Windows XP
hd1,2 20MB Ext2 Suse Linux 9.1 64 bit /boot
hd1,3 2GB Swap Suse Linux 9.1 64 bit swap
hd1,4 Extended
hd1,5 90GB Reiser Suse Linux 9.1 64 bit /
hd1,6 9GB Ext2 Mounted on /knoppix_remaster
hd1,7 2GB ext2 Mounted on /knoppix
For some inexplicable reason, on my machine these appear as hdi and hdj under Suse, but as hde and hdf under Knoppix.

Part 1: The Poor Man's Install

There are several ways to install KNOPPIX onto a hard drive: see the forums and documentation at knoppix.net for the latest instructions. The remastering technique adopted here uses two hard-drive installations: a "poor man's install", where the compressed file structure from the cd is copied directly to the hard drive and booted using LILO or GRUB, and a second installation where the KNOPPIX file system is expanded onto the hard drive. The first can be used for testing, and the second is used for the actual remastering. This section covers the poor man's install.

Step 1: Create the 1GB partition

Create an empty linux partition of around 1GB: this could be situated on an additional hard drive, or you could resize an existing partition. You will need to be able to boot this partition later, so don't put it on an external hard drive unless you know how to boot from one. In my case, this partition was hd1,7.

Step 2: Create the KNOPPIX directory structure

Insert and mount the KNOPPIX cd. Mount the newly created partition: the following assumes you mount it as /knoppix_cd. Copy the entire contents of the KNOPPIX cd to the newly created partition. Remember to preserve permissions on everything you copy (use cp -rP).

Step 3: Copy the boot image

With earlier versions of KNOPPIX (before 3.4), you have to extract the boot image as follows:

Create a directory on the newly created partition called harddrive_boot. Mount the KNOPPIX CD (the following assumes you mount it on /media/cdrom). Mount the file /KNOPPIX/boot.img on the CD as a loop device:
losetup /dev/loop0 /media/cdrom/KNOPPIX/boot.img
mkdir /mnt/KNOPPIXboot
mount /dev/loop0 /mnt/KNOPPIXboot
cp /mnt/KNOPPIXboot/* /knoppix/harddrive_boot
Later versions of KNOPPIX use isolinux: the necessary files will have been copied in step 2: they are in the directory .../boot/isolinux. The steps below assume KNOPPIX v3.7 is being used.

Step 4: Make the Partition Bootable

You now have to add the information relating to the newly created partition to your boot loader. The way you do this will depend heavily on which boot loader / Linux distribution you use. In Suse 9.0 using GRUB, you can do this using the "Boot Loader Configuration" tool under the Yast2 "System" tab. Use "Expert Manual Configuration". Check the device map (which reads the file /boot/grub/device): this tells you the device number for the hard drive containing your newly created partition. In order to get the device letters right, boot the KNOPPIX cd and look at the icons on the desktop.

Then in the manu.lst tab (which reads the file /boot/grub/menu.lst) add
### Don't change this comment: Yast2 identifier: Original name: PMKnoppix_24 ###
title PMKnoppix_24
kernel (hd1,6)/boot/isolinux/linux24 ramdisk_size=100000 init=/etc/init root=/dev/hdf7
initrd (hd1,6)/boot/isolinux/minirt24.gz

### Don't change this comment: Yast2 identifier: Original name: PMKnoppix_26 ###
title PMKnoppix_26
kernel (hd1,6)/boot/isolinux/linux26 ramdisk_size=100000 init=/etc/init root=/dev/hdf7
initrd (hd1,6)/boot/isolinux/minirt26.gz
for KNOPPIX 3.1, providing access to both the 2.4 and 2.6 kernels, or
### Don't change this comment: Yast2 identifier: Original name: PMKnoppix ###
title PMKnoppix
kernel (hd1,6)/boot/isolinux/linux ramdisk_size=100000 init=/etc/init root=/dev/hdf7
initrd (hd1,6)/boot/isolinux/minirt.gz
for KNOPPIX 3.8, which only includes the 2.6 kernel. You may want to add some options to the "kernel" line: I used
lang=en screen=1600x1200
If you use LILO instead of GRUB, remeber that you must run lilo to update the boot loader.

Finally, reboot your PC, select "Knoppix" at the boot loader, and check that the copy of KNOPPIX on the hard-drive boots correctly.

Part 2: Preparing the Development Environment

For this stage you will need around 5GB of hard drive space. This could be situated anywhere within you existing linux system. Start by booting into the KNOPPIX environment on your hard drive. Start a terminal (6th icon from the right on the taskbar) and become root (type "su root": you don't need a password).

Step 1: Copying the KNOPPIX file system

Create two new directories, called KNOPPIX_remastered and KNOPPIX_original. The first is where you will develop the remastered KNOPPIX: the second will allow you to restore the original if you want to start from scratch. Copy the /KNOPPIX directory into both of the new directories, remembering to preserve permissions. In my case, I put both directories on the second partition of the third hard drive (hde) using
mount /dev/hde2 /mnt/hde2
cd /mnt/hde2
mkdir KNOPPIX_original
mkdir KNOPPIX_remastered
cp -pR /KNOPPIX/* /mnt/hde2/KNOPPIX_remastered/
cp -pR /mnt/hde2/KNOPPIX_remastered/* /mnt/hde2/KNOPPIX_original/
This process will take some time: in my case about 90 minutes, although this will depend on your hardware.

Step 2: Create a swap file and some scripts

In order to make a new version of the compressed file system from your remastered version of KNOPPIX, you will need 1GB of memory. You can check the available memory using
free -otm
If you don't have 1GB of memory available, create a swap file. Again, I put this on hde: cd to the directory where you want to put the file and use
dd if=/dev/zero of=swapfile bs=1024 count=1000000
Next create three scripts: createSwap.sh to turn the swapfile on
/sbin/mkswap ./swapfile
/sbin/swapon ./swapfile
create_KNOPPIX.sh, which will replace the bootable KNOPPIX distribution in the 1GB partition created earlier with your updated version in KNOPPIX_rematered (the following should all be on one line: it has been reformatted here for display)
mkisofs -R -U -V "TINA KNOPPIX Live CD 1.0" -P "paul.bromiley@man.ac.uk" -hide-rr-moved -cache-inodes -no-bak -pad ./ | nice -5 ./usr/bin/create_compressed_fs - 65536 > /knoppix/KNOPPIX/KNOPPIX

mkisofs Create an iso filesystem
-R generate Rock Ridge extensions
-U be more flexible about allowed filenames
-V "TINA KNOPPIX Live CD 1.0" the volume ID
-P "paul.bromiley@man.ac.uk" the publisher ID
-hide-rr-moved hide the Rock Ridge RR_MOVED directory
-cache-inodes do not copy hard linked files multiple times (saves space)
-no-bak exclude backup files
-pad pad the end of the fielsystem to avoid read-ahead bugs
./ the location of the remastered root relative to the location of the script
| nice -5 pipe the output, nicing the process..
./usr/bin/create_compressed_fs - 65536 ...to the create_compressed_fs script included with KNOPPIX
> /knoppix/KNOPPIX/KNOPPIX the location of the large KNOPPIX file in your poor man's installation

and make_ISO.sh, which will create an ISO file from your bootable KNOPPIX distribution, allowing you to burn it onto a CD (again the following commands should be on one line)
mkisofs -pad -l -r -J -v -V "TINAKNOPPIX" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o /home/pab/knoppix.iso /knoppix/

mkisofs Create an iso filesystem
-pad pad the end of the iso to avoid read-ahead bugs
-l allow long filenames
-r set UID and GID to generic values
-J generate Joliet directory records (for use in Windows)
-v verbose mode
-V "TINAKNOPPIX" name of the CD
-no-emul-boot boot the CD without disk emulation
-boot-load-size 4 no. of sectors in the boot table
-boot-info-table patch the boot image with a table describing the CD layout
-b boot/isolinux/isolinux.bin relative path to the poor man's install boot file
-c boot/isolinux/boot.cat relative path to the poor man's install boot file
-hide-rr-moved hide the Rock Ridge RR_MOVED directory
-o /home/pab/knoppix.iso the location that the .iso file will be written to
/knoppix/ The path to you poor man's installation


Part 3: Modify the KNOPPIX Distribution

At this point you are ready to modify the KNOPPIX distribution to suit your own needs, by removing and installing software, and by altering the KNOPPIX preferences. This section also lists in detail the alterations that were made to KNOPPIX 3.3 in order to create TINA KNOPPIX. The most convenient way to proceed is to boot into your existing operating system, open a terminal, cd to the KNOPPIX_remastered directory and, as root, type
chroot ./
This changes the root directory of the terminal to KNOPPIX_remastered. You may also want to mount the /proc filesystem from within the terminal to allow internet access
mount -t proc /proc proc
Step 1: Remove Software

In order to create space to install your own software, you must first remove software included in the KNOPPIX distribution. Since the KNOPPIX distribution was, in part, designed to demonstrate how much software could be included on a single CD, a significant number of packages can be removed whilst still leaving a fully-functional linux distribution. The easiest way to do this is using a kicklist. Here is mine: it removes 473 MB of data (compressed). Once you are happy with the list, type
apt-get remove `cat my_kicklist.txt`
to remove the packaged listed. You will be prompted on whether to proceed once the dependency checking is complete, allowing you to check the amount of free space that wil be generated. Check for orphaned packages using
deborphan
If any packages are listed, add them to your kicklist and run apt-get remove again to remove them. You can also use
apt-get clean
To clean up after software installation etc. You can also use
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -n
to list installed packages by size.

Step 2: Install Software

You may also want to add software. This can be done in several ways e.g. use
apt-get install "package_name"
with the package name obtained from the Debian website. However, if you want to do this without accessing the internet directly, you can download the packages you want (in .deb format) from the debian website, and install them using
dpkg -i "package name"
Alternatively, you can download the Debian CD images, and mount them under linux using
mount -o loop "debian .iso name" "mount point"
allowing you to access all of the available packages via the file manager. The packages installed for TINA KNOPPIX were the OpenLook Virtual Windows Manager (in order to get the textsw_extras package: it might be possible to do this less expensively in terms of disk space), the XView libraries (which are required by Tina), Xgobi and gnuplot, which are useful for graphing data, maxima, a general-purpose computer algebra system, and DDD, a debugger:
ddd_3.3.1-14_i386.deb
gnuplot_3.7.2-4_i386.deb
gnuplot-mode_0.5q-2_all.deb
maxima_5.6-17_i386.deb
xviewg_3.2p1.4-16_i386.deb
xviewg-dev_3.2p1.4-16_i386.deb
olvwm_4.4.3.2p1.4-16_i386.deb
In addition, I installed a couple of other packages not available in debian, which I donwloaded from the web instead:
xgobi.sh
Step 3: Altering Settings

There are two main targets here. First, bootup is contralled by the script linuxrc. For older (before v3.4) versions of Knoppix, this is in the cloop compressed file miniroot.gz (in the harddrive_boot directory on the 1GB partition). Unzip this and mount it as a loop device using (as root)
cd /knoppix/harddrive_boot gunzip miniroot.gz mkdir /mnt/loop_dev mount -o loop miniroot /mnt/loop_dev
For newer versions the file is in the /boot/isolinux directory on the CD. Tinker around with the settings, then rezip the file using
umount /mnt/loop_dev gzip miniroot
The secomd target is the usual shell startup file /etc/profile: any aliases etc can be added here. Tina compilation requires some environment variables that are defined in the file /usr/local/Tina/tina.sh, so a line was added to profile to run this script when a shell is started.

Part 4: General Tinkering

The scope for tinkering with KNOPPIX is almost limitless. For example, you can replace the index.html file that runs at startup with your own, or even a whole set of webpages (such as the ones that you are reading now) by placing them in the root directory of the 1GB partition holding your bootable KNOPPIX distribution.

Step 1: Graphics

I modified the desktop wallpaper and the splash screen that displays as KDE is starting: the files are
(in the poor man's installation) .../KNOPPIX/background.png
and
/usr/share/apps/ksplash/Themes/Default/splash_top.png
You can also add icons to the desktop: see the tinatool icons in
/etc/skel/Desktop
for examples of how to do this.

Part 5: Write the Modified Distribution to a CD

Once you have modified the KNOPPIX disribution, you can produce a new live CD. There are two steps to this process: test the distribution by booting from the hard drive first, then produce an .iso file and burn it to a CD.

Step 1: Test the Distribution

The scripts written in Part 2 make this process easy: run createSwap.sh first to create the necessary amount of swap space if needed, then run make_KNOPPIX.sh to replace the bootable KNOPPIX distribution on the hard drive with a compressed version of the distribution in the KNOPPIX_remastered directory. Then reboot into the hard-drive based version of the distribution and ensure that everything is working correctly.You may want to run KNOPPIX.clean to clean up temporary files and thus save a bit of space on your CD, but make sure that you do this from within the chrooted environment.

Step 2: Burn the CD

When you are happy with your changes, it is time to run the make_ISO.sh script to create an ISO file that you can burn to a CD using your favourite CD burning software. Make sure that you use the "burn image" mode of your software, rather then simply putting the ISO on the CD as a file!

Step 3: Optimise the CD (Optional)

KNOPPIX boots quickly from CD in part because the ordering of the files on the disk has been optimised (think defrgamentation for the CD). In order to perform this optimisation, you need a sort list, which is generated using this script and this file. The timestamp file is only used to provide a comparative file time: the script looks at the file access times and sorts them into order, so that the files are burned onto the CD in the order in which they are needed when the disk boots. Follow the procedure above until you get to the "test the distribution" step. Once you have booted into your remastered poor man's installation, copy all three files into the root directory, and run the script. Remember to copy the finished sort list back to a permanent location. Then modify your create.KNOPPIX.sh script to include "-sort path_to_sort_file" like so:
mkisofs -R -U -V "TINA KNOPPIX Live CD 1.0" -P "paul.bromiley@man.ac.uk" -sort /knoppix/KNOPPIX/scripts/mkisofs.sort -hide-rr-moved -cache-inodes -no-bak -pad ./ | nice -5 ./usr/bin/create_compressed_fs - 65536 > /knoppix/KNOPPIX/KNOPPIX
Then run the modified script to create your KNOPPIX.sh file, and finally run make_ISO.sh to create the optimised iso, ready to burn to CD.

Part 6: DVDs

DVD writers are becoming increasingly affordable and common, and of course it is possible to produce a KNOPPIX DVD, using the extra space to install even more software: KOPPIX 3.5 (the Linuxtag edition from 2004) was a DVD-based version. However, the compressed KNOPPIX.sh file cannot become larger than 2.1GB due to limitations within the ISO filesystem. In order to work around this, you must split the file into several chunks, and adapt the bootloader to mount them all during the boot process. See the knoppix.net forums for further information.