[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to handle kernels of the same version



I've known for a while now, but just now had a chance to implement, how to 
handle several kernels of the same version, while maintaining the ability 
to use modules.  It's a simple concept really, and a very simple 
implementation.

The basic concept is to use the kernel version number (rather than the 
kernel version) to index the modules.  Every kernel is built using a 
version number, the previous kernel having been built with the number 
stored in /usr/src/linux/.version.  This it the value you see when you do a 
uname -a:

Linux psi.int.omegacs.net 2.0.32 #1 Sun Nov 30 15:34:00 PST 1997 i586 unknown

Since /etc/conf.modules can specify paths to the modules directories, and 
since they are passed through a shell for expansion, as per the 
documentation, we can not only specify the kernel version, but the version 
number:

path=/lib/modules/`uname -r`-`uname -v | cut -c2- | cut -d\  -f1`

There are quite a number of paths to set, including that of every 
subdirectory (block, cdrom, fs, ipv4, misc, net, pcmcia, scsi), and the 
path to the modules.dep file.

However, once these are set up properly, you can boot to any kernel you 
want, as long as you have the modules in the right place (i.e. 
/lib/modules/2.0.30-2), and the kernel actually matches those modules.

In order for the modules to stay in sync, however, we'll have to be very 
careful with the .version file.  The kernel Makefile will automatically 
increment it by one during a build of zImage, so as long as we find the max 
of the existing kernel version numbers on the current system and put that 
in .version before building, we should be OK.

If anyone has a machine to play around with this on, see if you can come up 
with some scripts to handle setting the .version file correctly, building a 
kernel, and installing everything in the right place.  For now you can 
assume that you're being given a correct .config file.

TTYL,
    Omega

     Erik Walthinsen <omega@seul.org> - SEUL Project system architect
        __
       /  \                SEUL: Simple End-User Linux -
      |    | M E G A            Creating a Linux distribution
      _\  /_                         for the home or office user