Redhat 5.1 - ANSWERS - compile kernel, modules, /lib/modules/preferred

Redhat 5.1 - ANSWERS - compile kernel, modules, /lib/modules/preferred

Post by Eddie Grov » Thu, 05 Nov 1998 04:00:00



Especially when I start out, I like to keep around
a bunch of kernels.  Some with sound compiled in,
some without, some as a module.  And whatever else
I am working on.  Unfortunately, redhat 5.1 does things
in a strange way, which means that I got very confused
about problems relating to modules.

Here's what it does:  At boot-up, the system does the
equivalent of   cat /proc/version   to find out the
version of the kernel being used, which is a fairly long
string of characters.  It then looks for that string
to be in a file in /lib/modules/2.0*/.rhkmvtag .
That is THE MOST IMPORTANT FILE in the modules
directory, and it IS NOT GENERATED.  Can you say
"serious design flaw"?  I knew you could.
It uses this info to figure out where to point
/lib/modules/preferred and /boot/System.map

At the end of this message I include a [poor] script that
does what needs to be done.  It should be run in the
directory where you make the kernel.  It should really
be part of the "make modules_install".  I encourage
people who know what they are doing to improve it, add
error-checking, etc., or ideally figure a patch to the Makefile.

Before we get there, let me remark that sound.o is a very
special module.  When I upgraded to redhat kernel sources
and headers 2.0.35-7, I could no longer compile it.  Be
very careful.  Also, see other posts about fixes for
net-pf-4 errors, basically you turn them off in the
file /etc/conf.modules with the two lines
alias net-pf-4 off
alias net-pf-5 off

The following script was what I used to create the new
kernel I think of as soundmod (for sound as a module).
The only trick is to use "strings" on init/version.o
to find out the full version name of the kernel.

Oh - and for those who ask how to save the old kernel,
the trick is not to overwrite it!  It is that simple. :)
Keep around several until you pick the one you like best.

Eddie Grove

please feel free to copy, modify, and propogate a better
version of this!  If it helps you, let me know it was
worth the trouble to post.

#!/bin/sh

VERSION=2.0.35
NEWNAME=soundmod
# should check that does not already exist
# note that initial redhat installation has NEWNAME=1

cd /usr/src/linux

make zImage
cp .config /boot/config-$VERSION-$NEWNAME
# It makes sense to save the config file used to build the kernel
cp arch/i386/boot/zImage /boot/vmlinuz-$VERSION-$NEWNAME
cp System.map /boot/System.map-$VERSION-$NEWNAME

make modules
make modules_install
strings init/version.o | grep version > /lib/modules/$VERSION/.rhkmvtag
mv /lib/modules/$VERSION /lib/modules/$VERSION-$NEWNAME

echo "Don't forget to modify /etc/lilo.conf"