LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Using and Customizing Knoppix
Pages: 1, 2, 3

The Method

First, make sure you back up all of your data before starting. You'll need root access to your machine.



Part 1. Emulating the CD on the hard drive

Step 1: Create a partition

Create an empty Linux partition of at least 700MB. In my case, I chose to resize and format an existing partition on my second hard drive.

Step 2: Create the directory structure

  1. Mount the newly created partition and create a directory named hardrive_boot.

  2. Insert the Knoppix CD and, as root, copy the /KNOPPIX directory from the CD into the root directory of the partition.

  3. Copy the following files from the CD to the root partition: autorun.bat, cdrom.ico, autorun.inf, and index.html. Remember to preserve the permissions as you copy everything over to the hard drive.

The left side of the panel in Figure 1 shows the CD's directory structure, while the right side shows the hard drive's partition.

screen shot of two directories
Figure 1. Copying files from the CD to the hard drive

Step 3: Copy the boot image

Copy the contents of the compressed kernel image from the CD. Mount the file /KNOPPIX/boot.img on a loop device and copy the contents from the device to /hardrive_boot/. I used these commands:

bash-2.05# /sbin/losetup /dev/loop0 /mnt/linux1/KNOPPIX/boot.img
bash-2.05# mount /dev/loop0 /mnt/floppy/
bash-2.05# cp /mnt/floppy/* /mnt/linux1/hardrive_boot

Step 4: Make the partition bootable

Here's an extract of my own LILO configuration. Your instructions will differ if you use something other than LILO.

image = /mnt/linux1/hardrive_boot/vmlinuz
	label  = knoppix
	initrd = /mnt/linux1/hardrive_boot/miniroot.gz
	read-only
	root   = /dev/hdc2
	append = "lang=us"

Step 5: Update the bootloader (LILO)

Update the bootloader. In my case, this was:

bash-2.05# /sbin/lilo
Added linux *
Added knoppix
Added win2k
bash-2.05#

Step 6: Test the installation

Everything is now set and ready to go. Remove the CD and reboot your PC, choosing Knoppix from the bootloader's menu. The system will now behave as it would if booted from the CD.

Part 2. Preparing the Development Environment

Now that you have transferred the Knoppix distribution to the hard drive, it's time to create the development environment. This environment will consist of:

  • A working copy of the file system. This is what you will develop.
  • An original copy of the file system. This is here just in case you are not satisfied with your remastered version and want to start over.
  • The scripts, utilities, and instructions required to create your new live-CD file system and ISO image.
  • A swap file in case you don't have enough RAM.

Step 1: Boot the Knoppix partition

You'll copy working copies of the file system to the development hard drive. Don't confuse this with the 710MB partition you created in earlier steps. This will require at least 3GB of space.

Step 2: Create directories

  • Create three directories: KNOPPIX_original, KNOPPIX_remastered, and masterISO.
  • Enter the masterISO directory and create symbolic links that link to the Knoppix distribution's partition, directory, and file structure that you created in back in part 1.

Figure 2 shows a mix of symbolic and hard links to the real directories and files located on the newly created partition.

screen shot of masterISO directory
Figure 2. The masterISO directory

Step 3: Copy the Knoppix file system

As root, copy the contents of the CD's KNOPPIX expanded directory to the hard drive. It's important to preserve all file attributes to be able to copy the devices. The copying will take a while; now is a good time to order pizza.

bash-2.05# cp -pR /KNOPPIX/* /mnt/hdc1/KNOPPIX_original
bash-2.05# cp -pR /mnt/hdc1/KNOPPIX_original/* /mnt/hdc1/KNOPPIX_remastered

Step 4: The scripts

To keep things straight in my head, I created three scripts. createSwap.sh activates the swap drive. You may not need this, but I did.

/sbin/mkswap ./swapfile
/sbin/swapon ./swapfile

You can verify that this works by checking the amount of memory you have:

$ free -otm

testDistribution.sh creates a compressed file system using mkisofs and a utility from the Knoppix distribution called create_compressed_fs. Copy create_compressed_fs to the current working directory on the development partition. This script contains the following commands, all on one line (though they've been reformatted slightly for publication):

mkisofs -R -U -V "PostgreSQL Live CD"
	-P "robert.bernier5@sympatico.ca"
	-hide-rr-moved -cache-inodes -no-bak
	-pad ./KNOPPIX_remastered | nice -5 ./create_compressed_fs - 65536 >
	./masterISO/KNOPPIX/KNOPPIX

createLiveCD_iso.sh creates the ISO image that will be burned onto a CD-R. Again, this script contains the following commands, all on one line:

mkisofs -pad -f -l -r -J -v -V "KNOPPIX" -b KNOPPIX/boot.img
	-c KNOPPIX/boot.cat -hide-rr-moved -o ./knoppix.iso ./masterISO/

Step 5: Create a swap file

If you don't have 1GB of RAM, you'll need a swap file:

bash-2.05# dd if=/dev/zero of=swapfile bs=1024 count=1000000

We've covered a lot of ground so far. You might wonder if it's worth the effort. The short answer is yes. If you want to do serious work and create a great self-booting CD, then you want to let your imagination run wild and try all sorts of ideas. The last thing you want to worry about is the menial command-line stuff or losing valuable time from a disaster compilation.

Figure 3 shows the completed development directory structure.

screen shot of completed directory
Figure 3. The completed directory structure

Pages: 1, 2, 3

Next Pagearrow




Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: