Difference between revisions of "Trivial remaster 3.8.2"


From Knoppix Documentation Wiki
Jump to: navigation, search
m (Making the image)
(unionfs)
Line 234: Line 234:
 
ls -la $knx/knoppix.iso
 
ls -la $knx/knoppix.iso
 
# finished imaging the ISO
 
# finished imaging the ISO
 +
</nowiki></pre>
 +
 +
== Unmounting the union filesystem ==
 +
<pre><nowiki>
 +
umount $knx/master
 +
find $knx/master -ls
 +
 +
# finished umounting
 
</nowiki></pre>
 
</nowiki></pre>
  

Revision as of 04:26, 25 August 2005


This remaster script will extract the files from the existing CD and rebuild a new ISO. No changes or only minimal changes are made to the files used to build the ISO.

Based on the Knoppix Remastering Howto

This remastering assumes the following:

  • you are running Knoppix 3.8.2
  • you have a linux filesystem with at least 6 GB of free space

Summary

Remastering is the process of creating a new ISO image to burn on a CD. In it's simplest form, remastering requires only two steps:

  1. build a compressed filesystem from all the operating system and application files
  2. build an ISO image from all the CD files, which includes the compressed filesystem

In fact, if you use the existing compressed filesystem from the CD, you only need to do the second step, which is what some of the versions on this page do.

In practice, remastering takes more than two steps because you usually need to create the environment (e.g. swapspace, diskspace, etc.) in which to build the compressed filesystem and the ISO. Also, since the purpose of remastering is to make a Knoppix CD that differs from the stock Knoppix, you will probably want to alter the contents of the compressed file system, the contents of the CD files, or both before you build your new ISO.

Setting up for remastering

The setup will be the same for all the various version of remastering.


# boot from the Knoppix CD
boot: knoppix 3

# point to the partition, mountpoint, and working directory for the Knoppix build
knx_dev=/dev/hda3 ; knx_mnt=/mnt/hda3 ; knx=$knx_mnt/knx

# Mount the partition
mount -o rw,dev $knx_dev $knx_mnt
mount
df -H $knx_mnt

# make a 1 GB swapfile
dd if=/dev/zero of=$knx_mnt/swapfile bs=1M count=1000
mkswap $knx_mnt/swapfile
swapon $knx_mnt/swapfile
swapon -s

# create a working directory
mkdir $knx
cd $knx
pwd

# make two target folders: one for the source and one for the final master CD
mkdir -p $knx/{master,source}
ls -la $knx

# finished setup

A "test build" version

Ideal if you just want to test the build process. This version uses the files right off the CD to make a new ISO. No changes.

Setting up for remastering

See the above instructions for booting, creating enough disk space, and a setting up a swap file.

Copying the files


# copy the cdrom files to your master directory
( cd /cdrom && cp -av . $knx/master/ )
ls -la $knx/master/

# finished copying the files

Making the image

# make the ISO
mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 \
 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
 -hide-rr-moved -o $knx/knoppix.iso $knx/master 2> $knx/knoppix.iso.log
ls -la $knx/knoppix.iso

# finished imaging the ISO

A "modified boot files" version

Ideal if you just want to change the boot configuation (e.g. add your own cheatcodes or kernel label) but keep everything else the same.

Setting up for remastering

See the above instructions for booting, creating enough disk space, and a setting up a swap file.

Mounting a union filesystem

Instead of copying all the files, we'll use a unionfs.

mount -t unionfs -o dirs=$knx/master=rw:/cdrom=ro none $knx/master
ls -la $knx/master/

# at this point you can modify any of the files in $knx/master/
# for example, a different boot splash image
jpegtopnm /KNOPPIX/usr/share/wallpapers/Circuit.jpg |
  pnmtile 640 480 > $knx/logo.ppm
pnmquant 16 $knx/logo.ppm |
  ppmtolss16 > $knx/master/boot/isolinux/logo.16 

# finished copying the files

Making the image


# make the ISO
mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 \
 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
 -hide-rr-moved -o $knx/knoppix.iso $knx/master 2> $knx/knoppix.iso.log
ls -la $knx/knoppix.iso

# finished imaging the ISO

Unmounting the union filesystem

umount $knx/master
find $knx/master -ls

# finished umounting

A "rebuilt compressed fs" version

Setting up for remastering

See the above instructions for booting, creating enough disk space, and a setting up a swap file.

Copying the files


