LinuxDevCenter.com

oreilly.comSafari Books Online.Conferences.

We've expanded our Linux news coverage and improved our search! Search for all things Linux across O'Reilly!

Search
Search Tips

advertisement

Listen Print Discuss Subscribe to Linux Subscribe to Newsletters

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




Tagged Articles

Post to del.icio.us

This article has been tagged:

knoppix

Articles that share the tag knoppix:

True Stories of Knoppix Rescues (13 tags)

Using and Customizing Knoppix (11 tags)

View All

linux

Articles that share the tag linux:

Managing Disk Space with LVM (74 tags)

Use Your Digital Camera with Linux (60 tags)

mdadm: A New Tool For Linux Software RAID Management (59 tags)

Asterisk: A Bare-Bones VoIP Example (43 tags)

View All

livecd

Articles that share the tag livecd:

Building an OpenBSD Live CD (22 tags)

Using and Customizing Knoppix (6 tags)

A Network Administrator's Best Friend: BartPE (4 tags)

Feather Linux: The Swiss Army Knife of LiveCDs (2 tags)

Building a Web Cluster with FreeSBIE (2 tags)

View All

howto

Articles that share the tag howto:

Rolling with Ruby on Rails (258 tags)

From Weblog to CMS with WordPress (98 tags)

Top Ten Digital Photography Tips (92 tags)

Top Ten Mac OS X Tips for Unix Geeks (79 tags)

View All

technology

Articles that share the tag technology:

What Is Web 2.0 (632 tags)

What Is a Wiki (and How to Use One for Your Projects) (14 tags)

Remixing Culture: An Interview with Lawrence Lessig (13 tags)

Inventing the Future (13 tags)

Stewart Butterfield on Flickr (10 tags)

View All

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com