The uname command enables you to find the current kernel version of your Linux environment. However, you might need to modify the results from the uname command to get your kernel versions to match.
The following steps modify the uname command to provide the value you need:
To obtain your current kernel version, enter:
uname -r
Write down the version number so you an use it in Step 4. This example uses version 2.6.13-15-smp from a SLES 9 SP2 installation.
Create a new directory, enter:
mkdir /bin/orig
To move the uname binary to the /bin/orig directory that you just created, enter:
mv /bin/uname /bin/orig/uname
Use a Linux editor (such as vi) to create the /bin/uname file that contains the following lines:
#!/bin/sh
#uname
if [ $KRNLVERSION"a" = "a" ] ; then
if [ $(/bin/orig/uname -r) = "2.6.13-15-smp" ] ; then
export KRNLVERSION=2.6.13-15-smp
else
export KRNLVERSION=2.4.31
fi
fi
if [ $1"a" = "-ra" ] ; then
echo $KRNLVERSION
else
/bin/orig/uname $*
fi
IMPORTANT: Replace the strings "2.6.13-15-smp" with the version you found in Step 1.
To make the new uname command script executable, enter:
chmod +x /bin/uname
Enter the following to cause the uname -r command to return a specific version, such as when compiling a module:
export KRNLVERSION="2.6.5-7.191"
Following the manufacturer's directions, compile the module using the appropriate make command.
To reset uname so that it returns actual values, enter:
unset KRNLVERSION