Recent Changes - Search:

edit SideBar

RemasteringAKnoppixBasedCD

Stage 1: Get old Live CD into editable format

The directory structure you are going to end up with after this stage:

Working (current) folder

- old.iso – iso image of previous Live CD
- cd folder – booting and wrapper info from old Live CD plus squashed version of root filesystem.
- mnt folder – where old Live CD is/was mounted
- source folder – root folder and filesystem info for previous Live CD
- cloop – where old Live CD root folder and filesystem is/was mounted.
- mk-knoppix-iso.sh – script to create a new iso image (used in Stage 3)
- uncompressed.bin - The uncompressed file containing the old Live CD filesystem

1. Create directories to work with – cd, mnt, cloop, and source using mkdir commands: mkdir cd, mkdir mnt, mkdir cloop, and mkdir source.

2. Copy mk-knoppix-iso.sh script into current folder.

3. Create an iso image of the live cd you are going to work from dd if=/dev/cdrom of=old.iso. (If the cd-rom is currently mounted, unmount it first with the command sudo umount /dev/cdrom ). If this doesn’t work, you probably have errors on the CD. Try one of the graphical tools such as GnomeBaker? that has more error handling capability.

You don’t have to do this step if you already have an iso or if you wish to copy the files straight from the cd. If you do copy the files from the cd you’ll need to change the source for the rsync commands though (to eg. /media/cdrom0).

4. Mount the iso image sudo mount old.iso mnt -o loop

5. Rsync the live cd contents to the cd directory you made: rsync –a mnt/ cd/

6. If you don't have cloop module installed do it: sudo apt-get install cloop-utils

    In the readme for cloop it says "Make sure you have enough swap to hold the entire compressed image in virtual memory". If you need more just do the following to create a new empty swapfile (in this case for an extra 500MB) and use it:

        a. sudo dd if=/dev/zero of=/swapfile bs=1024 count=500k
        b. sudo mkswap /swapfile
        c. sudo swapon /swapfile

7. Uncompress the cloop filesystem: sudo extract_compressed_fs cd/KNOPPIX/KNOPPIX > uncompressed.bin 8. Mount cloop filesystem sudo mount uncompressed.bin cloop -o loop

9. Rsync the mounted filesystem to the source directory you made sudo rsync –a cloop/ source/

10. Unmount cloop and mnt: sudo umount cloop and sudo umount mnt

Stage 2: Adding and removing packages

11. Copy the resolv.conf (contains DNS server info) and sources.list (contains the repository info) from your machine to the CD root so you can access internet repositories:

sudo cp /etc/resolv.conf source/etc/resolv.conf

sudo cp /etc/apt/sources.list source/etc/apt/sources.list (only if your current machine is Knoppix based)

12. Change root to the source directory sudo chroot source/

13. Then export HOME=/root (sets the new home folder) and export LC_ALL=C (sets the internationalisation locale – should be C if you want to compile anything i.e. uses C ANSI standards for multiple locales).

You can now add and remove packages using the following commands:

- apt-get remove --purge <packagename> where <packagename> is the actual name of the package you wish to get rid of. You can remove several packages at once e.g. apt-get remove --purge evolution evolution-data-server evolution-exchange

- dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | grep -i <package> to work out the actual package names (where <package> is actually a string identifying which package you’re interested in.

- dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr |more will show the packages in order of size.

- apt-get update will update the package list. Do this before adding any new packages.

- apt-get install <packagename> where <packagename> is the name of the package you wish to install. Again you can add several packages at once.

Note that if you’re going to compile things you’ll need to do apt-get install build-essential to get the main libraries that aren’t installed by default.

14. Remove unnecessary temp files with apt-get clean, apt-get autoclean and rm -rf /tmp/*

15. Remove the resolv.conf as you don't want your network settings to remain in the live cd. rm /etc/resolv.conf

16. Exit the chroot environment exit

Stage 3: Creating the CD image

17. sudo vim cd/README.diskdefines and change the disk name if you wish (Basic vim commands are i to insert, esc :w! to write and :q to quit)

All commands below are done within mk-knoppix-iso.sh script (sudo ./mk-knoppix-iso.sh) 18. mkisofs -pad -l -R -U source/ | create_compressed_fs - 65536 > cd/KNOPPIX/KNOPPIX to create an iso of the source folder, compress it, and save it at the same time to replace the old KNOPPIX filesystem.

19. cd cd && find . -type f -print0 |xargs -0 md5sum > md5sum.txt create the new md5 hash and move into cd folder to do so

20. sudo mkisofs -r -V “<Name>" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../<isoname> . (NB: the . is necessary). This creates the iso file. The mk-knoppix-iso.sh script actually sets the volume name and ISO name to be the same prefix (Knoppix.x – x is the user supplied version number). The options are:

- r – create Rock Ridge format

- V – set volume ID (<Name> is anything you like)

- cache-inodes – needed to detect hard links (similar to Windows shortcuts).

- J – Joliet directory information

- l – allow full long (31 character) filenames for ISO9660? names.

- b – set El Torito boot image to cd/isolinux/isolinux.bin from original cd.

- c – set El Torito boot catalog to cd/isolinux/boot.cat from original cd.

- no-emul-boot – boot image is ‘no emulation’ image.

- boot-load-size 4 – sets the number of load segments

- boot-info-table – patch boot image with info table.

- o – output file set to be in parent folder (<isoname> is obviously anything you like)

- . – generate iso from current folder.

21. Write the CD and you’re finished. Boot up your live cd to test it.

Edit - History - Print - Recent Changes - Search
Page last modified on November 10, 2007, at 12:12 PM