Building a new kernel is typically driven by new hardware or new revisions of old hardware that are not recognized by our current kernel. There can be other reasons, but since we now have a decent journalled filesystem, NFSv3 that works reasonably well with our other computers, and ``large'' file support, the reasons are typically due to hardware. Note that we can reduce this a bit, by buying computers in identical batches where-ever possible. Building kernels for production use at CFHT should be kept to a minimum, to reduce maintenance overheads. Remember that running three different kernels instead of one exposes us to the union of the bugs in all of them!
This section attempts to explain three different approaches to adding new kernel-level hardware support to Sidious Linux. The three approaches are:
To do this, use a completely stand-alone machine to re-build an existing kernel without changing the name. Then extract the resulting module from /lib/modules/*/ and add them to the stable release. As long as files were only added, and stable systems were never loading a module by that name before, this method can work, but please be careful!
Updating the /lib/modules/*/ directory for an existing kernel can work the same way for external packages. Build following their respective instructions on an isolated machine, then manually take the resulting modules over to the stable release.
Re-run ``depmod -a'' on the stable machine after any modules are added to /lib/modules. This will update the modules.dep file.
To set up any Sidious system for building a kernel, untar the latest KERNEL-*.tar.bz2 in /usr/src/. This will create a directory /usr/src/KERNEL/. If there is already one there, move it out of the way to be sure you are starting with a clean set of files. The latest kernel archive is KERNEL-2.4.26-4.tar.bz2 and should already be installed in /usr/src/ with an Sidious installation >= version 9.38d. For older Sidious installations, you can get this tar.bz2 file from the Sidious installation CDROM.
Then cd to the /usr/src/KERNEL/ directory. Summary:
# cd /usr/src # test -d KERNEL && mv KERNEL KERNEL.OLD # tar xjf KERNEL-2.4.26-4.tar.bz2 # cd KERNEL
After untarring this file, there are two other pieces needed to build a kernel for Sidious. One is the .README file which lists the patches and modules, and the other is the .config file which is a standard Linux kernel configuration file as generated by make menuconfig. The following sections explain how to set up these two files.
The KERNEL tar file includes several example .README files. If you want a kernel most similar to the modular laptop kernel, starting with a copy of linux-2.4.19-si6.README or linux-2.4.26-smp4.README (or any later version) is recommended. For building a multiprocessor or large memory model kernel, start with linux-2.4.26-smp4.README. Here are the steps:
[ASIDE: The number after the ``test'' or ``si'' or ``smp'' is intended to indicate whether or not this is just an experimental build that could be in flux, or a stable released version. ODD numbers are experimental and may vary. EVEN numbers are released and should not change.]
In summary:
# cp linux-2.4.26-smp4.README linux-2.4.26-test1.README # cp linux-2.4.26-smp4.config linux-2.4.26-test1.config # vi linux-2.4.26-test1.README
There are many ways to end up with a valid kernel .config file. The only tricky part is that some of the patches may add new options, so you want to generate the .config from a kernel tree that includes all your patches. The easiest way to do that is as follows:
In the /usr/src/KERNEL/ directory from KERNEL-2.4.26-4.tar.bz2 (or newer), and with the two files, .README and .config which you created in the previous steps, it is now possible to build a kernel. Given the example of 2.4.26-test1, the script will produce files in the following locations:
/usr/src/KERNEL/linux-2.4.26-test1/ /lib/modules/2.4.26-test1/ /boot/kernel-2.4.26-test1 /boot/System.map-2.4.26-test1
All of these must be removed or renamed first to produce a clean build!
Then:
That's it! The files listed at the beginning of this section (/lib/modules/linux-2.4.26-test1 and /boot/kernel-2.4.26-test1) can be transplanted to another system, or if your kernel was called -smp* or -rtai*, an etherboot image should also exist now in /tftpboot/.