Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
Like this article? We recommend

Compiling the New Kernel

This will hopefully be familiar territory for most readers, so I'll only cover it briefly. In this instance, I'll assume it is being done through the Debian apt subsystem. It's perfectly reasonable to do this within the chrooted Knoppix directory (which is based on Debian), so we'll use their method of installing kernels. Change the current working directory to the /usr/src directory:

root@not a tty[src]# apt-get install kernel-source-2.6.8
root@not a tty[src]# apt-get install kernel-image-2.6.8
root@not a tty[src]# apt-get install cloop-src

This last command is very important. At the heart of Knoppix is a compressed filesystem, made from the mkisofs/create_compressed_fs program in the last article. For Knoppix to boot, this filesystem must be uncompressed and mounted as a loopback device—a service performed by the cloop module, which is unfortunately not a stock Linux kernel module. Installing both the kernel-image and the kernel-source packages will probably save you time, since you won't need to recompile the entire kernel. If you will be custom-compiling the kernel as well, omit the kernel-image package. Uncompress the two files:

root@not a tty[src]# tar zxvf kernel-source-2.6.8.tar.gz && tar zxvf cloop-src.tar.gz

Change into the kernel-source directory:

root@not a tty[kernel-source-2.6.8] make-kpkg modules_image

It is possible that the make-kpkg program is missing, in which case you should install with the following package:

root@not a tty[kernel-source-2.6.8] apt-get install kernel-package

Using this will once again greatly simplify recompiling a kernel or kernel modules, especially when there is only one module to compile. Once it is complete, it creates a Debian package of the cloop module for you, so you must install it like so:

root@not a tty[kernel-source-2.6.8]# ls -ltra ../ (shows files in reverse order, newest last)
root@not a tty[kernel-source-2.6.8]# dpkg -i ../cloop-newest-version.deb

You may encounter an error when creating the cloop module, stating that the CONFIG_ZLIB_INFLATE kernel option is set to 'N' or 'M' (module) instead of 'Y.' If this occurs, you need to edit the .config file in the kernel-source directory (also usually placed in /boot/config-kernel-version) so that this entry points to 'Y.' Then, do the following to build a new kernel:

root@not a tty[kernel-source-2.6.8]# make-kpkg kernel-image

Next, build the modules_image as described previously. Install both as local packages by using the 'dpkg -i' command.

At this point you should have a complete set of kernel modules as well as an installed copy of the kernel. Before you go any further, use the 'modinfo' command to check the modules in /lib/modules/kernel-version against the version already installed—they must match exactly! Now, recreate the compressed filesystem just as you did in the last article and exit the chrooted environment when you're done.

  • + Share This
  • 🔖 Save To Your Account