Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I've used Knoppix before when I was otherwise doomed to borrow someones Wintel box as all my of my VGA-signal-producing or displaying hardware was down for the count. It's not as cozy as my little NetBSD install but I've come to get pretty good at getting my work done using it. While running NetBSD I'd steal large numbers of libs and binaries from it as it presents a whole running systems worth in an easy accessible location - not futzing with dependencies and brain dead package systems further aggrivated by running on a non-native system. And I've you've been following this discussion, you know I don't have a CD-ROM drive for this thing - sorry, ran out of money.

    KNOPPIX will install itself to a HD - this isn't what I'm talking about because I couldn't boot KNOPPIX in the first place to do the install! Instead, I had to install KNOPPIX from outside of KNOPPIX. When KNOPPIX installs itself, it extracts the contents of its compressed file system to an ext2 filesystem. I just copied the compressed filesystem image itself over, leaving it read-only.

    I found this page on installing Knoppix to a flash harddrive [linuxdevices.com] and said "close enough!". The instructions are good. However, I still had some trouble, which is why I'm posting. Hopefully this will further clarify. This should apply equally to any KNOPPIX-derived live boot CD (such as the one the above link is to). Here are the five essential ingrediants to a Knoppix install: LILO (or some other bootloader), boot.img, the kernel, miniroot, and the huge KNOPPIX file. In different (later) versions of KNOPPIX, the exactly arrangement of these parts (which contains which others) varies but the parts always exist. I think. Later KNOPPIXes changed the early boot procedure and dropped boot.img I think.

    boot.img contains the data from a 1.44 meg 3.5" floppy disk. This can be written to disk and used as a startup disk for systems that don't know how to boot from CD. More commonly, though, this is the CD boot file. The El Torito bootable CD specifications requires the CD to pick a 1.44 meg file of the same format as a floppy disk and use that to boot from (strictly speaking, it doesn't have to be 1.44 meg, but other sizes aren't handled well by various venders). On Knoppix 3.2, this contains SYSLINUX, the bootloader (in place of LILO) and the kernel. The floppy is of the UMSDOS format (MS-DOS extended with Unix permissions and long file names), and SYSLINUX is the DOS-mode Linux boot loader. This boot image also contains miniroot.gz, the next stage. When SYSLINUX boots the Linux kernel, vmlinuz, it passes it several parameters one of which is initrd=/boot/miniroot.gz or something close. This specifies that miniroot.gz should be used as an initial ram disk to run from. KNOPPIX 3.2 has this in the boot.img as part of the boot image; later versions of KNOPPIX can't fit vmlinuz and miniroot.gz both in 1.44 megs so miniroot.tgz is moved off the boot image. miniroot.gz is a compressed ext2 filesystem. If this file is part of the boot floppy, it may be extracted from the boot floppy, uncompressed, and mounted with loopback like gunzip miniroot.gz;mount -o loop miniroot /mnt/miniroot because we're throwing away the boot floppy in this process and installing LILO.

    When the system is finally loaded, this ram disk initialized by miniroot is still in place and it specifies the basic directory structure (all of those symlinks you see when you ls -l /). It contains a linuxrc file, a static/ directory containing very few executables, and a modules/ directory containing cloop.o and several SCSI card drivers. linuxrc is a shell script. It parses and handles most of the boot-time command arguments you give KNOPPIX. It tries to load to various SCSI modules and mounts various CD ROM devices looking for the KNOPPIX/KNOPPIX file which is the next and final stage in the boot process. When it finds KNOPPIX/KNOPPIX, it loads the cloop.o module and mounts KNOPPIX/KNOPPIX loop-back using it. KNOPPIX/KNOPPIX is a compressed filesystem image, and cloop is a special version of the loop filesytem layer that uncompresses on the fly. linuxrc hides errors and gags most output in general and my boot was failing, so this was my successful point of attack: I rewrote the file so it did little more than a few mount || echo "failed" operations:
    mount -t ext2 -o ro /dev/hda1 /cdrom || echo "sdw - uh oh, mount of /dev/hda1 /cdrom failed"

    if test -f /cdrom/KNOPPIX/KNOPPIX; then
    echo "sdw - looks like we found it so we're trying to cloop it"
    fi

    insmod -f /modules/cloop.o file=/cdrom/KNOPPIX/KNOPPIX
    mount -t iso9660 -o ro /dev/cloop /KNOPPIX || FOUND_KNOPPIX=""
    There is more to my linuxrc than this but this is the interesting bit. All of the failure cases were removed as were the subroutines and variables. The bit that got me was the last line in the previous listing: the version of cloop I had taken from KNOPPIX 3.2 didn't like the KNOPPIX 3.4 KNOPPIX file - it found a very large block it couldn't allocate enough memory for ("out of memory allocating...") but this error wasn't reported by the stock linuxrc. The documentation for KNOPPIX documents a dozen different ways to tell KNOPPIX to boot from a HD using parameters such as BOOT_IMAGE fromhd fromfile and others. Looking at linuxrc, however, only one of these was actually implemented, so I suspect the documentation is accumulated cruft and indecision. Rather than guess which one applies, I found it easier to just hard-code it, but if you're stuck with booting from CD, you might consider just mounting boot.img and miniroot.gz under loopback and inspecting the file to learn which one it really is for your version of KNOPPIX.

    KNOPPIX/KNOPPIX is a ISO9660 file system where individual files are individually compressed according to an optional ISO standard that mkisofs knows to create. As I write this, there is no other way to read this image than with cloop, but fear not, the source to this module may be downloaded and compiled, and some kind soul has explained how [goldfisch.at]. You shouldn't need to do this if you're just copying the KNOPPIX file over to your HD.

    Back to LILO. With a customized linuxrc, you need almost none of the extra= parameters. There, that was easy!

    You'll want to use the instructions I linked to initially as your primary instructions for actually doing the KNOPPIX HD install - I haven't given the actual commands or specified what gets copied where or explained how to configure LILO. This was just some background on what the parts are, how to really get at them, and how they interact. Good luck!

    -scott
    • Changes for KNOPPIX 3.6: ISOLINUX is used instead of SYSLINUX. Apparently the isolinux.bin file, which was created with the configuration in isolinux.cfg, understands how to talk to the BIOS and get data from the CD-ROM in order to fetch the kernel and it's root disk. Per the isolinux.cfg, there are two kernels: linux24 and linux26 which use minirt24.gz and minirt26.gz respectively. These files are no longer bundled up inside of a boot.img file but are on the main CD filesystem in the boot/isolinux director
    • Ahhh, a little more on the KNOPPIX system. There's a cloop module that a compressed filesystem can be mounted through (it's a filesystem layer, not a filesystem, apparently). But only one cloop device can be mounted at a time. http://www.lugatgt.org/articles/smallfootprint/ [lugatgt.org] explains how to uncompress (and compress) this filesystem: the magic is in the extract_compressed_fs and create_compressed_fs commands.