Copying the modules and kernel into the miniroot
Returning to our previous miniroot discussion, recall that the kernel is booted by the CD, based on entries in the isolinux.cfg file. Since we are working on adding a new kernel, version 2.6.8, copy the kernel that you've just created in the chrooted environment into the boot/isolinux directory as vmlinuz268. Copy the miniroot.gz file to miniroot268.gz in the same directory. Now, create a temporary directory and decompress the miniroot268.gz file. Mount it as a loopback device:
root@[tty1]# gzip -d miniroot268.gz root@[tty1]# mount -o loop miniroot268 tempdir/
Now, unmount the loopback filesystem:
root@[tty1]# umount tempdir ; gzip miniroot ; rmdir tempdir
At this point you should be ready.
Look into tempdir/ and you will see the basic root filesystem used for booting. Look into modules (under tempdir/, or wherever you have it mounted) and see cloop.ko and a scsi directory with more modules (the number of which will vary from distribution to distribution). From the lib/modules that directory you created in the chrooted environment, copy and overwrite the current modules with the new ones. Keep in mind that the miniroot268 file is a loopback filesystem, which means that it can run out of space when you try and unmount it. I suggest removing the more obscure SCSI drivers if necessary. They are used to mount boot-media (such as the CD) only. If you can be sure you will not need a certain driver to boot from, leave it out. It will still be available once Knoppix is running, if you find you need it later.
Before you finish, run a 'modinfo' on all the modules and be absolutely sure that they match the kernel you will be booting (the vmlinuz268 file). Linux will not boot very far if they don't match. While you have the miniroot filesystem loaded, you can edit the linuxrc file present in the 'root' directory of the filesystem. All boot options not already covered in isolinux.cfg or init scripts can be controlled from here and the file is fairly self-explanatory. Edit it at your own risk—though there are replacements available from any Knoppix distribution if necessary.
Double-check that all the operations were performed. This includes the following:
- Editing the isolinux.cfg (if you're keeping an old kernel)
- Creating the new kernel and copying to the CD-mastering directory as vmlinuz
- Creating the new kernel modules, both installing them in the Knoppix chrooted environment AND copying critical ones to the miniroot subsystem.
Next, attempt the mkisofs command as detailed in the last article and then test the system with qemu (highly-recommended). The most common error is a mismatch between the kernel version and the module versions. Remember that you need working copies (with exact version matches) within the Knoppix filesystem as well.