# copy the cdrom files to your master directory
( cd /cdrom &&
find . -size -10000k -type f |
xargs cp -a --parents --target-directory=$knx/master/ )
ls -la $knx/master/

# copy the KNOPPIX files to your source directory
cp -a /KNOPPIX/* $knx/source/
ls -la $knx/source/

# finished copying the files

Making the image

# make the compressed image
{ mkisofs -R -U -V "KNOPPIX.net filesystem" \
  -publisher "KNOPPIX www.knoppix.net" \
  -hide-rr-moved -cache-inodes -no-bak \
  -pad $knx/source |
nice -5 /usr/bin/create_compressed_fs - 65536 \
> $knx/master/KNOPPIX/KNOPPIX ; } 2> $knx/KNOPPIX.cloop.log
ls -la $knx/master/KNOPPIX/KNOPPIX

# make the ISO
mkisofs -pad -l -r -J -v -V "KNOPPIX" \
 -no-emul-boot -boot-load-size 4 \
 -boot-info-table -b boot/isolinux/isolinux.bin \
 -c boot/isolinux/boot.cat \
 -hide-rr-moved -o $knx/knoppix.iso $knx/master \
2> $knx/knoppix.iso.log
ls -la $knx/knoppix.iso

# finished imaging the ISO

A "chroot" version

Setting up for remastering

See the above instructions for booting, creating enough disk space, and a setting up a swap file.

Mounting the files with unionfs


# mount the master
mount -t unionfs -o dirs=$knx/master=rw:/cdrom=ro none $knx/master
ls -a $knx/master/
rm -rf $knx/master/KNOPPIX/KNOPPIX
ls -a $knx/master/

# make sure $knx/source is mounted without "nodev" (or with "dev")
mount -o remount,dev $(df -P $knx/source | tail -1 | cut -d" " -f 1)

# mount the source
mount -t unionfs -o dirs=$knx/source=rw:/KNOPPIX=ro none $knx/source
ls -a $knx/source/
rm -rf $knx/source/.rr_moved
ls -a $knx/source/

# finished copying the files

chroot into the source folder

# create /etc/fstab and /etc/resolv.conf in $knx/source
echo >> $knx/source/etc/fstab
cat /etc/resolv.conf > $knx/source/etc/dhcpc/resolv.conf

# chroot, proc, ls, and exit
chroot $knx/source
mount -t proc /proc proc
ls -a /
ping -c 2 knoppix.net
umount /proc
exit

# finished chrooting

Making the image


# make the compressed image
{ mkisofs -R -U -V "KNOPPIX.net filesystem" \
  -publisher "KNOPPIX www.knoppix.net" \
  -hide-rr-moved -cache-inodes -no-bak \
  -pad $knx/source |
nice -5 /usr/bin/create_compressed_fs - 65536 \
> $knx/master/KNOPPIX/KNOPPIX ; } 2> $knx/KNOPPIX.cloop.log
ls -la $knx/master/KNOPPIX/KNOPPIX

# make the ISO
mkisofs -pad -l -r -J -v -V "KNOPPIX" \
 -no-emul-boot -boot-load-size 4 \
 -boot-info-table -b boot/isolinux/isolinux.bin \
 -c boot/isolinux/boot.cat \
 -hide-rr-moved -o $knx/knoppix.iso $knx/master \
2> $knx/knoppix.iso.log
ls -la $knx/knoppix.iso
# finished imaging the ISO

Unmounting the union filesystem

umount $knx/master
find $knx/master -ls

# finished umounting

Notes

  • The resulting compressed filesystem is larger than the original KNOPPIX even though nothing has changed. I suspect hardlinks on the original that don't get "translated" on the ISO format.
( cd $knx/ ; ls -lh master/KNOPPIX/KNOPPIX /cdrom/KNOPPIX/KNOPPIX )
-r--r--r--  1 root root 690M May  9 03:31 /cdrom/KNOPPIX/KNOPPIX
-rwxr-xr-x  1 root root 717M Aug 24 22:17 master/KNOPPIX/KNOPPIX
  • The resulting ISO is larger than the original and too large for a 700 MB CD.
( cd $knx/ ; ls -lh knoppix.iso )
-rw-r--r--  1 root root 722M Aug 24 23:01 knoppix.iso

Burning the ISO

k3b doesn't work on 3.8.2, but cdrecord does


# burn the ISO
cdrecord -v dev=ATAPI:0,0,0 $knx/knoppix.iso

# finished burning