Remastering Linux on a Mac - thursday 2006-09-28 1926 last modified 2006-10-06 0446
Categories: Nerdy, Linux
TrackBacks Sent: None

I'm not much into using Linux on the desktop anymore; while Debian is my first choice for a new server machine installation, Linux just doesn't cut it for me as a desktop. Many things have come down the pipe since I last actively used it (Mandrake - which no longer exists as such), most notably the popularity of bootable Live CDs. Stick a CD in to any machine with a bootable CD-ROM and you'll likely have a usable Linux environment, depending on the hardware.

Now I have a specific need for a custom, tailored boot CD; I'll write more about what it is in a later post. Suffice to say that the only way to test the CD in its eventual home environment is to actually burn a CD and drop it in to see how it goes. It can't be installed to disk and must be booted from CD every time.

This process is either called customization or remastering, which is one of those terms you just have to know if you're trying to search for more information on the topic. I'll also post a bit more on the remastering process itself, but for now the entertaining part was how I got to remaster a CD using my Mac. It is clearly wasteful to have to burn a CD with every minor change just to test it out, so I needed to both develop and boot-test it through Virtual PC.

The most popular small Linux distro appears to be Damn Small Linux, an operating system that weighs in at around 50MB. It comes very close to containing everything I needed, with some excess, so I started with a DSL base. They don't give any hints on the remastering process, so I had to find third party documentation for instructions.

The interesting part. To install Linux on the Virual PC for Mac is not difficult; just downoad and mount the image, and when the new Virtual PC instance starts up, it can boot from the mounted image. After you've finally got a terminal:

% sudo cfdisk

and give /dev/hda a large partition (very large if you intend to remaster something like Knoppix, which fills the entire CD). I was initially going to use two partitions and boot to them alternately depending on whether I was developing or testing, but only one partition is really necessary. For DSL, 2GB was more than enough.

Tell DSL to install itself to /dev/hda1, then let it go. Eventually it will spit out the 'CD' and reboot, and you'll have an environment for remastering. Once you're there, I'd recommend changing /etc/inittab to boot to level 3 instead of 5; you won't benefit from a GUI for this.

The next part is to get the vanilla filesystem from DSL into your environment; no, you can't just duplicate your recently installed Linux environment and work with that, things changed when you went from the CD to a hard disk installation. Various instructional sites will explain the extract_compressed_fs from the cloop utilities will do this for you; it didn't work in Virtual PC, complaining from every angle about not having enough 'out space,' whatever that means. I instead copied over the CD's contents, aside from the compressed KNOPPIX file, then rebooted from the original CD and proceeded to:

% mount -t ext3 /dev/hda1 /mnt/hda1
% mkdir -p /mnt/hda1/remaster/source/KNOPPIX
% cp -pR /KNOPPIX /mnt/hda1/remaster/source

To test any remastering, you need to rebuild the compressed KNOPPIX file and put it in /KNOPPIX/KNOPPIX, then amend your boot loader to recognize the Knoppix boot process. The easiest way to do this is to copy the /boot portion of the original CD image to somewhere on your partition, then modify your boot loader to point to the new boot directory.

And there you'd have it. Every cycle of testing requires rebuilding the KNOPPIX file, which is a bit tedious since it needs to do serious compression work, and sitting through reboots - but it's much better than needing throw a bunch of CD burns into the loop.

More later.



what kind of stuff did you throw on there that weren't available on the vanilla live cds?

why such a small distro (50MB) when a cd holds much more anyway (unless you were aiming for a bootable thumbdrive)?

did you go for a ppc or i386 distro?

Danny Park on September 30, 2006 08:05 PM

Fair questions; ...

Fair questions; rational but very specific answers are coming in future posts.

Ryan Lee on October 01, 2006 07:14 AM

You must login to leave a comment


Ryan's Journal: Remastering Damn Small Linux

Excerpt: ... Ryan's Journal RaynDrop : Ryan's Journal [ RSS Feed | All Entries | Previous Entry | Current Entries ] Remastering Damn Small Linux - sunday 2006-10-01 0315 last...

Ryan's Journal: Remastering Damn Small Linux on October 02, 2006 05:06 PM [pingback]